spd_learn.functional.distance_logchol#
- spd_learn.functional.distance_logchol(A, B, squared=False)[source]#
Log-Cholesky distance between SPD/HPD matrices.
The log-Cholesky distance between two SPD/HPD matrices \(\mathbf{A}\) and \(\mathbf{B}\) is [1]:
\[d(\mathbf{A},\mathbf{B}) = \left( \Vert \text{lower}(\text{chol}(\mathbf{A})) - \text{lower}(\text{chol}(\mathbf{B})) \Vert_F^2 + \Vert \log(\text{diag}(\text{chol}(\mathbf{A}))) - \log(\text{diag}(\text{chol}(\mathbf{B}))) \Vert_F^2 \right)^\frac{1}{2}\]- Parameters:
A (ndarray, shape (..., n, n)) – First SPD/HPD matrices.
B (ndarray, shape (..., n, n)) – Second SPD/HPD matrices, same dimensions as A.
squared (bool, default=False) – Return squared distance.
- Returns:
d – Log-Cholesky distance between A and B.
- Return type:
float or ndarray, shape (…,)
Notes
Added in version 0.7.
Changed in version 0.12: Add support for NumPy and PyTorch.
See also
References
[1]Riemannian geometry of symmetric positive definite matrices via Cholesky decomposition Z. Lin. SIAM J Matrix Anal Appl, 2019, 40(4), pp. 1353-1370.