spd_learn.functional.geodesic_euclid#

spd_learn.functional.geodesic_euclid(A, B, alpha=0.5)[source]#

Euclidean geodesic between matrices.

The matrix at position \(\alpha\) on the Euclidean geodesic between two matrices \(\mathbf{A}\) and \(\mathbf{B}\) is:

\[\mathbf{C} = (1-\alpha) \mathbf{A} + \alpha \mathbf{B}\]

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

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

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

  • alpha (float | ndarray, shape (...,), default=0.5) –

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

    Changed in version 0.12.

Returns:

C – Matrices on the Euclidean geodesic.

Return type:

ndarray, shape (…, n, m)

Notes

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

See also

geodesic