pyriemann.utils.distance.distance

pyriemann.utils.distance.distance(A, B, metric='riemann')

Distance between SPD matrices according to a metric.

Compute the distance between two SPD matrices A and B according to a metric, or between a set of SPD matrices A and a SPD matrix B.

Parameters
Andarray, shape (n, n) or shape (n_matrices, n, n)

First SPD matrix.

Bndarray, shape (n, n)

Second SPD matrix.

metricstring, default=’riemann’

The metric for distance, can be: ‘euclid’, ‘harmonic’, ‘kullback’, ‘kullback_right’, ‘kullback_sym’, ‘logdet’, ‘logeuclid’, ‘riemann’, ‘wasserstein’, or a callable function.

Returns
dfloat or ndarray, shape (n_matrices, 1)

The distance(s) between A and B.