Sampler#
- class qiskit.primitives.Sampler(*, options=None)[Quellcode]#
Bases:
BaseSampler
[PrimitiveJob
[SamplerResult
]]Sampler class.
Sampler
is a reference implementation ofBaseSampler
.- Run Options:
shots (None or int) – The number of shots. If None, it calculates the probabilities. Otherwise, it samples from multinomial distributions.
seed (np.random.Generator or int) – Set a fixed seed or generator for the multinomial distribution. If shots is None, this option is ignored.
- Parameter:
options – Default options.
- Verursacht:
QiskitError – if some classical bits are not used for measurements.
Attributes
- circuits#
Quantum circuits to be sampled.
- Rückgabe:
The quantum circuits to be sampled.
- options#
Return options values for the estimator.
- Rückgabe:
options
- parameters#
Parameters of quantum circuits.
- Rückgabe:
List of the parameters in each quantum circuit.
Methods
- run(circuits, parameter_values=None, **run_options)#
Run the job of the sampling of bitstrings.
- Parameter:
circuits (QuantumCircuit | Sequence[QuantumCircuit]) – One of more circuit objects.
parameter_values (Sequence[float] | Sequence[Sequence[float]] | None) – Parameters to be bound to the circuit.
run_options – Backend runtime options used for circuit execution.
- Rückgabe:
The job object of the result of the sampler. The i-th result corresponds to
circuits[i]
evaluated with parameters bound asparameter_values[i]
.- Verursacht:
ValueError – Invalid arguments are given.
- Rückgabetyp:
T
- set_options(**fields)#
Set options values for the estimator.
- Parameter:
**fields – The fields to update the options