Solving XAY = B for both X and Y I have a problem where A and B are known in the above expression, and I'd like to solve for X and Y concurrently.
Dimensions:

*

*X is a diagonal matrix (N x N)

*A is square (N x N), and sparse if that helps

*Y is a vector (N x 1)

*B is a vector (N x 1)

For reference, this follows on from my question from yesterday (Solving a linear system of the form C .* (BX) = AX) which was solved, but unfortunately requires wading through "null space". I was not able to find the desired solution robustly using standard optimization approaches, which has led me to reformulate the problem as above (giving me, unfortunately, two unknowns to solve for).
Many thanks (again) in advance...
 A: Solution.
$$\begin{split}XAY&=B\\
\left(\begin{matrix}\frac 1 {x_1} & 0&... & 0\\0&\frac 1 {x_2}&...&0\\...&...&...&0\\0&0&0&\frac 1 {x_N}\end{matrix}\right)\left(\begin{matrix}A_1^T\\...\\A_N^T\end{matrix}\right)\left(\begin{matrix}Y_1\\...\\Y_N\end{matrix}\right)&=\left(\begin{matrix}B_1\\...\\B_N\end{matrix}\right)\text { write the matrix}\\
\left(\begin{matrix}A_1^T\\...\\A_N^T\end{matrix}\right)\left(\begin{matrix}Y_1\\...\\Y_N\end{matrix}\right)&=\left(\begin{matrix}x_1 & 0&... & 0\\0&x_2&...&0\\...&...&...&0\\0&0&0&x_N\end{matrix}\right)\left(\begin{matrix}B_1\\...\\B_N\end{matrix}\right)\text { left multiply by $X^{-1}$}\\
&=\left(\begin{matrix}B_1x_1\\...\\B_Nx_N\end{matrix}\right)\text { property of diagonal matrices}\\
\left(\begin{matrix}A_1^TY-B_1x_1+0x_2+...+0x_N\\...\\A_N^TY+0x_1+0x_2+...-B_Nx_N\end{matrix}\right)&=0\text { expand left hand side and subtract the right term from both sides}\\
\left(\begin{matrix}A_1^T&-B_1&0&...&0 \\...\\A_N^T&0&0&...&-B_N\end{matrix}\right)\left(\begin{matrix}Y_1\\...\\Y_N\\X_1\\...\\X_N\end{matrix}\right)&=\text { write in matrix form}\\
\left(\begin{matrix}A&-diag(B)\end{matrix}\right)\left(\begin{matrix}Y\\X\end{matrix}\right)&=0\text { write in block matrix form}\end{split}$$
I'm sorry, it seems like this solution requires null space too.
