qrunch.quantum.groupers.beast_grouper
Module containing the BEAST measurement grouper which groups to optimize the amount of measurements.
Classes
Grouper designed specifically for the BEAST-VQE chemistry algorithm. |
- class BeastGrouper
Bases:
MeasurementGrouperGrouper designed specifically for the BEAST-VQE chemistry algorithm.
- __init__(*args, **kwargs)
- 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 = 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.
circuit (Circuit | None) – Circuit for the pauli sums to be measured on.
shots (int | None) – Total number of shots to be used for the measurements.
- Raises:
ValueError – If an invalid pauli string is given.
- 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]