EstimatorBackend#

Module: iqm.qaoa.backends

class iqm.qaoa.backends.EstimatorBackend[source]#

Bases: object

The template class for estimator backends, i.e., those calculating the expected value of the Hamiltonian.

Methods

estimate

Estimate the expected value of the Hamiltonian.

estimate_correlations_z

Estimate the expected value of products of Z operators on target_qubits.

estimate(qaoa_object)[source]#
estimate(qaoa_object)
estimate(qaoa_object)

Estimate the expected value of the Hamiltonian.

This method uses singledispatchmethod() to dispatch to a type-specific implementation based on the runtime type of qaoa_object. If no registered implementation matches, it falls back to _estimate_unsupported(). Subclasses should override the type-specific private methods (e.g., _estimate_qubo()) rather than this one.

The input qaoa_object includes the training parameters (angles), which are typically used in estimation of the energy.

Parameters:

qaoa_object (QAOA) – The QAOA object whose energy is to be estimated.

Returns:

The estimated expected value of the Hamiltonian with the quantum state implied by the QAOA object.

Raises:

TypeError – If no registered implementation exists for the type of qaoa_object.

Return type:

float

estimate_correlations_z(qaoa_object, target_qubits)[source]#
estimate_correlations_z(qaoa_object, target_qubits)
estimate_correlations_z(qaoa_object, target_qubits)

Estimate the expected value of products of Z operators on target_qubits.

This method uses singledispatchmethod() to dispatch to a type-specific implementation based on the runtime type of qaoa_object. If no registered implementation matches, it falls back to _estimate_unsupported(). Subclasses should override the type-specific private methods rather than this one.

The input qaoa_object includes the training parameters (angles), which are used in estimation of the correlations. Some estimators (subclasses of EstimatorBackend) may only be able to estimate the expectation values of at most quadratic products of Z’s.

Parameters:
  • qaoa_object (QAOA) – The QAOA object whose correlations are to be estimated.

  • target_qubits (set[LogQubit] | list[set[LogQubit]]) – The set of qubits on which the operators act. For example if one is interested in \(\langle Z_1 Z_4 Z_5 \rangle\), then target_qubits == {1, 4, 5}. If one is interested in multiple different correlations, they may set target_qubits as a list of sets and get out a list of correlations. This is likely to be more efficient than repeatedly calling estimate_correlations_z() with each one set of qubits at a time.

Returns:

The estimated expected value of product of Z operators on given target_qubits. Or a list of those, if target_qubits was given as a list.

Raises:

TypeError – If no registered implementation exists for the type of qaoa_object.

Return type:

float | list[float]

Inheritance

Inheritance diagram of iqm.qaoa.backends.EstimatorBackend