Skip to main contentIBM Quantum Documentation
You are viewing the API reference for an old version of Qiskit SDK. Switch to latest version

qiskit.ignis.mitigation.expectation_value

expectation_value(counts, diagonal=None, qubits=None, clbits=None, meas_mitigator=None)

GitHub(opens in a new tab)

Compute the expectation value of a diagonal operator from counts.

This computes the estimator of O=Tr[ρ.O]\langle O \rangle = \text{Tr}[\rho. O], optionally with measurement error mitigation, of a diagonal observable O=x{0,1}nO(x)x ⁣xO = \sum_{x\in\{0, 1\}^n} O(x)|x\rangle\!\langle x|.

Parameters

  • counts – counts object
  • diagonal – Optional, the vector of diagonal values for summing the expectation value. If None the the default value is [1,1]n[1, -1]^\otimes n.
  • qubits – Optional, the measured physical qubits the count bitstrings correspond to. If None qubits are assumed to be [0,...,n1][0, ..., n-1].
  • clbits – Optional, if not None marginalize counts to the specified bits.
  • meas_mitigator – Optional, a measurement mitigator to apply mitigation.

Returns

the expectation value and standard deviation.

Return type

(float, float)


Additional Information:

The diagonal observable OO is input using the diagonal kwarg as a list or Numpy array [O(0),...,O(2n1)][O(0), ..., O(2^n -1)]. If no diagonal is specified the diagonal of the Pauli operator O=diag(Zn)=[1,1]nO = \text{diag}(Z^{\otimes n}) = [1, -1]^{\otimes n} is used.

The clbits kwarg is used to marginalize the input counts dictionary over the specified bit-values, and the qubits kwarg is used to specify which physical qubits these bit-values correspond to as circuit.measure(qubits, clbits).

For calibrating a expval measurement error mitigator for the meas_mitigator kwarg see qiskit.ignis.mitigation.expval_meas_mitigator_circuits() and qiskit.ignis.mitigation.ExpvalMeasMitigatorFitter.

Was this page helpful?
Report a bug or request content on GitHub.