SupportsFermionOperator

class SupportsFermionOperator(*args, **kwargs)

Bases: Protocol

An equivalent of the ffsim.SupportsFermionOperator protocol.

See fermion_operator() for the type-agnostic helper function dispatching to the method below.

>>> from qiskit_fermions.operators import MajoranaOperator
>>> maj_op = MajoranaOperator.from_dict({(0, 1): 1})
>>> fer_op = maj_op._fermion_operator_()
>>> print(format(fer_op.normal_ordered().simplify()))
  0.000000e0 +1.000000e0j * ()
  0.000000e0 -2.000000e0j * (+0 -0)

Protocol Methods

_fermion_operator_()

Converts this operator into a FermionOperator instance.

Return type:

FermionOperator