hilbert_schmidt_ip

forest.benchmarking.distance_measures.hilbert_schmidt_ip(A: numpy.ndarray, B: numpy.ndarray, tol: float = 1000) → float

Computes the Hilbert-Schmidt (HS) inner product between two operators A and B.

This inner product is defined as

\[HS = (A|B) = Tr[A^\dagger B]\]

where \(|B) = vec(B)\) and \((A|\) is the dual vector to \(|A)\).

Parameters:
  • A – Is a dim by dim positive matrix with unit trace.
  • B – Is a dim by dim positive matrix with unit trace.
  • tol – Tolerance in machine epsilons for np.real_if_close.
Returns:

HS inner product which is a scalar.