spd_learn.functional.geodesic#

spd_learn.functional.geodesic(A, B, alpha, metric='riemann')[source]#

Geodesic between matrices according to a metric.

Return the matrix at the position alpha on the geodesic between matrices A and B according to a metric.

\(\mathbf{C}\) is equal to \(\mathbf{A}\) if \(\alpha\) = 0, and \(\mathbf{B}\) if \(\alpha\) = 1.

Parameters:
  • A (ndarray, shape (..., n, n)) – First matrices.

  • B (ndarray, shape (..., n, n)) – Second matrices.

  • alpha (float | ndarray, shape (...,)) –

    Position on the geodesic. If ndarray, one value per matrix pair.

    Changed in version 0.12.

  • metric (string | callable, default="riemann") – Metric used for geodesic, can be: “chol”, “euclid”, “logchol”, “logeuclid”, “riemann”, “thompson”, “wasserstein”, or a callable function.

Returns:

C – Matrices on the geodesic.

Return type:

ndarray, shape (…, n, n)

Notes

Changed in version 0.12: Add support for NumPy and PyTorch. Add support for array-valued alpha.