spd_learn.functional.distance_harmonic#

spd_learn.functional.distance_harmonic(A, B, squared=False)[source]#

Harmonic distance between invertible matrices.

The harmonic distance between two invertible matrices \(\mathbf{A}\) and \(\mathbf{B}\) is:

\[d(\mathbf{A},\mathbf{B}) = \Vert \mathbf{A}^{-1} - \mathbf{B}^{-1} \Vert_F\]
Parameters:
  • A (ndarray, shape (..., n, n)) – First invertible matrices.

  • B (ndarray, shape (..., n, n)) – Second invertible matrices, same dimensions as A.

  • squared (bool, default=False) –

    Return squared distance.

    Added in version 0.5.

Returns:

d – Harmonic distance between A and B.

Return type:

float or ndarray, shape (…,)

Notes

Changed in version 0.12: Add support for NumPy and PyTorch.

See also

distance