monoprop

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)) + 1

Functions

func__init__(self, terms, coefficients, num_modes=None) -> None

Initialize the fermi operator.

paramself
paramtermsSequence[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
= None

Optional number of modes. If not provided, it will be inferred from the terms.

Returns

None
funcfrom_dict(cls, terms_dict) -> FermiOperator

Construct a FermiOperator from a dictionary.

paramcls
paramterms_dictdict[tuple[tuple[int, str], ...], complex]

Returns

monoprop.fermi.FermiOperator
func__len__(self) -> int

Number of terms in the operator.

paramself

Returns

int
func__repr__(self) -> str

Return a string representation of the fermionic operator.

paramself

Returns

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

Check that two operators are almost equal, term-wise.

paramself
paramotherobject

the other FermiOperator to compare to.

paramrtolfloat
= 1e-05

the relative tolerance parameter.

paramatolfloat
= 1e-08

the absolute tolerance parameter.

Returns

bool

A boolean.

funcget_majorana_operator(self) -> MajoranaOperator

Convert the fermi operator to a MajoranaOperator.

paramself

Returns

monoprop.majorana.MajoranaOperator

On this page