Majorana
A single Majorana monomial.
Represents an ordered product . Majorana terms are what a
MajoranaOperator is built from, and that operator is in turn what an
ExpGate exponentiates. Indices must be sorted, distinct and
non-negative; a repeated index is
rejected because m_i^2 = 1 would silently change the monomial's weight. Use
Majorana.from_unsorted to create a canonical term from an unsorted and/or repeated
index sequence.
An immutable value object: equal indices compare equal and hash alike, so a term can be
used as a dictionary key (as MajoranaOperator.terms does).
Attributes
attribute__slots__= ('indices',)attributeindices= indicesThe sorted, distinct Majorana indices of the monomial.
Functions
func__init__(self, *indices) -> NoneInitialize the Majorana monomial from its indices.
paramselfparamindicesint= ()Returns
Nonefuncfrom_unsorted(cls, *indices) -> tuple[Majorana, float]Create a canonical term from an unsorted index sequence.
Returns the sorted Majorana term together with the sign coming from reordering the
indices under Majorana anticommutation. Repeated indices are canceled in pairs using
m_i^2 = 1.
paramclsparamindicesint= ()Majorana indices in arbitrary order.
Returns
tuple(term, sign), where sign is +1.0 or -1.0.
func__eq__(self, other) -> boolTwo Majorana terms are equal when their sorted indices match.
paramselfparamotherobjectReturns
boolfunc__hash__(self) -> intHash on the sorted indices so equal terms share a bucket.
paramselfReturns
intfunc__repr__(self) -> strReturn a string representation such as Majorana(4, 5).
paramselfReturns
str