qrunch.quantum.measurement.expectation_value

Module containing expectation value class and function to evaluate expectation values.

Classes

ExpectationValue

Dataclass for holding expectation values with an estimated standard deviation.

ListOfExpectationValues

Store a list of expectation values.

class ExpectationValue

Bases: object

Dataclass for holding expectation values with an estimated standard deviation.

The class has implimented basic math operations of addition and subtraction with real numbers and Expectation values as well as multiplication with real numbers. The resulting error is estimated using the law of error propagation:

\[\sigma_f = \sqrt{c_1^2 \sigma_1^2 + c_2^2 \sigma_2^2}\]

where \(\sigma_{1(2)}\) are the initial errors, \(c_{1(2)}\) are real numbers, and \(\sigma_f\) is the propagated error. For this to be valid, the initial errors must be uncorrelated. As a consequence, adding or subtracting ExpectationValues obtained from the same measurement will result in, possibly, an under- or overestimated error. ExpectationValues returned by VQE’s have accounted for correlation.

All fields are immutable (frozen=True) so an instance can be safely reused.

Parameters:
  • value – The expectation value.

  • error – The estimated standard deviation of the expectation value.

__init__(value: float, error: float) None
Parameters:
  • value (float)

  • error (float)

Return type:

None

error: float
value: float
class ListOfExpectationValues

Bases: object

Store a list of expectation values.

All fields are immutable (frozen=True) so an instance can be safely reused.

Parameters:

expectation_values – The list of expectation values along the reaction path.

__init__(expectation_values: list[ExpectationValue]) None
Parameters:

expectation_values (list[ExpectationValue])

Return type:

None

copy() ListOfExpectationValues

Return a new instance containing the same expectation values.

Return type:

ListOfExpectationValues

property errors: list[float]

Get list of associated errors.

expectation_values: list[ExpectationValue]
property values: list[float]

Get list of numerical expectation values.