openfermion.transforms.reduce_number_of_terms

Reduce the number of Pauli strings of operator using stabilizers.

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 QubitOperator

Operator of which the number of terms will be reduced.

stabilizers QubitOperator

Stabilizer generators used for the reduction. Can also be passed as a list of QubitOperator.

maintain_length Boolean

Option deciding whether the fixed Pauli strings are re-expressed in their original form. Set to False by default.

output_fixed_positions Boolean

Option deciding whether to return the list of fixed qubit positions. Set to False by default.

manual_input Boolean

Option to pass the list of fixed qubits positions manually. Set to False by default.

fixed_positions list

(optional) List of fixed qubit positions. Passing a list is only effective if manual_input is True.

reduced_operator QubitOperator

Operator with reduced number of terms.

fixed_positions list

(optional) Fixed qubits.

TypeError Input terms must be QubitOperator.
TypeError Input stabilizers must be QubitOperator or list.
StabilizerError Trivial stabilizer (identity).
StabilizerError Stabilizer with complex coefficient.
TypeError List of fixed qubits required if manual input True.
StabilizerError The number of stabilizers must be equal to the number of qubits manually fixed.
StabilizerError All qubit positions must be different.