Imagine I have 2 matrices A and B and I need the diagonal elements of (A' * B). If say A and B are both m*n matrices which contains column vectors as follows:
Then the diagonal elements of (A' * B) can be calculated by the vector products of the paired vectors a1'*b1, a2'*b2, ..., an' * bn.
Now if I perform economy size SVD to A and B:
[ua, sa, va] = svd(A, 'econ');
[ub, sb, vb] = svd(B, 'econ');
Then my question is: can I calculate only the diagonal elements of (A' * B) with SVD components [ua, sa, va] and [ub, sb, vb]? Notice only the diagonal elements, none of the other elements can be computed.
My understanding is no, I can't. Because if recovering (A' * B) by the SVD components, say
A' * B = (ua1 * sa1 * va1')' * (ub1 * sb1 * vb1') + ...
then each component product
(uan * san * van')' * (ubn * sbn * vbn')
is a full m*n matrix, which only recovers part of the whole diagonal line. Summing all n full m*n matrices will recover the matrix (A' * B), but this is not cheaper than computing (A' * B), because it involves computation of all elements of (A' * B). So if SVD is involved, there is no efficient way of getting diagonal elements of (A' * B) by only computing the diagonal elements.
I don't know if I'm right, and please excuse me if it's not so clear.