Skip to main content
IBM Quantum Platform
This page is from a dev version of Qiskit SDK. This is a new interface that does not exist in the stable version.

SamplerPub

class qiskit.primitives.SamplerPub(circuit, parameter_values=None, shots=None, validate=True)

GitHub

Bases: ShapedMixin

Pub (Primitive Unified Bloc) for a Sampler.

Pub is composed of tuple (circuit, parameter_values, shots).

If shots are provided this number of shots will be run with the sampler, if shots=None the number of run shots is determined by the sampler.

Initialize a sampler pub.

Parameters

  • circuit (QuantumCircuit) – A quantum circuit.
  • parameter_values (BindingsArray | None) – A bindings array.
  • shots (int | None) – A specific number of shots to run with. This value takes precedence over any value owed by or supplied to a sampler.
  • validate (bool) – If True, the input data is validated during initialization.

Attributes

circuit

A quantum circuit.

ndim

parameter_values

A bindings array.

shape

shots

An specific number of shots to run with (optional).

This value takes precedence over any value owed by or supplied to a sampler.

size


Methods

coerce

classmethod coerce(pub, shots=None)

GitHub

Coerce a SamplerPubLike object into a SamplerPub instance.

Parameters

  • pub (SamplerPubLike) – An object to coerce.
  • shots (int | None) – An optional default number of shots to use if not already specified by the pub-like object.

Returns

A coerced sampler pub.

Return type

SamplerPub

validate

validate()

GitHub

Validate the pub.

Was this page helpful?
Report a bug, typo, or request content on GitHub.