state_metrics.hilbert_schmidt

Hilbert-Schmidt metric.

Module Contents

Functions

hilbert_schmidt(rho, sigma)

Compute the Hilbert-Schmidt distance between two states [2].

state_metrics.hilbert_schmidt.hilbert_schmidt(rho, sigma)

Compute the Hilbert-Schmidt distance between two states [2].

The Hilbert-Schmidt distance between density operators \(\rho\) and \(\sigma\) is defined as

\[D_{\text{HS}}(\rho, \sigma) = \text{Tr}((\rho - \sigma)^2) = \left\lVert \rho - \sigma \right\rVert_2^2.\]

Examples

One may consider taking the Hilbert-Schmidt distance between two Bell states. In toqito, one may accomplish this as

>>> from toqito.states import bell
>>> from toqito.state_metrics import hilbert_schmidt
>>> rho = bell(0) * bell(0).conj().T
>>> sigma = bell(3) * bell(3).conj().T
>>> hilbert_schmidt(rho, sigma)
1

References

[1] (1,2)

Wikipedia. Hilbert-schmidt operator. https://en.wikipedia.org/wiki/Hilbert.

Raises:

ValueError – If matrices are not density operators.

Parameters:
  • rho (numpy.ndarray) – An input matrix.

  • sigma (numpy.ndarray) – An input matrix.

Returns:

The Hilbert-Schmidt distance between rho and sigma.

Return type:

float