We have matrices $A_i$, $B_i \in\mathbb R^{4\times4}, i \in \{1, \ldots, K\}$ and we'd like to find $X$, $Y \in R^{4\times4}$ such that $X A_i Y = B_i$
Is there any (maybe numeric) way to solve it easily? Number $K$ can be reasonably big i.e. $1$–$100.$
EDIT: I found answer - this problem can be solved as Sylvester equation problem.