qrunch.quantum.groupers.qubit_wise
Module containing the qubit wise grouper.
Classes
Grouper for grouping pauli strings though qubit-wise comparison of pauli operators. |
- class QubitWiseGrouper
Bases:
MeasurementGrouperGrouper for grouping pauli strings though qubit-wise comparison of pauli operators.
The pauli strings contained in the observables are grouped by comparing each pauli operator in the string.
\[\{ Z_1, Z_0 Z_1 Z_2, X_0 Y_1, Y_1 X_2\} \rightarrow \{ Z_1, Z_0 Z_1 Z_2 \} \, \text{and} \, \{X_0 Y_1, Y_1 X_2\}\]The grouper prioritizes groups where no additional measurements are needed, e.g., the pauli string \(X_2\) commutes with all pauli strings in the groups \(\{Z_0 Z_1\}\) and \(\{Y_0, X_1 X_2\}\). However, all measurements needed for measuring \(X_2\) are already performed in the second group, so it is preferred.
The basis identifier is a list of strings, where each string is either “I”, “X”, “Y”, or “Z”. “X”, “Y”, and “Z” represent measurements in the X-, Y-, and Z-basis, respectively, for the corresponding qubit. “I” reflects that the basis does not matter and can be picked freely. For “I”, nothing is added to the circuit corresponding to a measurement in the Z-basis.
- __init__(*args, **kwargs)
- group(pauli_sums: Sequence[HermitianPauliSum], circuit: Circuit | None = None) tuple[MeasurementGroup, ...]
Group the terms in the observable into groups of Pauli string of mutually commuting strings.
- Parameters:
pauli_sums (Sequence[HermitianPauliSum]) – Pauli sums to group.
circuit (Circuit | None) – Circuit for the pauli sums to be measured on. Not used for this grouper.
- Return type:
tuple[MeasurementGroup, …]