qiskit-documentation/docs/api/qiskit/dev/qiskit.primitives.BaseEstim...

61 lines
3.6 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: BaseEstimatorV2 (dev version)
description: API reference for qiskit.primitives.BaseEstimatorV2 in the dev version of qiskit
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.primitives.BaseEstimatorV2
---
# BaseEstimatorV2
<Class id="qiskit.primitives.BaseEstimatorV2" isDedicatedPage={true} github="https://github.com/Qiskit/qiskit/tree/main/qiskit/primitives/base/base_estimator.py#L41-L93" signature="qiskit.primitives.BaseEstimatorV2" modifiers="class">
Bases: [`ABC`](https://docs.python.org/3/library/abc.html#abc.ABC "(in Python v3.13)")
Base class for `EstimatorV2` implementations.
An estimator calculates expectation values for provided quantum circuit and observable combinations. Implementations of this [`BaseEstimatorV2`](#qiskit.primitives.BaseEstimatorV2 "qiskit.primitives.BaseEstimatorV2") interface must define their own [`run()`](#qiskit.primitives.BaseEstimatorV2.run "qiskit.primitives.BaseEstimatorV2.run") method, which is designed to take the following inputs:
> * **pubs: list of pubs (Primitive Unified Blocs). An estimator pub is a list**
>
> or tuple of two to four elements that define the unit of work for the estimator. These are:
>
> * **A single [`QuantumCircuit`](qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit"), possibly parametrized,**
>
> whose final state we define as $\psi(\theta)$.
>
> * **One or more observables (specified as any `ObservablesArrayLike`, including**
>
> [`Pauli`](qiskit.quantum_info.Pauli "qiskit.quantum_info.Pauli"), [`SparsePauliOp`](qiskit.quantum_info.SparsePauliOp "qiskit.quantum_info.SparsePauliOp"), `str`) that specify which expectation values to estimate, denoted $H_j$.
>
> * A collection parameter value sets to bind the circuit against, $\theta_k$
>
> * Optionally, the estimation precision.
> * **precision: the estimation precision. This specification is optional and will be overriden by**
>
> the pub-wise shots if provided.
All estimator implementations must implement default value for the `precision` in the [`run()`](#qiskit.primitives.BaseEstimatorV2.run "qiskit.primitives.BaseEstimatorV2.run") method. This default value will be used any time `precision=None` is specified, which can take place in the [`run()`](#qiskit.primitives.BaseEstimatorV2.run "qiskit.primitives.BaseEstimatorV2.run") kwargs or at the pub level.
## Methods
### run
<Function id="qiskit.primitives.BaseEstimatorV2.run" github="https://github.com/Qiskit/qiskit/tree/main/qiskit/primitives/base/base_estimator.py#L78-L93" signature="run(pubs, *, precision=None)" modifiers="abstract">
Estimate expectation values for each provided pub (Primitive Unified Bloc).
**Parameters**
* **pubs** (*Iterable\[EstimatorPubLike]*) An iterable of pub-like objects, such as tuples `(circuit, observables)` or `(circuit, observables, parameter_values)`.
* **precision** ([*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)") *| None*) The target precision for expectation value estimates of each run Estimator Pub that does not specify its own precision. If None the estimators default precision value will be used.
**Returns**
A job object that contains results.
**Return type**
[BasePrimitiveJob](qiskit.primitives.BasePrimitiveJob "qiskit.primitives.BasePrimitiveJob")\[[PrimitiveResult](qiskit.primitives.PrimitiveResult "qiskit.primitives.PrimitiveResult")\[[PubResult](qiskit.primitives.PubResult "qiskit.primitives.PubResult")]]
</Function>
</Class>