spd_learn.functional.log_cholesky_geodesic#

spd_learn.functional.log_cholesky_geodesic(A, B, t)[source]#

Geodesic interpolation in the Log-Cholesky metric.

Computes the point on the geodesic between SPD matrices \(A\) and \(B\) at parameter \(t\):

\[\gamma(t) = \exp_{\text{chol}}\left((1-t) \log_{\text{chol}}(L_A) + t \log_{\text{chol}}(L_B)\right)\]

where \(t \\in [0, 1]\).

Parameters:
  • A (torch.Tensor) – Starting SPD matrix of shape (…, n, n).

  • B (torch.Tensor) – Ending SPD matrix of shape (…, n, n).

  • t (float or torch.Tensor) – Interpolation parameter. For t=0, returns A. For t=1, returns B.

Returns:

Interpolated SPD matrix of shape (…, n, n).

Return type:

torch.Tensor

See also

log_cholesky_distance()

Distance under Log-Cholesky metric.

log_cholesky_mean()

Fréchet mean under Log-Cholesky metric.

airm_geodesic()

Geodesic under AIRM.

bures_wasserstein_geodesic()

Geodesic under Bures-Wasserstein metric.

Examples

>>> import torch
>>> A = torch.eye(3)
>>> B = 4 * torch.eye(3)
>>> # Midpoint
>>> mid = log_cholesky_geodesic(A, B, 0.5)
>>> print(f"Midpoint diagonal: {torch.diag(mid)}")
Midpoint diagonal: tensor([2., 2., 2.])