SupportsFermionOperator
class SupportsFermionOperator(*args, **kwargs)
Bases: Protocol
This package’s operator-conversion contract, converting an operator to a FermionOperator.
See fermion_operator() for the type-agnostic helper function dispatching to the method below.
Caution
Despite the shared method name, this is not the same contract as ffsim.SupportsFermionOperator: this one returns a FermionOperator, whereas ffsim’s returns an ffsim.FermionOperator. The two types are unrelated. Since ffsim.fermion_operator() dispatches purely on the method name, calling it on an operator of this package returns this package’s type rather than ffsim’s; use fermion_operator() when that is what you mean.
>>> 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_
Was this page helpful?
Report a bug, typo, or request content on GitHub.