monoprop

MajoranaOperator

A weighted sum of Majorana monomials.

Constructed from a \{term: coefficient\} mapping whose keys are Majorana terms or raw index tuples. Terms are normalized: indices are sorted within each monomial and duplicate monomials are summed. The resulting terms mapping (index tuple to complex coefficient) is what the propagator hands to the C++ engine.

Attributes

attributenum_modes
= num_modes
attributeterms
= self._accumulate(majoranas, list(terms.values()))
attribute__hash__
= None

Functions

func__init__(self, terms, num_modes) -> None

Initialize the Majorana operator from a term mapping.

num_modes is required, not inferred: the operator carries its own mode count, which is why a propagator and ExpGate both take an operator rather than a bare Majorana term.

paramself
paramtermsMapping[Majorana | Sequence[int], complex]
paramnum_modesint

Returns

None
funcget_majorana_operator(self) -> MajoranaOperator

Return self (satisfies the operator-conversion protocol).

paramself

Returns

monoprop.majorana.MajoranaOperator
func__len__(self) -> int

Number of distinct Majorana monomial terms.

paramself

Returns

int
func__repr__(self) -> str

Return a string representation of the operator.

paramself

Returns

str
func__eq__(self, other) -> bool

Equal when num_modes and term coefficients match exactly.

paramself
paramotherobject

Returns

bool
funcisclose(self, other, rtol=1e-05, atol=1e-08) -> bool

Check whether two MajoranaOperators have the same terms and close coefficients.

Coefficients are compared with numpy.isclose at rtol/atol; a differing mode count is False, not an error.

paramself
paramotherobject
paramrtolfloat
= 1e-05
paramatolfloat
= 1e-08

Returns

bool
funcall_pairwise_commute(self) -> bool

Whether every pair of Majorana monomials in the operator commutes.

For Majorana monomials M1M_1 and M2M_2 with supports S1S_1 and S2S_2, they commute if S1S2S1S2|S_1||S_2| - |S_1 \cap S_2| is even.

paramself

Returns

bool

True if all pairs of terms commute, else False.

On this page