# How to solve the linear equation $A\circ (XB) + CX = D$

How to solve the follow equation $X$ is the variable: $A\circ (XB) + CX = D$

where $A \circ B$ is element-wise product or Hadamard product.

if the $A = 1_{n \times n}$. the above equation become $(XB) + CX = A$ become Sylvester equation and can be solved. But how to solve with $A$ is any binary matrix.

Find the SVD of the leading coefficient \eqalign{A = \sum_k \sigma_k u_k v_k^T = \sum_k w_k v_k^T \cr} and from this decomposition create two sets of diagonal matrices \eqalign{W_k &= {\rm Diag}(w_k) \cr V_k &= {\rm Diag}(v_k) \cr} The elementwise/Hadamard product can now be replaced by a sum \eqalign{D = CX + \sum_k W_k XB V_k \cr} Solve this equation via vectorization \eqalign{ {\rm vec}(D)&=\Big(I\otimes C + \sum_k V_kB^T\otimes W_k\Big)\,{\rm vec}(X)\cr {\rm vec}(X)&=\Big(I\otimes C+\sum_k V_kB^T\otimes W_k\Big)^+\,{\rm vec}(D)\cr X&={\rm Mat}\bigg(\Big(I\otimes C+\sum_k V_kB^T\otimes W_k\Big)^+\,{\rm vec}(D)\bigg)\cr } where $M^+$ denotes the pseudoinverse of $M$, and Mat() is the inverse of the vec() operation.