fermion_operator
fermion_operator(operator)
Converts an operator into a FermionOperator.
This is a thin, type-agnostic wrapper around the SupportsFermionOperator protocol method, mirroring the free-function style of ffsim.fermion_operator().
Parameters
operator (SupportsFermionOperator) – the operator to convert, implementing SupportsFermionOperator.
Returns
The operator converted into a FermionOperator.
Return type
>>> from qiskit_fermions.mappers.library import fermion_operator
>>> from qiskit_fermions.operators import MajoranaOperator
>>> maj_op = MajoranaOperator.from_dict({(0, 1): 1})
>>> fer_op = fermion_operator(maj_op)
>>> print(format(fer_op.normal_ordered().simplify()))
0.000000e0 +1.000000e0j * ()
0.000000e0 -2.000000e0j * (+0 -0)