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_modesattributeterms= self._accumulate(majoranas, list(terms.values()))attribute__hash__= NoneFunctions
func__init__(self, terms, num_modes) -> NoneInitialize 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.
paramselfparamtermsMapping[Majorana | Sequence[int], complex]paramnum_modesintReturns
Nonefuncget_majorana_operator(self) -> MajoranaOperatorReturn self (satisfies the operator-conversion protocol).
paramselfReturns
monoprop.majorana.MajoranaOperatorfunc__len__(self) -> intNumber of distinct Majorana monomial terms.
paramselfReturns
intfunc__repr__(self) -> strReturn a string representation of the operator.
paramselfReturns
strfunc__eq__(self, other) -> boolEqual when num_modes and term coefficients match exactly.
paramselfparamotherobjectReturns
boolfuncisclose(self, other, rtol=1e-05, atol=1e-08) -> boolCheck 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.
paramselfparamotherobjectparamrtolfloat= 1e-05paramatolfloat= 1e-08Returns
boolfuncall_pairwise_commute(self) -> boolWhether every pair of Majorana monomials in the operator commutes.
For Majorana monomials and with supports and , they
commute if is even.
paramselfReturns
boolTrue if all pairs of terms commute, else False.