openfermion.transforms.reduce_number_of_terms
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\).
Args |
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.
|
Returns |
reduced_operator
|
QubitOperator
Operator with reduced number of
terms.
|
fixed_positions
|
list
(optional) Fixed qubits.
|
Raises |
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.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-04-26 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-04-26 UTC."],[],[]]