|View source on GitHub|
Convert a 2-body fermionic operator to InteractionOperator.
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].
||An instance of the InteractionOperator class.|
||Input must be a FermionOperator.|
||FermionOperator does not map to InteractionOperator.|
|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.|