Convert a 2-body fermionic operator to InteractionOperator.
View aliases
Main aliases
openfermion.get_interaction_operator
, openfermion.transforms.repconversions.conversions.get_interaction_operator
, openfermion.transforms.repconversions.get_interaction_operator
openfermion.transforms.get_interaction_operator(
fermion_operator, n_qubits=None
)
This function should only be called on fermionic operators which consist of only a_p^\dagger a_q and a_p^\dagger a_q^\dagger a_r a_s terms. The one-body terms are stored in a matrix, one_body[p, q], and the two-body terms are stored in a tensor, two_body[p, q, r, s].
Raises | |
---|---|
TypeError
|
Input must be a FermionOperator. |
TypeError
|
FermionOperator does not map to InteractionOperator. |
Warning | |
---|---|
Even assuming that each creation or annihilation operator appears at most a constant number of times in the original operator, the runtime of this method is exponential in the number of qubits. |