spd_learn.functional.mean_harmonic#
- spd_learn.functional.mean_harmonic(X, sample_weight=None, **kwargs)[source]#
Harmonic mean of invertible matrices.
\[\mathbf{M} = \left( \sum_i w_i \ {\mathbf{X}_i}^{-1} \right)^{-1}\]with \(w\) being the weights which sum to 1.
- Parameters:
X (ndarray, shape (..., n_matrices, n, n)) – Set of invertible matrices.
sample_weight (None | ndarray, shape (n_matrices,), default=None) – Weights for each matrix. If None, it uses equal weights.
- Returns:
M – Harmonic mean.
- Return type:
ndarray, shape (…, n, n)
Notes
Changed in version 0.12: Add support for NumPy and PyTorch.
See also