spd_learn.functional.geodesic_riemann#
- spd_learn.functional.geodesic_riemann(A, B, alpha=0.5)[source]#
Affine-invariant Riemannian geodesic between SPD/HPD matrices.
The matrix at position \(\alpha\) on the affine-invariant Riemannian geodesic between two SPD/HPD matrices \(\mathbf{A}\) and \(\mathbf{B}\) is:
\[\mathbf{C} = \mathbf{A}^{1/2} \left( \mathbf{A}^{-1/2} \mathbf{B} \mathbf{A}^{-1/2} \right)^\alpha \mathbf{A}^{1/2}\]\(\mathbf{C}\) is equal to \(\mathbf{A}\) if \(\alpha\) = 0, and \(\mathbf{B}\) if \(\alpha\) = 1.
- Parameters:
A (ndarray, shape (..., n, n)) – First SPD/HPD matrices.
B (ndarray, shape (..., n, n)) – Second SPD/HPD 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 – SPD/HPD matrices on the affine-invariant Riemannian 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.
See also
References
[1]Riemannian geometry and matrix geometric means R. Bhatia and J. Holbrook. Linear Algebra and its Applications, 2006