qrunch.quantum.samplers.sampler_shot_counter
Module for implementing Sampler for counting shots of running on quantum hardware.
Classes
Sampler class for counting number of shots that would have been made through calls to a backend sampler. |
- class SamplerShotCounter
Bases:
SamplerSampler class for counting number of shots that would have been made through calls to a backend sampler.
- __init__(sampler: Sampler, error_mitigator: SamplerErrorMitigator | None = None, measurement_cache: MeasurementCache | None = None) None
Initialize the sampler shot counter.
Note: The cache if supplied is modified in place with dummy values when running the sampler shot counter.
- Parameters:
sampler (Sampler) – Underlying sampler to use for sampling.
error_mitigator (SamplerErrorMitigator | None) – Error mitigator to be used for encoding the measurement more error resistantly.
measurement_cache (MeasurementCache | None) – Measurement cache for used for counting the number of shots.
- Return type:
None
- run(circuits: MeasurementCircuit, shots: int | None) QuantumMeasurement
- run(circuits: Sequence[MeasurementCircuit], shots: int | None) list[QuantumMeasurement]
Start job for sampling on the given circuits a given number of times.
- Parameters:
circuits – Measurement circuit or sequence of circuits to be sampled.
shots – Number of shots. Must be a positive integer to counts number of shots.
- property sampler_shots: list[int]
Get the list of shots to the sampler for every evaluated circuit.
- supports_shots_equals_none() bool
Return whether the sampler supports shots = None.
The SamplerShotCounter supports shots = None if the underlying sampler does.
- Return type:
bool
- total_braket_price(device: _IQM | _IonQ | _Rigetti | _Amazon) float
Return the total price of the calculation, if it had been run on the specified device.
- Parameters:
device (_IQM | _IonQ | _Rigetti | _Amazon)
- Return type:
float
- property total_shots: int
Return the total number of shots, if it had been run on the specified device.