FermiOperator
Class representing a summed fermi operator.
Attributes
attributeterms= [(t if isinstance(t, FermiString) else FermiString(t)) for t in terms]attributecoefficients= list(coefficients)attributenum_modes= num_modes if num_modes is not None else max(idx for f in (self.terms) for idx, _ in (f.expression)) + 1Functions
func__init__(self, terms, coefficients, num_modes=None) -> 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_modesint | None= NoneOptional number of modes. If not provided, it will be inferred from the terms.
Returns
Nonefuncfrom_dict(cls, terms_dict) -> FermiOperatorConstruct a FermiOperator from a dictionary.
paramclsparamterms_dictdict[tuple[tuple[int, str], ...], complex]Returns
monoprop.fermi.FermiOperatorfunc__len__(self) -> intNumber of terms in the operator.
paramselfReturns
intfunc__repr__(self) -> strReturn a string representation of the fermionic operator.
paramselfReturns
strfuncisclose(self, other, rtol=1e-05, atol=1e-08) -> boolCheck that two operators are almost equal, term-wise.
paramselfparamotherobjectthe other FermiOperator to compare to.
paramrtolfloat= 1e-05the relative tolerance parameter.
paramatolfloat= 1e-08the absolute tolerance parameter.
Returns
boolA boolean.
funcget_majorana_operator(self) -> MajoranaOperatorConvert the fermi operator to a MajoranaOperator.
paramselfReturns
monoprop.majorana.MajoranaOperator