qrunch.quantum.groupers.shot_distributors.minimal_posterior_variance_shot_distributor
Module containing the MinimalPosteriorVarianceShotDistributor.
The MinimalPosteriorVarianceShotDistributor distributes shots based on minimizing the posterior variance.
Classes
Represent a distribution that minimizes the posterior variance. |
|
Options for the MinimalPosteriorVarianceShotDistributor. |
- class MinimalPosteriorVarianceShotDistributor
Bases:
ShotDistributorRepresent a distribution that minimizes the posterior variance.
Here, the prior assumption is that there is no covariance between different Pauli strings, and the variance of each Pauli string is proportional to the square of its coefficient in the observable. The distribution is found by solving a constrained optimization problem using sequential least squares programming.
- __init__(options: MinimalPosteriorVarianceShotDistributorOptions | None = None) None
Initialize the minimal posterior variance measurement distributor.
- Parameters:
options (MinimalPosteriorVarianceShotDistributorOptions | None) – Options for the MinimalPosteriorVarianceShotDistributor.
- Return type:
None
- distribute_shots(groups: Sequence[PartialMeasurementGroup], total_shots: int | None) tuple[MeasurementGroup, ...]
Build a probability distribution over the given groups.
The weights are those that minimize the posterior variance.
- Parameters:
groups (Sequence[PartialMeasurementGroup]) – A list of Pauli string groups.
total_shots (int | None) – The total number of shots available for measurement.
- Return type:
tuple[MeasurementGroup, …]
- class MinimalPosteriorVarianceShotDistributorOptions
Bases:
DataclassPublicAPIOptions for the MinimalPosteriorVarianceShotDistributor.
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)
max_iterations – Maximum number of iterations for the shot distribution optimization. (default=1000)
- __init__(*, shots_batch_size: int = 1000, max_iterations: int = 1000) None
- Parameters:
shots_batch_size (int)
max_iterations (int)
- Return type:
None
- max_iterations: int = 1000
- shots_batch_size: int = 1000