# Quantum Capacity (QCAP)

*See* `make_qcap()`

, `qcap_bound()`

*for API documentation.*

The QCAP tool provides a bound on the performance of a circuit performed under RC. Performance evaluation is measured as the process infidelity of the entire circuit. Since, under RC, noise is stochastic, the process infidelity is a powerful metric because it is equal to the diamond distance to the ideal circuit. This implies, for instance, that the process infidelity is also a bound on the total variation distance (TVD) between the ideal bitstring distribution of the circuit and the empirical bitstring distribution measured by a quantum device.

As a concrete example, if the ideal distribution of measurement bitstrings of a
2-qubit circuit is `{"00": 0.5, "11": 0.5}`

and in 1000 shots the results ```
{"00":
552, "01": 21, "11": 427}
```

, then the TVD between these two distributions is
\((|0.5-0.552|+|0.021|+|0.5-0.427|/2=0.073)\), which represents the estimate of a 7.3%
chance of getting the wrong bitstring in a given shot. Of course, computing the
ideal bitstring distribution involves a full quantum simulation, which is not
scalable. QCAP is able to estimate an upper bound on the TVD without such a
simulation by characterizing the error rate of each cycle in the circuit and
combining the results. This upper bound assumes the circuit is being run under RC.

The QCAP tool works by accepting a single circuit as an argument, and concatenating CB circuits for every distinct non-zero marked cycle in the circuit. These results are fit and parsed by the bounding tool to give an estimate of the QCAP bound.

Terms that may be returned from the analysis are as follows. These descriptions are also available via mouse-overs when running True-Q™ in a Jupyter or Colab notebook.

## Estimated Parameters

- \({e}_{IU}\) -
Under RC, each dressed cycle of a circuit will have a stochastic error model whose process fidelity is estimated directly by CB. In this setting, errors accumulate in a circuit in a predictable way: the process fidelity of the circuit is the product of the process fidelity of each cycle. This parameter is estimated as this product, with error bars derived from standard propagation of uncertainty techniques.