SamplerV2#
- class SamplerV2(*, default_shots: int = 1024, seed: int | None = None, options: dict | None = None)[source]#
Bases:
BaseSamplerV2Aer implementation of SamplerV2 class.
Each tuple of
(circuit, <optional> parameter values, <optional> shots), called a sampler primitive unified bloc (PUB), produces its own array-valued result. Therun()method can be given many pubs at once.backend_options: Options passed to AerSimulator. Default: {}.run_options: Options passed toAerSimulator.run(). Default: {}.
- Parameters:
default_shots – The default shots for the sampler if not specified during run.
seed – The seed for random number generation. If None, a random seeded default RNG will be used.
options – the backend options (
backend_options), and the runtime options (run_options).
Attributes
- default_shots#
Return the default shots
- options#
Return the options
- seed#
Return the seed for random number generation.
Methods
- run(pubs: Iterable[SamplerPubLike], *, shots: int | None = None) PrimitiveJob[PrimitiveResult[SamplerPubResult]][source]#
Run and collect samples from each pub.
- Parameters:
pubs – An iterable of pub-like objects. For example, a list of circuits or tuples
(circuit, parameter_values).shots – The total number of shots to sample for each sampler pub that does not specify its own shots. If
None, the primitive’s default shots value will be used, which can vary by implementation.
- Returns:
The job object of Sampler’s result.