FermiOperator
A weighted sum of FermiString terms.
Attributes
attributeterms= [(t if isinstance(t, FermiString) else FermiString(t)) for t in terms]attributecoefficients= list(coefficients)attributenum_modes= _validate_system_size(num_modes, argument_name='num_modes')attribute__hash__= NoneFunctions
func__init__(self, terms, coefficients, num_modes) -> NoneInitialize the fermi operator.
paramselfparamtermsSequence[FermiString] | Sequence[Sequence[tuple[int, str]]]List of FermiString objects representing the operator.
paramcoefficientsSequence[complex]List of coefficients corresponding to the terms.
paramnum_modesintNumber of modes in the system.
Returns
Nonefuncfrom_dict(cls, terms_dict, num_modes) -> FermiOperatorConstruct a FermiOperator from a dictionary.
paramclsparamterms_dictdict[tuple[tuple[int, str], ...], complex]paramnum_modesintReturns
monoprop.fermi.FermiOperatorfunc__len__(self) -> intNumber of terms in the operator.
paramselfReturns
intfunc__repr__(self) -> strReturn a string representation of the fermionic operator.
paramselfReturns
strfunc__eq__(self, other) -> boolEqual when terms, coefficients, and num_modes match exactly.
paramselfparamotherobjectReturns
boolfuncisclose(self, other, rtol=1e-05, atol=1e-08) -> boolCheck that two operators are almost equal, term-wise.
Terms are compared after canonicalization, with numpy.isclose at rtol/atol;
a differing mode count is False, not an error.
paramselfparamotherobjectparamrtolfloat= 1e-05paramatolfloat= 1e-08Returns
boolfuncget_majorana_operator(self) -> MajoranaOperatorConvert the fermi operator to a MajoranaOperator.
paramselfReturns
monoprop.majorana.MajoranaOperator