qat.quops.metrics.get_state_fidelity

qat.quops.metrics.get_state_fidelity(rho1, rho2)

Compute fidelity between 2 density matrices or between a density matrix and a state vector

\begin{eqnarray} F(\rho_1,\rho_2) & = & \left ( \mathrm{Tr} \sqrt{\sqrt{\rho_1} \rho_2 \sqrt{\rho_1}} \right )^2 \\ F(\rho_1, \psi) & = & \langle \psi | \rho_1 |\psi\rangle \end{eqnarray}
Parameters
  • rho1 (matrix) – first matrix \(\rho_1\)

  • rho2 (matrix or list) – second matrix \(\rho_2\) or statevector \(\psi\)

Returns

The fidelity

Return type

float

Note

Note the square. The fidelity is sometimes defined without the square.