qrunch.quantum.groupers

Module containing groupers for grouping operators into groups of commuting operators.

Classes

MeasurementGrouperSubCreator

Creator for measurement groupers.

class MeasurementGrouperSubCreator

Bases: Generic[T]

Creator for measurement groupers.

__init__(parent: T, field_name: str) None

Initialize the sub-creator.

Parameters:
  • parent (T) – The parent object to which the grouper will be added.

  • field_name (str) – The name of the field in the parent object to which the grouper will be added.

Return type:

None

beast() T

Set the measurement grouper to the BEAST measurement grouper.

This grouper is designed specifically for the BEAST-VQE chemistry algorithm.

Return type:

T

identity() T

Set the measurement grouper to the identity measurement grouper.

The simple grouper groups every pauli string into their own group.

Return type:

T

qubit_wise() T

Set the measurement grouper to the qubit-wise measurement grouper.

In this gouper, 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.

Return type:

T

Modules

beast_grouper

Module containing the BEAST measurement grouper which groups to optimize the amount of measurements.

groupers_protocols

Module containing groupers for grouping operators into groups of commuting operators.

identity

Module containing the identity grouper.

qubit_wise

Module containing the qubit wise grouper.