iqm.benchmarks.utils.get_Pauli_expectation

iqm.benchmarks.utils.get_Pauli_expectation#

iqm.benchmarks.utils.get_Pauli_expectation(counts: Dict[str, int], pauli_label: Literal['I', 'X', 'Y', 'Z']) float#

Gets an estimate of a Pauli expectation value for a given set of counts and a Pauli measurement label.

Parameters:
  • counts (Dict[str, int]) – A dictionary of counts. * NB: keys are assumed to have a single bitstring, i.e., coming from a single classical register.

  • pauli_label (str) – A Pauli measurement label, specified as a string of I, X, Y, Z characters.

Raises:

ValueError – If Pauli labels are not specified in terms of I, X, Y, Z characters.

Returns:

The estimate of the Pauli expectation value.

Return type:

float