spd_learn.functional.spd_cholesky_congruence#

spd_learn.functional.spd_cholesky_congruence(X: Tensor, P: Tensor, inverse: bool = False) → Tensor[source]#

Congruence transformation using the Cholesky factor of an SPD matrix.

Given an SPD matrix \(P = LL^T\), applies:

\[\text{forward: } Y = LXL^T, \qquad \text{inverse: } Y = L^{-1}X L^{-T}\]

This implements the Lie group action of GL(n) on the SPD manifold and is used for centering and biasing under the affine-invariant metric.

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

  • P (torch.Tensor) – SPD matrix whose Cholesky factor defines the transformation, with shape broadcastable to X.

  • inverse (bool, default=False) – If True, applies the inverse congruence \(L^{-1}X L^{-T}\).

Returns:

Transformed SPD matrices with the same shape as X.

Return type:

torch.Tensor

See also

spd_centering()

Eigendecomposition-based centering (uses \(M^{-1/2}\)).