spd_learn.functional.log_euclidean_geodesic#

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

Geodesic interpolation under the Log-Euclidean metric.

Computes the point on the geodesic between SPD matrices \(A\) and \(B\) at parameter \(t\) under the Log-Euclidean metric:

\[\gamma(t) = \exp\left((1-t) \log(A) + t \log(B)\right)\]

Since the Log-Euclidean metric induces a flat (Euclidean) geometry on the log-domain, geodesics are simply straight lines in that space.

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

  • B (torch.Tensor) – Ending SPD matrices with shape (…, n, n).

  • t (float or torch.Tensor) – Interpolation parameter. For t=0, returns A. For t=1, returns B. For t=0.5, returns the geodesic midpoint (Log-Euclidean mean of two matrices).

Returns:

Interpolated SPD matrices on the geodesic with shape (…, n, n).

Return type:

torch.Tensor

Examples

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

See also

log_euclidean_distance()

Distance under Log-Euclidean metric.

log_euclidean_mean()

Weighted mean under Log-Euclidean metric.

airm_geodesic()

Geodesic under AIRM.

bures_wasserstein_geodesic()

Geodesic under Bures-Wasserstein metric.

log_cholesky_geodesic()

Geodesic under Log-Cholesky metric.

References

See [Arsigny et al., 2007] for more details.