qat.noisy.compute_fidelity

qat.noisy.compute_fidelity(circuit, stack)

Computes the fidelity of a given circuit according to the following definition:

\[\mathcal{F} = \sqrt{\mathrm{Tr}\left(\langle|\psi_0|\rho|\psi_0\rangle\right)}\]

with \(\rho\) is the output (noisy) density matrix and \(|\psi_0\rangle\) the output (pure) state corresponding to the ideal circuit (without noise).

Parameters
  • circuit (Circuit) – the circuit

  • stack (QPU) – a (noisy) QPU

Returns

fidelity and error bar (only for stochastic method, otherwise None)

Return type

double, double

Note

This method is available as an application in Qaptiva Access.