spd_learn.functional.pairwise_distance#

spd_learn.functional.pairwise_distance(X, Y=None, metric='riemann', squared=False)[source]#

Pairwise distance matrix.

Compute the matrix of distances between pairs of elements of X and Y.

Parameters:
  • X (ndarray, shape (n_matrices_X, n, n)) – First set of matrices.

  • Y (None | ndarray, shape (n_matrices_Y, n, n), default=None) – Second set of matrices. If None, Y is set to X.

  • metric (string, default="riemann") – Metric for pairwise distance. For the list of supported metrics, see pyriemann.geometry.distance.distance().

  • squared (bool, default=False) –

    Return squared distances.

    Added in version 0.5.

Returns:

dist – Distances between pairs of elements of X if Y is None, or between elements of X and Y.

Return type:

ndarray, shape (n_matrices_X, n_matrices_X) or (n_matrices_X, n_matrices_Y)

Notes

Added in version 0.2.5.

Changed in version 0.12: Add support for NumPy and PyTorch.

See also

distance