qiskit.ignis.mitigation.expectation_value
expectation_value(counts, diagonal=None, qubits=None, clbits=None, meas_mitigator=None)
Compute the expectation value of a diagonal operator from counts.
This computes the estimator of , optionally with measurement error mitigation, of a diagonal observable .
Parameters
- counts – counts object
- diagonal – Optional, the vector of diagonal values for summing the expectation value. If
None
the the default value is . - qubits – Optional, the measured physical qubits the count bitstrings correspond to. If None qubits are assumed to be .
- 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 is input using the diagonal
kwarg as a list or Numpy array . If no diagonal is specified the diagonal of the Pauli operator 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
.