spd_learn.functional.log_euclidean_scalar_multiply#
- spd_learn.functional.log_euclidean_scalar_multiply(alpha: float, x: Tensor) Tensor[source]#
Logarithmic scalar multiplication of an SPD matrix.
Computes the logarithmic scalar multiplication (denoted \(\circledast\) in the literature) of a scalar and an SPD matrix:
\[\alpha \circledast X = \exp(\alpha \cdot \log(X))\]This operation, together with logarithmic multiplication \(\odot\), extends the Lie group structure on SPD matrices to a vector space structure [Arsigny et al., 2007].
The logarithmic scalar multiplication generalizes the notion of matrix power to the Log-Euclidean framework and provides a geometrically meaningful way to scale SPD matrices.
- Parameters:
alpha (float or torch.Tensor) – Scalar multiplier. Can be any real number.
x (torch.Tensor) – SPD tensor with shape (…, n, n).
- Returns:
Scaled SPD tensor with shape (…, n, n).
- Return type:
Notes
The logarithmic scalar multiplication satisfies the following properties:
Distributive over \(\odot\): \(\alpha \circledast (X \odot Y) = (\alpha \circledast X) \odot (\alpha \circledast Y)\)
Compatible with scalar multiplication: \((\alpha \beta) \circledast X = \alpha \circledast (\beta \circledast X)\)
Identity: \(1 \circledast X = X\)
Zero: \(0 \circledast X = I\) (identity matrix)
Inverse: \((-1) \circledast X = X^{-1}\)
SPD-preserving: Output is SPD for any real \(\alpha\)
For diagonal matrices, this reduces to element-wise power: \(\alpha \circledast \text{diag}(d_1, \ldots, d_n) = \text{diag}(d_1^\alpha, \ldots, d_n^\alpha)\).
See also
log_euclidean_multiply()Logarithmic multiplication of SPD matrices.
log_euclidean_geodesic()Geodesic interpolation (uses scalar multiplication).
log_euclidean_mean()Weighted mean of multiple SPD matrices.
References
The logarithmic scalar multiplication was introduced by Arsigny et al. [2007] (Definition 3.12) to extend the Lie group structure on SPD matrices to a vector space structure. See:
Arsigny, V., Fillard, P., Pennec, X., and Ayache, N. “Geometric means in a novel vector space structure on symmetric positive-definite matrices.” SIAM Journal on Matrix Analysis and Applications, 29(1):328-347, 2007.
Examples
>>> import torch >>> from spd_learn.functional import log_euclidean_scalar_multiply >>> X = torch.eye(3) * 4 >>> # 0.5 ⊛ X = exp(0.5 * log(X)) = X^0.5 = 2*I >>> Y = log_euclidean_scalar_multiply(0.5, X) >>> torch.allclose(Y, torch.eye(3) * 2, atol=1e-5) True >>> # -1 ⊛ X = X^{-1} >>> Z = log_euclidean_scalar_multiply(-1, X) >>> torch.allclose(Z, torch.eye(3) * 0.25, atol=1e-5) True