spd_learn.functional.innerproduct#
- spd_learn.functional.innerproduct(X, Y, Cref, metric='riemann')[source]#
Inner product according to a specified metric.
It calculates the inner product between matrices in the tangent space \(\mathbf{X}\) and \(\mathbf{Y}\) at \(\mathbf{C}_\text{ref}\), according to a specified metric.
- Parameters:
X (ndarray, shape (..., n, n)) – First matrices in tangent space at Cref.
Y (ndarray, shape (..., n, n) | None) – Second matrices in tangent space at Cref. If None, Y is set to X, giving the squared norm of X.
Cref (ndarray, shape (n, n) | None) – Reference matrix.
metric (string | callable, default="riemann") – Metric used for inner product, can be: “euclid”, “logchol”, “logeuclid”, “riemann”, or a callable function.
- Returns:
G – 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.