qrunch.quantum.groupers.shot_distributors.creators

Module containing shot distributors, which distribute shots among measurement groups.

Classes

ShotDistributorSubCreator

Creator for shot distributors.

class ShotDistributorSubCreator

Bases: Generic[T]

Creator for shot distributors.

__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

group_size(options: GroupSizeShotDistributorOptions | None = None) T

Set the shot distributor to the group size shot distributor.

The group size shot distributor distributes shots based on the size of the measurement groups. The weight of each group is proportional to its size (number of Pauli strings).

Parameters:

options (GroupSizeShotDistributorOptions | None)

Return type:

T

homogeneous() T

Set the shot distributor to the homogeneous shot distributor.

The homogeneous shot distributor distributes shots evenly among all measurement groups.

Return type:

T

l2_norm(options: L2NormShotDistributorOptions | None = None) T

Set the shot distributor to the ℓ² norm shot distributor.

The ℓ² norm shot distributor distributes shots based on the ℓ² norm of the coefficients of the Pauli strings in the groups. The weight of each group is proportional to the sum of the ℓ² norms of the Pauli strings in the group.

Parameters:

options (L2NormShotDistributorOptions | None)

Return type:

T

minimal_posterior_variance(options: MinimalPosteriorVarianceShotDistributorOptions | None = None) T

Set the shot distributor to the minimal posterior variance shot distributor.

The minimal posterior variance shot distributor distributes shots based on the solution of a constrained optimization problem that minimizes the posterior variance of the observable. The weights are found using sequential least squares programming, with the prior assumption that there is no covariance between different Pauli strings and that the variance of each Pauli string is proportional to the square of its coefficient in the observable.

Parameters:

options (MinimalPosteriorVarianceShotDistributorOptions | None)

Return type:

T