fidelity¶
-
forest.benchmarking.distance_measures.
fidelity
(rho: numpy.ndarray, sigma: numpy.ndarray, tol: float = 1000) → float¶ Computes the fidelity \(F(\rho, \sigma)\) between two quantum states rho and sigma.
If the states are pure the expression reduces to
\[F(|psi>,|phi>) = |<psi|phi>|^2\]The fidelity obeys \(0 ≤ F(\rho, \sigma) ≤ 1\), where \(F(\rho, \sigma)=1 iff \rho = \sigma\).
Parameters: - rho – Is a dim by dim positive matrix with unit trace.
- sigma – Is a dim by dim positive matrix with unit trace.
- tol – Tolerance in machine epsilons for np.real_if_close.
Returns: Fidelity which is a scalar.