monoprop

Majorana

A single Majorana monomial: the ordered product gamma_\{i_1\} ... gamma_\{i_w\}.

A term is the atom a :class:MajoranaOperator is built from and the generator an :class:~monoprop.circuit.ExpGate gate exponentiates. Indices are sorted on construction (matching the operator's canonicalization) and must be distinct and non-negative. A repeated index is rejected because gamma_i^2 = 1 would silently change the monomial's weight -- almost always a mistake rather than an intended simplification.

An immutable value object: equal indices compare equal and hash alike, so a term can be used as a dictionary key (as :attr:MajoranaOperator.terms does).

Attributes

attribute__slots__
= ('indices',)
attributeindices
= ordered

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
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