A general form for a linear matrix equation can be written as $$AX + XB + \sum C_iXD_i$$
If $C_i$ and $D_i$ are all 0, then this simplifies into a well known and studied matrix equation that has an efficient solutions using various factorisations. I am wondering if there are efficient solutions to the more general case.
By more efficient solutions, I mean more efficient then simply vectorising X and converting the problem into matrix-vector equation.
I suspect the answer is no, so if this is the case, I am wondering if there is a more efficient solution to the more specific equation $$\sum XA_iA_i^T + B_i^TB_iX - B_iXA_i^T - B_i^TXA_i$$
Where $A_i$ and $B_i$ are positive semidefinite and possibly symmetric.
The reason I ask is that this matrix equation is currently a bottleneck in the code I am writing, and the shear amount of structure to this equation seems to beg for a more efficient solution.