For my research I have been working with different continuous-time Lyapunov equations of the form \begin{equation} M R + R M^\text{T} = G \end{equation} where all matrices are real and $n\times n$ ($R$ is symmetric). Component-wise, they read \begin{equation} \sum_k\left( M_{i,k} R_{k,j} + M_{j,k}R_{k,i} \right)= G_{i,j} \end{equation} However, I have now modified the problem so that the diagonal equations ($i=j$) become \begin{equation} \sum_k\left( M_{i,k} R_{k,i} + M_{i,k}R_{k,i} \right) -\delta_i R_{i,i}= G_{i,i} \end{equation} ie, a new term appears which involves only the diagonal entries, with the $\delta_i$ being real numbers.
How do I express this extra term in matrix notation? I was hoping this could be written as a Riccati or Sylvester type of equation so that I could employ specialised solvers.
Actually, a related but more general question is: what linear transformation $T$ (and its accompanying matrix) should I perform in a matrix $A$ to obtain a diagonal matrix with the original entries; i.e., \begin{equation} T(A) = \text{diag}(a_{1,1}, a_{2,2},\ldots,a_{n,n}) \end{equation}
Thank you very much for the support.
Gabriel