qiskit-documentation/docs/api/qiskit/0.38/qiskit_aer.primitives.Sampl...

69 lines
2.2 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: Sampler
description: API reference for qiskit_aer.primitives.Sampler
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit_aer.primitives.Sampler
---
# Sampler
<Class id="qiskit_aer.primitives.Sampler" isDedicatedPage={true} github="https://github.com/qiskit/qiskit-aer/tree/stable/0.11/qiskit_aer/primitives/sampler.py" signature="Sampler(circuits: Iterable[QuantumCircuit] | QuantumCircuit, *args, parameters: Iterable[Iterable[Parameter]] | None = None, **kwargs)" modifiers="class">
Bases: [`qiskit.primitives.base_sampler.BaseSampler`](qiskit.primitives.BaseSampler "qiskit.primitives.base_sampler.BaseSampler")
Aer implementation of Sampler class.
**Run Options**
* **shots** (None or int) The number of shots. If None, it calculates the probabilities exactly. Otherwise, it samples from multinomial distributions.
* **seed** (int) Set a fixed seed for `seed_simulator`. If shots is None, this option is ignored.
<Admonition title="Note" type="note">
Precedence of seeding is as follows:
1. `seed_simulator` in runtime (i.e. in `__call__()`)
2. `seed` in runtime (i.e. in `__call__()`)
3. `seed_simulator` of `backend_options`.
4. default.
</Admonition>
**Parameters**
* **circuits** Circuits to be executed.
* **parameters** Parameters of each of the quantum circuits. Defaults to `[circ.parameters for circ in circuits]`.
* **backend\_options** Options passed to AerSimulator.
* **transpile\_options** Options passed to transpile.
* **skip\_transpilation** if True, transpilation is skipped.
## Methods
### close
<Function id="qiskit_aer.primitives.Sampler.close" signature="Sampler.close()">
Close the session and free resources
</Function>
## Attributes
### circuits
<Attribute id="qiskit_aer.primitives.Sampler.circuits">
Quantum circuits to be sampled.
**Returns**
The quantum circuits to be sampled.
</Attribute>
### parameters
<Attribute id="qiskit_aer.primitives.Sampler.parameters">
Parameters of quantum circuits.
**Returns**
List of the parameters in each quantum circuit.
</Attribute>
</Class>