pyriemann.utils.distance.distance_riemann

pyriemann.utils.distance.distance_riemann(A, B)

Affine-invariant Riemannian distance between SPD/HPD matrices.

The affine-invariant Riemannian distance between two SPD/HPD matrices A and B is [1]:

\[d(\mathbf{A},\mathbf{B}) = {\left( \sum_i \log(\lambda_i)^2 \right)}^{1/2}\]

where \(\lambda_i\) are the joint eigenvalues of \(\mathbf{A}\) and \(\mathbf{B}\).

Parameters
Andarray, shape (…, n, n)

First SPD/HPD matrices, at least 2D ndarray.

Bndarray, shape (…, n, n)

Second SPD/HPD matrices, same dimensions as A.

Returns
dndarray, shape (…,) or float

Affine-invariant Riemannian distance between A and B.

References

1

A differential geometric approach to the geometric mean of symmetric positive-definite matrices M. Moakher. SIAM J Matrix Anal Appl, 2005, 26 (3), pp. 735-747