qrunch.quantum.groupers.shot_distributors.group_size_shot_distributor

Module containing the GroupSizeShotDistributor, which distributes shots based on group size.

Classes

GroupSizeShotDistributor

Represent a distribution strategy where groups are weighted by their size.

GroupSizeShotDistributorOptions

Options for the GroupSizeShotDistributor.

class GroupSizeShotDistributor

Bases: ShotDistributor

Represent a distribution strategy where groups are weighted by their size.

__init__(options: GroupSizeShotDistributorOptions | None = None) None

Initialize the GroupSizeShotDistributor with the given options.

Parameters:

options (GroupSizeShotDistributorOptions | None) – Options for the GroupSizeShotDistributor.

Return type:

None

distribute_shots(groups: Sequence[PartialMeasurementGroup], total_shots: int | None) tuple[MeasurementGroup, ...]

Build a probability distribution over the given groups.

The weight of each group is proportional to its size (number of Pauli strings).

Parameters:
  • groups (Sequence[PartialMeasurementGroup]) – A list of Hermitian Pauli sum groups.

  • total_shots (int | None) – The total number of measurement shots to allocate.

Return type:

tuple[MeasurementGroup, …]

class GroupSizeShotDistributorOptions

Bases: DataclassPublicAPI

Options for the GroupSizeShotDistributor.

All fields are immutable (frozen=True) so an instance can be safely reused.

Parameters:

shots_batch_size – Number of shots per batch used when distributing shots among groups. (default=1000)

__init__(*, shots_batch_size: int = 1000) None
Parameters:

shots_batch_size (int)

Return type:

None

shots_batch_size: int = 1000