spd_learn.functional.innerproduct_riemann#
- spd_learn.functional.innerproduct_riemann(X, Y, Cref)[source]#
Affine-invariant Riemannian inner product.
Affine-invariant Riemannian inner product \(\mathbf{g}\) between symmetric/Hermitian matrices in tangent space \(\mathbf{X}\) and \(\mathbf{Y}\) at \(\mathbf{C}_\text{ref}\) is [1]:
\[\mathbf{g}_{\mathbf{C}_\text{ref}}(\mathbf{X}, \mathbf{Y}) = \text{tr} \left( (\mathbf{C}_\text{ref}^{-1/2} \mathbf{X} \mathbf{C}_\text{ref}^{-1/2})^* \mathbf{C}_\text{ref}^{-1/2} \mathbf{Y} \mathbf{C}_\text{ref}^{-1/2} \right)\]- Parameters:
X (ndarray, shape (..., n, n)) – First symmetric/Hermitian matrices in tangent space at Cref.
Y (ndarray, shape (..., n, n) | None) – Second symmetric/Hermitian matrices in tangent space at Cref. If None, Y is set to X, giving the squared norm of X.
Cref (ndarray, shape (n, n)) – Reference SPD/HPD matrix.
- Returns:
G – Affine-invariant Riemannian inner product between X and Y.
- Return type:
float or ndarray, shape (…,)
Notes
Added in version 0.11.
Changed in version 0.12: Add support for NumPy and PyTorch.
See also
References
[1]A metric for covariance matrices W. Förstner & B. Moonen. Geodesy-the Challenge of the 3rd Millennium, 2003