qiskit.ignis.mitigation.CompleteExpvalMeasMitigator.expectation_value¶
-
CompleteExpvalMeasMitigator.
expectation_value
(counts, diagonal=None, qubits=None, clbits=None)[source]¶ Compute the mitigated expectation value of a diagonal observable.
This computes the mitigated estimator of \(\langle O \rangle = \mbox{Tr}[\rho. O]\) of a diagonal observable \(O = \sum_{x\in\{0, 1\}^n} O(x)|x\rangle\!\langle x|\).
- Parameters
counts (
Dict
) – counts objectdiagonal (
Optional
[ndarray
]) – Optional, the vector of diagonal values for summing the expectation value. IfNone
the the default value is \([1, -1]^\otimes n\).qubits (
Optional
[List
[int
]]) – Optional, the measured physical qubits the count bitstrings correspond to. If None qubits are assumed to be \([0, ..., n-1]\).clbits (
Optional
[List
[int
]]) – Optional, if not None marginalize counts to the specified bits.
- Returns
the expectation value and standard deviation.
- Return type
(float, float)
- Raises
QiskitError – if input arguments are invalid.
- Additional Information:
The diagonal observable \(O\) is input using the
diagonal
kwarg as a list or Numpy array \([O(0), ..., O(2^n -1)]\). If no diagonal is specified the diagonal of the Pauli operator :math`O = mbox{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 thequbits
kwarg is used to specify which physical qubits these bit-values correspond to ascircuit.measure(qubits, clbits)
.