EstimatorBackend#
Module: iqm.qaoa.backends
- class iqm.qaoa.backends.EstimatorBackend[source]#
Bases:
objectThe template class for estimator backends, i.e., those calculating the expected value of the Hamiltonian.
Methods
Estimate the expected value of the Hamiltonian.
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 ofqaoa_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_objectincludes the training parameters (angles), which are typically used in estimation of the energy.
- 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 ofqaoa_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_objectincludes the training parameters (angles), which are used in estimation of the correlations. Some estimators (subclasses ofEstimatorBackend) may only be able to estimate the expectation values of at most quadratic products of Z’s.- Parameters:
qaoa_object (QAOA) – The
QAOAobject 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 settarget_qubitsas a list of sets and get out a list of correlations. This is likely to be more efficient than repeatedly callingestimate_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, iftarget_qubitswas given as a list.- Raises:
TypeError – If no registered implementation exists for the type of
qaoa_object.- Return type:
Inheritance
