$\operatorname{tr}(BA)$ where $A$ is low rank and has a subset of eigenvalues from $B^{-1}$ Most of the question is in the title.
Suppose that I have $B$ a square $N\times N$ positive definite matrix, and $A$ a low-rank square matrix with its non-zero eigenvalues being a subset of the spectrum of $B^{-1}$. Is there a simple way to compute the trace : $\mathrm{tr}(BA)$?
My intuition is that if $M$ is the rank of $A$, then $B$ and $A$ can share all $N$ eigenvectors and that one can diagonalize $A$ and $B$ and get automatically $\mathrm{tr}(BA) = \sum_{i:\lambda_i>0} \frac{\lambda_i}{\lambda_i} = M$ where $\lambda_i$ are the eigenvalues of $A$. But I am not sure how to obtain the proper ordering etc.
Thanks for your help!

Without further information, there is no way to use the eigenvalues of $A$ in this computation. However, we can make use of the fact that $A$ is low-rank. In particular, if $A = CF$ is a rank factorization (so that $C$ is $N \times r$ and $F$ is $r \times N$), then we have
$$
\operatorname{tr}(BA) = 
\operatorname{tr}(BCF) = \operatorname{tr}(FBC).
$$
That is, we may rewrite the expression as the trace of an $r \times r$ matrix.
