Is there a fast way to compute $\langle \log(A),B\rangle_F$ when $A\succ 0$ and $B\succ 0$? Here, $\log$ means the matrix logarithm and $\langle A,B\rangle_F=\textrm{tr}(A^TB)$. When $B$ is the identity, I know how to do this with a Choleski factorization. If we let $A=U^TU$, then $$ \langle \log(A),I\rangle = \langle \log(U^TU), I \rangle = \textrm{tr}(\log(U^TU)) = \textrm{tr}(\log(U^T))+\textrm{tr}(\log(U)) = 2\textrm{tr}(\log(U)) = 2\sum\limits_{i=1}^m \log U_{ii} $$ In MATLAB/Octave, we have

A = randn(5); A = triu(A) + triu(A)'; [v d] = eig(A); A = v * abs(d) * inv(v);
ans =  1.1322
U = chol(A); 2*sum(log(diag(U)))
ans =  1.1322

However, when $B$ is a general positive definite matrix, I'm not sure if there's a similar trick. Mostly, I'd like to avoid diagonalizing $A$ since it may be moderately large, but I'm wondering if there's a similar trick to what's possible with the Choleski to computing $\langle \log(A),B\rangle$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.