MajoranaOperator
A weighted sum of Majorana monomials.
Constructed from a \{term: coefficient\} mapping, where each key is a
Majorana term (or, equivalently, a raw index tuple). Terms are normalized:
indices within each monomial are sorted and duplicate monomials are summed. The resulting
terms mapping (Majorana-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.
paramselfparamtermsMapping[Majorana | Sequence[int], complex]Mapping from Majorana terms (or raw index tuples) to coefficients.
paramnum_modesintNumber of modes in the system. Required: an operator carries its own
mode count so a propagator can be built from it directly. A gate generator is
also authored as a MajoranaOperator (wrapped in
monoprop.circuit.ExpGate) -- bare Majorana terms are not accepted
by ExpGate, since the operator is what carries the mode count.
Returns
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 if two MajoranaOperators are closely equal (same terms and coefficients).
paramselfparamotherobjectAnother MajoranaOperator to compare with.
paramrtolfloat= 1e-05Relative tolerance for coefficient comparison.
paramatolfloat= 1e-08Absolute tolerance for coefficient comparison.
Returns
boolTrue if the operators have the same mode count and matching terms, else False.