spd_learn.functional.spd_centering#

spd_learn.functional.spd_centering(X: Tensor, mean_invsqrt: Tensor) → Tensor[source]#

Center SPD matrices around a mean via congruence transformation.

Applies the congruence transformation to center SPD matrices:

\[\tilde{X}_i = M^{-1/2} X_i M^{-1/2}\]

This corresponds to parallel transport from the mean \(M\) to the identity matrix under the affine-invariant Riemannian metric.

Parameters:
  • X (torch.Tensor) – Batch of SPD matrices with shape (…, n, n).

  • mean_invsqrt (torch.Tensor) – Inverse square root of the mean with shape (…, n, n).

Returns:

Centered SPD matrices with shape (…, n, n).

Return type:

torch.Tensor

Notes

After centering, the Fréchet mean of the batch is (approximately) the identity matrix.

See also

karcher_mean_iteration()

Compute the Karcher mean.

parallel_transport_airm()

Parallel transport under AIRM.