monoprop

Majorana

A single Majorana monomial.

Represents an ordered product mi1...miwm_{i_1} ... m_{i_w}. A term is the atom a MajoranaOperator is built from and the generator an 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 mi2=1m_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 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