qrunch.quantum.groupers.identity
Module containing the identity grouper.
Classes
Grouper which groups every pauli string into their own group. |
- class IdentityMeasurementGrouper
Bases:
MeasurementGrouperGrouper which groups every pauli string into their own group.
- __init__(shot_distributor: ShotDistributor | None = None) None
Initiate an instance of the IdentityMeasurementGrouper.
- Parameters:
shot_distributor (ShotDistributor | None) – The shot distributor to use for distributing shots among the measurement groups.
- Return type:
None
- change_shot_distributor(shot_distributor: ShotDistributor) MeasurementGrouper | None
Change shot distributor. The identity grouper does not support a shot distributor, so we return None.
- Parameters:
shot_distributor (ShotDistributor)
- Return type:
MeasurementGrouper | None
- group(pauli_sums: Sequence[HermitianPauliSum], shots: int | None, 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.
shots (int | None) – Total number of shots available for measurement.
circuit (Circuit | None) – Circuit for the pauli sums to be measured on. Not used for this grouper.
- Returns:
A list of sampling groups which can be measured simultaneously.
- Return type:
tuple[MeasurementGroup, …]
- validate_shots_type(shots_type: Type[int | ShotsPerGroup | None]) list[str]
Validate that the grouper supports the given shots type. Return a list of error messages if not supported.
- Parameters:
shots_type (Type[int | ShotsPerGroup | None])
- Return type:
list[str]