BackendSampler#
- class qiskit.primitives.BackendSampler(backend, options=None, bound_pass_manager=None, skip_transpilation=False)[código fonte]#
Bases:
BaseSampler
[PrimitiveJob
[SamplerResult
]]A
BaseSampler
implementation that provides an interface for leveraging the sampler interface from any backend.This class provides a sampler interface from any backend and doesn’t do any measurement mitigation, it just computes the probability distribution from the counts. It facilitates using backends that do not provide a native
BaseSampler
implementation in places that work withBaseSampler
, such as algorithms inqiskit.algorithms
includingSamplingVQE
. However, if you’re using a provider that has a native implementation ofBaseSampler
, it is a better choice to leverage that native implementation as it will likely include additional optimizations and be a more efficient implementation. The generic nature of this class precludes doing any provider- or backend-specific optimizations.Initialize a new BackendSampler
- Parâmetros:
backend – Required: the backend to run the sampler primitive on
options – Default options.
bound_pass_manager – An optional pass manager to run after parameter binding.
skip_transpilation – If this is set to True the internal compilation of the input circuits is skipped and the circuit objects will be directly executed when this objected is called.
- Levanta:
ValueError – If backend is not provided
Attributes
- backend#
Returns: The backend which this sampler object based on
- circuits#
Quantum circuits to be sampled.
- Retorno:
The quantum circuits to be sampled.
- options#
Return options values for the estimator.
- Retorno:
options
- parameters#
Parameters of quantum circuits.
- Retorno:
List of the parameters in each quantum circuit.
- preprocessed_circuits#
Preprocessed quantum circuits produced by preprocessing :returns: List of the transpiled quantum circuit
- Levanta:
QiskitError – if the instance has been closed.
- transpile_options#
Return the transpiler options for transpiling the circuits.
- transpiled_circuits#
Transpiled quantum circuits. :returns: List of the transpiled quantum circuit
- Levanta:
QiskitError – if the instance has been closed.
Methods
- run(circuits, parameter_values=None, **run_options)#
Run the job of the sampling of bitstrings.
- Parâmetros:
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.
- Retorno:
The job object of the result of the sampler. The i-th result corresponds to
circuits[i]
evaluated with parameters bound asparameter_values[i]
.- Levanta:
ValueError – Invalid arguments are given.
- Tipo de retorno:
T
- set_options(**fields)#
Set options values for the estimator.
- Parâmetros:
**fields – The fields to update the options
- set_transpile_options(**fields)[código fonte]#
Set the transpiler options for transpiler. :param **fields: The fields to update the options.
- Retorno:
self.
- Levanta:
QiskitError – if the instance has been closed.