String¶
- class zixy.fermion.String(modes: int | Modes | None = None, source: SpecT = '')[source]¶
Bases:
String[NormalFermionOperatorArray,str|tuple[Sequence[int] |Sequence[bool],Sequence[int] |Sequence[bool]],tuple[list[int],list[int]]]A normal-ordered fermionic ladder-operator string.
A single mode-based normal-ordered fermionic string that may be an owning instance referencing a single element in a Rust-bound data object, or a view on an element in another collection.
- __getitem__(item: tuple[int, bool]) bool[source]¶
Return whether an operator is present on a mode.
- Parameters:
item – Pair of
(mode, is_creation), whereis_creationisTruefor a creation operator andFalsefor an annihilation operator.
- __init__(modes: int | Modes | None = None, source: SpecT = '')[source]¶
Initialize the string.
- Parameters:
modes – The mode space or mode count. If
None, the mode space is inferred from the string specifier.source – The string specifier to use for default modes and initial value.
- __mul__(rhs: String | CoeffT) RealTermSum | Term[CoeffT][source]¶
- Overloads:
self, rhs (String) → RealTermSum
self, rhs (CoeffT) → Term[CoeffT]
Multiplication of
selfbyrhs.Multiplication by a scalar returns a term. Multiplication by another normal-ordered string returns a term sum, since normal-ordering can produce zero, one, or multiple terms.
- __setitem__(item: tuple[int, bool], value: bool) None[source]¶
Set whether an operator is present on a mode.
- Parameters:
item – Pair of
(mode, is_creation), whereis_creationisTruefor a creation operator andFalsefor an annihilation operator.value – Whether the operator is present.
- aliases(other: Cmpnt[ImplT, SpecT]) bool¶
Determine whether
selfis a view of the same component asother.
- classmethod from_str(source: str, modes: int | Modes | None = None) Self[source]¶
Create an instance of
clsby parsing an input string.- Parameters:
source – String to parse.
modes – The mode space or mode count. If
None, the mode space is inferred from the string specifier.
- Returns:
An instance of
clsparsed fromsource.
- get_ops() list[tuple[int, bool]][source]¶
Get the normal-ordered ladder-operator product as
(mode, is_creation)pairs.
- impl_type¶
alias of
NormalFermionOperatorArray
- into(t: type[OutT]) OutT¶
Clone
selfinto a new related container of typet.- Parameters:
t – Type of the new container to create.
- Returns:
A new instance of
tcontaining the same data asself.
- property modes: Modes¶
Get the modes corresponding to
self.
- classmethod parse(source: str) Self¶
Parse a string into an instance of
cls.- Deprecated:
use
from_str()instead.
- Parameters:
source – String to parse.
- Returns:
An instance of
clsparsed fromsource.