PauliBasisChange¶

class
PauliBasisChange
(destination_basis=None, traverse=True, replacement_fn=None)[source]¶ Bases :
qiskit.aqua.operators.converters.converter_base.ConverterBase
Converter for changing Paulis into other bases. By default, the diagonal basis composed only of Pauli {Z, I}^n is used as the destination basis to which to convert. Meaning, if a Pauli containing X or Y terms is passed in, which cannot be sampled or evolved natively on some Quantum hardware, the Pauli can be replaced by a composition of a change of basis circuit and a Pauli composed of only Z and I terms (diagonal), which can be evolved or sampled natively on the Quantum hardware.
The replacement function determines how the
PauliOps
should be replaced by their computed changeofbasisCircuitOps
and destinationPauliOps
. Several convenient outofthebox replacement functions have been added as static methods, such asmeasurement_replacement_fn
.This class uses the typical basis change method found in most Quantum Computing textbooks (such as on page 210 of Nielsen and Chuang’s, « Quantum Computation and Quantum Information », ISBN: 9781107002173), which involves diagonalizing the singlequbit Paulis with H and S† gates, mapping the eigenvectors of the diagonalized origin Pauli to the diagonalized destination Pauli using CNOTS, and then dediagonalizing any single qubit Paulis to their nondiagonal destination values. Many other methods are possible, as well as variations on this method, such as the placement of the CNOT chains.
 Paramètres
destination_basis (
Union
[Pauli
,PauliOp
,None
]) – The Pauli into the basis of which the operators will be converted. If None is specified, the destination basis will be the diagonal ({I, Z}^n) basis requiring only single qubit rotations.traverse (
bool
) – If true and the operator passed into convert contains subOperators, such as ListOp, traverse the Operator and apply the conversion to every applicable suboperator within it.replacement_fn (
Optional
[Callable
]) –A function specifying what to do with the basischange
CircuitOp
and destinationPauliOp
when converting an Operator and replacing converted values. By default, this will beFor StateFns (or Measurements): replacing the StateFn with ComposedOp(StateFn(d), c) where c is the conversion circuit and d is the destination Pauli, so the overall beginning and ending operators are equivalent.
For nonStateFn Operators: replacing the origin p with c·d·c†, where c is the conversion circuit and d is the destination, so the overall beginning and ending operators are equivalent.
Methods
Construct a
CircuitOp
(orPauliOp
if equal to the identity) which takes the eigenvectors ofdiag_pauli_op1
to the eigenvectors ofdiag_pauli_op2
, assuming both are diagonal (or performing this operation on their diagonalized Paulis implicitly if not).Given a
PauliOp
, or an Operator containingPauliOps
if_traverse
is True, converts each Pauli into the basis specified by self._destination and a basischangecircuit, callsreplacement_fn
with these two Operators, and replaces thePauliOps
with the output ofreplacement_fn
.Construct an Operator which maps the +1 and 1 eigenvectors of the origin Pauli to the +1 and 1 eigenvectors of the destination Pauli.
Get the diagonal
PualiOp
to whichpauli_op
could be rotated with only singlequbit operations.Construct a
CircuitOp
with only singlequbit gates which takes the eigenvectors ofpauli
to eigenvectors composed only of 0⟩ and 1⟩ tensor products.Gets the Pauli (not
PauliOp
!) whose diagonalizing singlequbit rotations is a superset of the diagonalizing singlequbit rotations for each of the Paulis inlist_op
.A builtin convenience replacement function which produces measurements isomorphic to an
OperatorStateFn
measurement holding the originPauliOp
.A builtin convenience replacement function which produces Operators isomorphic to the origin
PauliOp
.If
pauli_op1
andpauli_op2
do not act over the same number of qubits, pad identities to the end of the shorter of the two so they are of equal length.A builtin convenience replacement function which produces state functions isomorphic to an
OperatorStateFn
state function holding the originPauliOp
.Attributes

destination
¶ The destination
PauliOp
, orNone
if using the default destination, the diagonal basis. Type renvoyé
Optional
[PauliOp
]