BaseSampler
class BaseSampler(circuits: Iterable[QuantumCircuit] | QuantumCircuit | None = None, parameters: Iterable[Iterable[Parameter]] | None = None, **kwargs)
Bases: qiskit.primitives.base.base_primitive.BasePrimitive
Sampler base class
Base class of Sampler that calculates quasi-probabilities of bitstrings from quantum circuits.
Parameters
- circuits – Quantum circuits to be executed.
- parameters – Parameters of each of the quantum circuits. Defaults to
[circ.parameters for circ in circuits]
. - options – Default options.
Raises
ValueError – For mismatch of circuits and parameters list.
Methods
close
BaseSampler.close()
Close the session and free resources
run
BaseSampler.run(circuits, parameter_values=None, **run_options)
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 as parameter_values[i]
.
Raises
ValueError – Invalid arguments are given.
set_options
BaseSampler.set_options(**fields)
Set options values for the estimator.
Parameters
**fields – The fields to update the options
Attributes
circuits
Quantum circuits to be sampled.
Returns
The quantum circuits to be sampled.
options
parameters
Parameters of quantum circuits.
Returns
List of the parameters in each quantum circuit.