spd_learn.functional.distance_logeuclid#

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

Log-Euclidean distance between SPD/HPD matrices.

The log-Euclidean distance between two SPD/HPD matrices \(\mathbf{A}\) and \(\mathbf{B}\) is [1]:

\[d(\mathbf{A},\mathbf{B}) = \Vert \log(\mathbf{A}) - \log(\mathbf{B}) \Vert_F\]
Parameters:
  • A (ndarray, shape (..., n, n)) – First SPD/HPD matrices.

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

  • squared (bool, default=False) –

    Return squared distance.

    Added in version 0.5.

Returns:

d – Log-Euclidean 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

References

[1]

Geometric means in a novel vector space structure on symmetric positive-definite matrices V. Arsigny, P. Fillard, X. Pennec, N. Ayache. SIAM J Matrix Anal Appl, 2007, 29 (1), pp. 328-347