|View source on GitHub|
Transforms a Hamiltonian written in fermionic basis into a Hamiltonian
Used in the notebooks
|Used in the tutorials|
written in qubit basis, via a binary code.
The role of the binary code is to relate the occupation vectors (v0 v1 v2 ... vN-1) that span the fermionic basis, to the qubit basis, spanned by binary vectors (w0, w1, w2, ..., wn-1).
The binary code has to provide an analytic relation between the binary vectors (v0, v1, ..., vN-1) and (w0, w1, ..., wn-1), and possibly has the property N>n, when the Fermion basis is smaller than the fermionic Fock space. The binary_code_transform function can transform Fermion operators to qubit operators for custom- and qubit-saving mappings.
|Logic multi-qubit operators are decomposed into Pauli-strings (e.g. CPhase(1,2) = 0.5 * (1 + Z1 + Z2 - Z1 Z2 ) ), which might increase the number of Hamiltonian terms drastically.|
|hamiltonian (FermionOperator): the fermionic Hamiltonian code (BinaryCode): the binary code to transform the Hamiltonian|
Returns (QubitOperator): the transformed Hamiltonian
||if the hamiltonian is not a FermionOperator or code is not a BinaryCode|