|View source on GitHub|
Reduce the number of Pauli strings of operator using stabilizers.
openfermion.transforms.reduce_number_of_terms( operator, stabilizers, maintain_length=False, output_fixed_positions=False, manual_input=False, fixed_positions=None )
This function reduces the number of terms in a string by merging terms that are identical by the multiplication of stabilizers. The resulting Pauli strings maintain their length, unless specified otherwise. In the latter case, a list of indices can be passed to manually indicate the qubits to be fixed.
It is possible to reduce the number of terms in a Hamiltonian by merging Pauli strings \(H_1, \, H_2\) that are related by a stabilizer \(S\) such that \(H_1 = H_2 \cdot S\). Given a stabilizer generator \(\pm X \otimes p\) this algorithm fixes the first qubit, such that every Pauli string in the Hamiltonian acts with either \(Z\) or the identity on it. Where necessary, this is achieved by multiplications with \(\pm X \otimes p\): a string \(Y \otimes h\), for instance, is turned into \(Z \otimes (\mp ih\cdot p)\). Qubits on which a generator acts as \(Y\) (\(Z\)) are constrained to be acted on by the Hamiltonian as \(Z\) (\(X\)) or the identity. Fixing a different qubit for every stabilizer generator eliminates all redundant strings. The fixed representations are in the end re-expressed as the shortest of the original strings, \(H_1\) or \(H_2\).
Operator with reduced number of terms.
(optional) Fixed qubits.