monoprop

Majorana

A single Majorana monomial.

Represents an ordered product mi1...miwm_{i_1} ... m_{i_w}. 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
= indices

The sorted, distinct Majorana indices of the monomial.

Functions

func__init__(self, *indices) -> None

Initialize the Majorana monomial from its indices.

paramself
paramindicesint
= ()

Returns

None
funcfrom_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.

paramcls
paramindicesint
= ()

Majorana indices in arbitrary order.

Returns

tuple

(term, sign), where sign is +1.0 or -1.0.

func__eq__(self, other) -> bool

Two Majorana terms are equal when their sorted indices match.

paramself
paramotherobject

Returns

bool
func__hash__(self) -> int

Hash on the sorted indices so equal terms share a bucket.

paramself

Returns

int
func__repr__(self) -> str

Return a string representation such as Majorana(4, 5).

paramself

Returns

str

On this page