- CVaRMeasurement.compute_cvar(energies, probabilities)[código fonte]¶
Given the energies of each sampled measurement outcome (H_i) as well as the sampling probability of each measurement outcome (p_i, we can compute the CVaR. Note that the sampling probabilities serve as an alternative to knowing the counts of each observation and that the input energies are assumed to be sorted in increasing order.
Consider the outcome with index j, such that only some of the samples with measurement outcome j will be used in computing CVaR. The CVaR calculation can then be separated into two parts. First we sum each of the energies for outcomes i < j, weighted by the probability of observing that outcome (i.e the normalized counts). Second, we add the energy for outcome j, weighted by the difference (α - sum_i<j p_i)
energies (list) – A list containing the energies (H_i) of each sample measurement outcome, sorted in increasing order.
probabilities (list) – The sampling probabilities (p_i) for each corresponding measurement outcome.
- The CVaR of the diagonal observable specified by self.primitive and
the sampled quantum state described by the inputs (energies, probabilities). For index j (described above), the CVaR is computed as H_j + 1/α * (sum_i<j p_i*(H_i - H_j))
ValueError – front isn’t a DictStateFn or VectorStateFn
- Tipo de retorno