majorana_operator¶
- majorana_operator(operator)¶
Converts an operator into a
MajoranaOperator.This is a thin, type-agnostic wrapper around the
SupportsMajoranaOperatorprotocol method, mirroring the free-function style offermion_operator().- Parameters:
operator (SupportsMajoranaOperator) – the operator to convert, implementing
SupportsMajoranaOperator.- Returns:
The operator converted into a
MajoranaOperator.- Return type:
>>> from qiskit_fermions.mappers.library import majorana_operator >>> from qiskit_fermions.operators import FermionOperator >>> fer_op = FermionOperator.from_dict({((True, 0), (False, 0)): 1}) >>> maj_op = majorana_operator(fer_op) >>> print(format(maj_op.normal_ordered().simplify())) 5.000000e-1 +0.000000e0j * () 0.000000e0-5.000000e-1j * (γ'0 γ0)