Sampler#
- class Sampler(*, backend_options: dict | None = None, transpile_options: dict | None = None, run_options: dict | None = None, skip_transpilation: bool = False)[source]#
Bases:
BaseSamplerV1
Aer implementation of Sampler class.
- Run Options:
shots (None or int) – The number of shots. If None, it calculates the probabilities exactly. Otherwise, it samples from multinomial distributions.
seed (int) – Set a fixed seed for
seed_simulator
. If shots is None, this option is ignored.
Note
Precedence of seeding is as follows:
seed_simulator
in runtime (i.e. in__call__()
)seed
in runtime (i.e. in__call__()
)seed_simulator
ofbackend_options
.default.
- Parameters:
backend_options – Options passed to AerSimulator.
transpile_options – Options passed to transpile.
run_options – Options passed to run.
skip_transpilation – if True, transpilation is skipped.
Attributes
- options#
Return options values for the estimator.
- Returns:
options
Methods
- run(circuits: QuantumCircuit | Sequence[QuantumCircuit], parameter_values: Sequence[float] | Sequence[Sequence[float]] | None = None, **run_options) T [source]#
Run the job of the sampling of bitstrings.
- Parameters:
circuits – One of more circuit objects.
parameter_values – Parameters to be bound to the circuit.
run_options – Backend runtime options used for circuit execution.
- Returns:
The job object of the result of the sampler. The i-th result corresponds to
circuits[i]
evaluated with parameters bound asparameter_values[i]
.- Raises:
ValueError – Invalid arguments are given.