# Crosstalk Diagnostics (CTD)

*See* `make_crosstalk_diagnostics()`

*for API documentation.*

The crosstalk diagnostics tool generates a circuit collection to measure the discrepancy between gate quality while applying gates simultaneously and in an isolated way to each individual system (qubit). This is done by running SRB simultaneously on the specified systems, as well as running it on each system in turn. Optionally, and true by default, this is also done with XRB to learn the discrepancy of the unitarity figure of merit.

One can choose to do any combination of single-qubit twirling or two-qubit twirling
on the labels. For instance, setting labels as `[[4], [5,6]]`

indicates
single-qubit twirling on qubits `4`

and two-qubit twirling on qubits `(5,6)`

.

This composite protocol produces estimates of the following quantities in both the context of isolated gates and simultaneous gates:

- \({e}_{F}\) -
The total probability that an error acts on the targeted systems during a random gate if the noise is stochastic. This probability does not include errors that only affect other systems.

The probability of an error (also known as the process infidelity) satisfies

\[e_F = 1 - F_E = (1 + 1/d) r\]where \(F_E\) is the process fidelity (also known as the entanglement fidelity), \(d\) is the dimension of the system, and

\[r = 1 - \int d\psi \operatorname{Tr}(\psi, E(\psi))\]is the average gate infidelity. Note that the process fidelity is stable under tensor products, whereas the average gate infidelity must be converted to the process fidelity to estimate the fidelity of a tensor product of processes.

And additionally the following quantities will be estimated if XRB circuits are present:

- \({e}_{U}\) -
We define this quantity to be \(e_U = e_F - e_S\), so that it will be \(O(e_S^2)\) if there are no residual unitary errors. Formally, the quantity \(e_U\) is equivalent to the process infidelity of the unitary correction required to make the noise channel decoherent up to corrections of \(O(e_F^2)\) (see arxiv 1904.08897, eq. 65).

- \({e}_{S}\) -
The probability of a stochastic error for an error channel \(\mathcal{A}\) is defined to be

\[e_S = 1 - \sqrt{\Phi(\mathcal{A}^\dagger \mathcal{A}, \mathcal{I})}\]where \(\Phi(\cdot, \cdot)\) is the process fidelity between two channels (see eq. 13 in [8]). By looking at the process fidelity of \(\mathcal{A}^\dagger \mathcal{A}\), we remove any coherent errors. The square root corrects for the residual stochastic errors being applied twice.