pyriemann.utils.distance.distance_wasserstein

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

Wasserstein distance between SPD matrices.

The Wasserstein distance between two SPD matrices A and B is:

\[d(\mathbf{A},\mathbf{B}) = \sqrt{ \text{tr}(A + B - 2(B^{1/2} A B^{1/2})^{1/2}) }\]
Parameters
Andarray, shape (…, n, n)

First SPD matrices, at least 2D ndarray.

Bndarray, shape (…, n, n)

Second SPD matrices, same dimensions as A.

Returns
dndarray, shape (…,) or float

Wasserstein distance between A and B.