91 lines
2.8 KiB
Plaintext
91 lines
2.8 KiB
Plaintext
---
|
||
title: BaseSampler
|
||
description: API reference for qiskit.primitives.BaseSampler
|
||
in_page_toc_min_heading_level: 1
|
||
python_api_type: class
|
||
python_api_name: qiskit.primitives.BaseSampler
|
||
---
|
||
|
||
# BaseSampler
|
||
|
||
<Class id="qiskit.primitives.BaseSampler" isDedicatedPage={true} github="https://github.com/qiskit/qiskit/tree/stable/0.46/qiskit/primitives/base/base_sampler.py" signature="qiskit.primitives.BaseSampler(*, options=None)" modifiers="class">
|
||
Bases: `BasePrimitive`, [`Generic`](https://docs.python.org/3/library/typing.html#typing.Generic "(in Python v3.12)")\[`T`]
|
||
|
||
Sampler base class
|
||
|
||
Base class of Sampler that calculates quasi-probabilities of bitstrings from quantum circuits.
|
||
|
||
**Parameters**
|
||
|
||
**options** ([*dict*](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.12)") *| None*) – Default options.
|
||
|
||
## Attributes
|
||
|
||
### circuits
|
||
|
||
<Attribute id="qiskit.primitives.BaseSampler.circuits">
|
||
Quantum circuits to be sampled.
|
||
|
||
**Returns**
|
||
|
||
The quantum circuits to be sampled.
|
||
</Attribute>
|
||
|
||
### options
|
||
|
||
<Attribute id="qiskit.primitives.BaseSampler.options">
|
||
Return options values for the estimator.
|
||
|
||
**Returns**
|
||
|
||
options
|
||
</Attribute>
|
||
|
||
### parameters
|
||
|
||
<Attribute id="qiskit.primitives.BaseSampler.parameters">
|
||
Parameters of quantum circuits.
|
||
|
||
**Returns**
|
||
|
||
List of the parameters in each quantum circuit.
|
||
</Attribute>
|
||
|
||
## Methods
|
||
|
||
### run
|
||
|
||
<Function id="qiskit.primitives.BaseSampler.run" signature="run(circuits, parameter_values=None, **run_options)">
|
||
Run the job of the sampling of bitstrings.
|
||
|
||
**Parameters**
|
||
|
||
* **circuits** ([*QuantumCircuit*](qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit") *| Sequence\[*[*QuantumCircuit*](qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit")*]*) – One of more circuit objects.
|
||
* **parameter\_values** (*Sequence\[*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.12)")*] | Sequence\[Sequence\[*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.12)")*]] | 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**](https://docs.python.org/3/library/exceptions.html#ValueError "(in Python v3.12)") – Invalid arguments are given.
|
||
|
||
**Return type**
|
||
|
||
T
|
||
</Function>
|
||
|
||
### set\_options
|
||
|
||
<Function id="qiskit.primitives.BaseSampler.set_options" signature="set_options(**fields)">
|
||
Set options values for the estimator.
|
||
|
||
**Parameters**
|
||
|
||
**\*\*fields** – The fields to update the options
|
||
</Function>
|
||
</Class>
|
||
|