Estimator#

class Estimator(*, backend_options: dict | None = None, transpile_options: dict | None = None, run_options: dict | None = None, approximation: bool = False, skip_transpilation: bool = False, abelian_grouping: bool = True)[source]#

Bases: BaseEstimatorV1

Aer implmentation of Estimator.

Run Options:
  • shots (None or int) – The number of shots. If None and approximation is True, it calculates the exact expectation values. Otherwise, it calculates expectation values with sampling.

  • seed (int) – Set a fixed seed for the sampling.

Note

Precedence of seeding for seed_simulator is as follows:

  1. seed_simulator in runtime (i.e. in run())

  2. seed in runtime (i.e. in run())

  3. seed_simulator of backend_options.

  4. default.

seed is also used for sampling from a normal distribution when approximation is True.

When combined with the approximation option, we get the expectation values as follows:

  • shots is None and approximation=False: Return an expectation value with sampling-noise w/ warning.

  • shots is int and approximation=False: Return an expectation value with sampling-noise.

  • shots is None and approximation=True: Return an exact expectation value.

  • shots is int and approximation=True: Return expectation value with sampling-noise using a normal distribution approximation.

Parameters:
  • backend_options – Options passed to AerSimulator.

  • transpile_options – Options passed to transpile.

  • run_options – Options passed to run.

  • approximation – If True, it calculates expectation values with normal distribution approximation. Note that this appproximation ignores readout errors.

  • skip_transpilation – If True, transpilation is skipped.

  • abelian_grouping – Whether the observable should be grouped into commuting. If approximation is True, this parameter is ignored and assumed to be False.

Attributes

approximation#

The approximation property

Deprecated since version 0.13: The property qiskit_aer.primitives.estimator.Estimator.approximation is deprecated as of qiskit-aer 0.13. It will be removed no earlier than 3 months after the release date.

options#

Return options values for the estimator.

Returns:

options

Methods

run(circuits: Sequence[QuantumCircuit] | QuantumCircuit, observables: Sequence[BaseOperator | str] | BaseOperator | str, parameter_values: Sequence[Sequence[float]] | Sequence[float] | float | None = None, **run_options) T#

Run the job of the estimation of expectation value(s).

circuits, observables, and parameter_values should have the same length. The i-th element of the result is the expectation of observable

obs = observables[i]

for the state prepared by

circ = circuits[i]

with bound parameters

values = parameter_values[i].
Parameters:
  • circuits – one or more circuit objects.

  • observables – one or more observable objects. Several formats are allowed; importantly, str should follow the string representation format for Pauli objects.

  • parameter_values – concrete parameters to be bound.

  • run_options – runtime options used for circuit execution.

Returns:

The job object of EstimatorResult.

Raises:
  • TypeError – Invalid argument type given.

  • ValueError – Invalid argument values given.

set_options(**fields)#

Set options values for the estimator.

Parameters:

**fields – The fields to update the options