Skip to main content
IBM Quantum Platform
Esta página pertence a uma versão antiga do site Qiskit SDK e não existe na versão mais recente. Recomendamos que você migre para a versão mais recente. Consulte as notas sobre a liberação para obter mais informações.

Sampler

class qiskit.primitives.Sampler(*, options=None)

GitHub

Bases: BaseSamplerV1[PrimitiveJob[SamplerResult]]

Sampler class.

Sampler is a reference implementation of BaseSampler.

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.

Parameters

options (dict | None) – Default options.

Raises

QiskitError – if some classical bits are not used for measurements.


Attributes

options

Return options values for the estimator.

Returns

options


Methods

run

run(circuits, parameter_values=None, **run_options)

GitHub

Run the job of the sampling of bitstrings.

Parameters

  • 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.

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.

Return type

T

set_options

set_options(**fields)

GitHub

Set options values for the estimator.

Parameters

**fields – The fields to update the options

Esta página foi útil?
Relate um bug, erro de digitação ou solicite conteúdo no GitHub.