Qiskit primitives#

class qiskit_aqt_provider.primitives.sampler.AQTSampler[source]#

Bases: BackendSampler

BaseSamplerV1 primitive for AQT backends.

__init__(backend: AQTResource, options: dict[str, Any] | None = None, skip_transpilation: bool = False) None[source]#

Initialize a Sampler primitive using an AQT backend.

Parameters:
  • backend – AQT resource to evaluate circuits on.

  • options – options passed through to the underlying BackendSampler.

  • skip_transpilation – if True, do not transpile circuits before passing them to the execution backend.

Examples

Initialize a Sampler primitive on a AQT offline simulator:

>>> import qiskit
>>> from qiskit_aqt_provider import AQTProvider
>>> from qiskit_aqt_provider.primitives import AQTSampler
>>>
>>> backend = AQTProvider("").get_backend("offline_simulator_no_noise")
>>> sampler = AQTSampler(backend)

Configuring options on the backend will affect all circuit evaluations triggered by the Sampler primitive:

>>> qc = qiskit.QuantumCircuit(2)
>>> _ = qc.cx(0, 1)
>>> _ = qc.measure_all()
>>>
>>> sampler.run(qc).result().metadata[0]["shots"]
100
>>> backend.options.shots = 123
>>> sampler.run(qc).result().metadata[0]["shots"]
123

The same effect is achieved by passing options to the AQTSampler initializer:

>>> sampler = AQTSampler(backend, options={"shots": 120})
>>> sampler.run(qc).result().metadata[0]["shots"]
120

Passing the option in the AQTSampler.run call restricts the effect to a single evaluation:

>>> sampler.run(qc, shots=130).result().metadata[0]["shots"]
130
>>> sampler.run(qc).result().metadata[0]["shots"]
120
class qiskit_aqt_provider.primitives.estimator.AQTEstimator[source]#

Bases: BackendEstimator

BaseEstimatorV1 primitive for AQT backends.

__init__(backend: AQTResource, options: dict[str, Any] | None = None, abelian_grouping: bool = True, skip_transpilation: bool = False) None[source]#

Initialize an Estimator primitive using an AQT backend.

See AQTSampler for examples configuring run options.

Parameters:
  • backend – AQT resource to evaluate circuits on.

  • options – options passed to through to the underlying BackendEstimator.

  • abelian_grouping – whether the observable should be grouped into commuting parts.

  • skip_transpilation – if True, do not transpile circuits before passing them to the execution backend.