For any two symmetric positive definite (SPD) matrices $A$ and $B$, the Affine Invariant Riemannian Metric (AIRM) between them is defined as [1], [2]:
$d(A,B)=||\log (A^{-1/2}B A^{-1/2}) ||_F$,
where $\log(A)$ is the matrix logrithm of $A$, and $||A||_F$ is the Frobenius norm of $A$.
On the other hand, it is also shown that (e.g., see [3])
$d(A,B)=||\log (A^{-1/2}B A^{-1/2}) ||_F = ||\log (A^{-1}B) ||_F$.
However, when I used Matlab function logm, I found that $||\log (A^{-1/2}B A^{-1/2}) ||_F \ne ||\log (A^{-1}B) ||_F$ at all (but their eigenvalues are the same).
I was wondering if there is anything wrong with my understanding the definition of AIRM?
Thanks very much!
[1] R. Bhatia, Positive Definite Matrices. Princeton University Press, 2009.
[2] X. Pennec, P. Fillard, and N. Ayache, “A Riemannian framework for tensor computing,” International Journal of Computer Vision, vol. 66, no. 1, pp. 41–66, 2006.
[3] M. Moakher, “A differential geometric approach to the geometric mean of symmetric Positive-Definite matrices,” SIAM J. Matrix Anal. Appl., vol. 26, no. 3, pp. 735–747, 2005.
[4] I. Horev, F. Yger, and M. Sugiyama, “Geometry-aware principal component analysis for symmetric positive definite matrices,” Machine Learning, 2017.
Let $A, B$ be symmetric positive definite. Formula (2.9) in reference [3] reads as follows: $$ d(A, B) = \|\mathrm{Log}(A^{-1}B)\|_F = \sqrt{\sum_{i} \log(\lambda_i)^2}, $$ where $\lambda_1, \ldots, \lambda_n$ denote the eigenvalues of $A^{-1}B$.
The right-most side is equal to the left-most side, but the middle part is incorrect, for the following reason (it has little to do with matrix logarithms):
While $A^{-1} B$ indeed has positive eigenvalues, those eigenvalues are in general different from the singular values of $A^{-1} B$. That is because $A^{-1}B$ may be (and usually is) non-symmetric.
The Frobenius norm computes the 2-norm of the vector of singular values, but we need to compute the 2-norm of the vector of eigenvalues. To execute this computation without explicitly computing the eigenvalues, we can observe that $M^2$ is a matrix whose eigenvalues are the squares of the eigenvalues of $M$, and therefore $\mathrm{Tr}(M^2)$ is the sum of squared eigenvalues of $M$---notice that this is different from computing $\mathrm{Tr}(M^\top M) = \|M\|_F^2$ when $M$ is not symmetric.
So we can write the following: $$ d(A, B) = \sqrt{\mathrm{Tr}(\mathrm{Log}(A^{-1}B)\mathrm{Log}(A^{-1}B))} = \sqrt{\sum_{i} \log(\lambda_i)^2}. $$ That it how the formula is implemented in Manopt.