Function calcHilbertSchmidtDistance

Source
pub unsafe extern "C" fn calcHilbertSchmidtDistance(
    a: Qureg,
    b: Qureg,
) -> f64
Expand description

Computes the Hilbert Schmidt distance between two density matrices \p a and \p b, defined as the Frobenius norm of the difference between them. That is, we define the Hilbert Schmidt distance \f[ D(a, b) = | a - b |F = \sqrt{ \text{Tr}[ (a-b)(a-b)^\dagger ] } \f] This is equivalent to the square-root of the sum of the absolute value squared of the element-differences of the matrices, i.e. \f[ D(a, b) = \sqrt{ \sum\limits_i \sum\limits_j | a{ij} - b_{ij} |^2 } \f] We caution this may differ by some definitions of the Hilbert Schmidt distance by a square-root.

This function correctly returns the result of the above formulations even when \p a and \p b are incorrectly normalised (i.e. are general matrices).

@see

  • calcDensityInnerProduct()
  • calcFidelity()
  • calcPurity()

@ingroup calc @param[in] a a density matrix @param[in] b an equally-sized density matrix @throws invalidQuESTInputError()

  • if either \p a or \p b are not density matrices
  • if \p a and \p have mismatching dimensions @author Balint Koczor @author Tyson Jones (refactored, doc)