spd_learn.functional.distance_euclid#

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

Euclidean distance between matrices.

The Euclidean distance between two matrices \(\mathbf{A}\) and \(\mathbf{B}\) is defined as the Frobenius norm of the difference of the two matrices:

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

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

  • squared (bool, default=False) –

    Return squared distance.

    Added in version 0.5.

Returns:

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