qrunch.quantum.groupers.lowest_degree_first_grouper
Module containing the grouper based on the Lowest Degree First (LDF) clique cover algorithm.
Classes
Grouper using the Lowest Degree First (LDF) greedy coloring algorithm. |
- class LowestDegreeFirstGrouper
Bases:
MeasurementGrouperGrouper using the Lowest Degree First (LDF) greedy coloring algorithm.
This grouper uses a graph coloring approach where Pauli strings are represented as vertices in a graph, and edges connect non-commuting Pauli strings. The LDF algorithm then assigns colors (groups) to vertices by selecting the vertex with the lowest degree (fewest connections) at each step. Pauli strings with the same color form a clique of mutually commuting operators that can be measured together using the same measurement basis.
Each measurement group is associated with a measurement basis, which specifies the measurement operators (X, Y, or Z) for each qubit. Identity operators on specific qubits are represented by measuring in any basis (typically Z by default).
- __init__(*, qubit_wise: bool = True, post_maximalize: bool = True) None
Initiate an instance of the LowestDegreeFirstGrouper.
- Parameters:
qubit_wise (bool) – If True, uses qubit-wise commutation rules for grouping; if False, uses full (global) commutation.
post_maximalize (bool) – If True, applies post-maximalization to improve grouping quality by greedily adding vertices to each clique.
- Return type:
None
- group(pauli_sums: Sequence[HermitianPauliSum], circuit: Circuit | None = None) tuple[MeasurementGroup, ...]
Group Pauli strings into measurement groups using the LDF algorithm.
- 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, …]