1

I want to calculate the diagonal of a matrix in different basis $V' A V$ where $V$ is the unitary matrix and $A$ is the matrix. What is the least computational expensive way?

If I calculate $V' A V$ and throw away all elements other than diagonal, it would be inefficient. I am using Matlab.

gt6989b
  • 54,422
Roy
  • 343

1 Answers1

1

Assuming real matrices, $$ (V'AV)_{kk}=\sum_{s,t}A_{st}V_{sk}{V_{tk}} $$

Martin Argerami
  • 205,756
  • Thanks, do you know a shortcut in matlab to avoid the loop? – Roy Mar 19 '14 at 22:21
  • Sorry, I have no experience with Matlab. But there is not way to avoid adding all the terms, unless in the case of a very particular form of matrix (like diagonal, etc.) – Martin Argerami Mar 19 '14 at 22:34