spd_learn.functional.log_map_airm#

spd_learn.functional.log_map_airm(P, Q)[source]#

Riemannian logarithmic map under the Affine-Invariant metric.

Maps a point \(Q\) on the SPD manifold to a tangent vector at base point \(P\). This is the inverse of the exponential map.

Under the Affine-Invariant Riemannian Metric (AIRM), the logarithmic map is:

\[\text{Log}_P(Q) = P^{1/2} \log(P^{-1/2} Q P^{-1/2}) P^{1/2}\]

where \(\log\) denotes the matrix logarithm. The result is a symmetric matrix representing the tangent vector at \(P\) that points towards \(Q\).

Parameters:
  • P (torch.Tensor) – Base point on the SPD manifold with shape (…, n, n).

  • Q (torch.Tensor) – Target point on the SPD manifold with shape (…, n, n).

Returns:

Tangent vector at P (symmetric matrix) with shape (…, n, n).

Return type:

torch.Tensor

Notes

The norm of the tangent vector under the AIRM inner product equals the geodesic distance:

\[\|\text{Log}_P(Q)\|_P = d_{\text{AIRM}}(P, Q)\]

where \(\|V\|_P = \|P^{-1/2} V P^{-1/2}\|_F\) is the AIRM norm.

Examples

>>> import torch
>>> from spd_learn.functional.metrics import exp_map_airm, log_map_airm
>>> P = 2 * torch.eye(3)
>>> Q = 3 * torch.eye(3)
>>> V = log_map_airm(P, Q)  # Tangent vector from P to Q
>>> Q_back = exp_map_airm(P, V)  # Should recover Q
>>> torch.allclose(Q, Q_back, atol=1e-5)
True

See also

exp_map_airm()

Inverse operation (exponential map).

airm_distance()

Geodesic distance.

References

See [Pennec et al., 2006] for more details.