mthree.utils.expval_and_stddev¶
- expval_and_stddev(items, exp_ops='')[source]¶
Compute expectation values from distributions.
Added in version 0.16.0:
- Parameters:
- items (list or dict or Counts or ProbDistribution or QuasiDistribution): Input
distributions.
- exp_ops (str or dict or list): String or dict representation of diagonal qubit
operators used in computing the expectation value.
- Returns:
float : Expectation value. ndarray: Array of expectation values
- Notes:
Cannot mix Counts and dicts with M3 Distributions in the same call.
The dict operator format is a sparse diagonal format using bitstrings as the keys.