I want to write a SDP formulation with variables $X$ and $Y$.
Suppose I have the following constraint:
$$Y = A + (XA-AX)$$
where the constant matrix $A\succeq 0$.
I know a valid equality constraint in SDP should be an affine. How to rewrite the above equality constraint as an affine constraint?
We have the following linear matrix equation in $\mathrm X, \mathrm Y \in \mathbb R^{n \times n}$
$$\rm A X - X A + Y = A$$
Vectorizing, we obtain the following linear system of $n^2$ equations in $2 n^2$ unknowns
$$\left( \mathrm I_n \otimes \mathrm A - \mathrm A^{\top} \otimes \mathrm I_n \right) \mbox{vec} (\mathrm X) + \mbox{vec} (\mathrm Y) = \mbox{vec} (\mathrm A)$$
where each equation can be written in the form
$$\langle \mathrm M_i, \mathrm X \rangle + \langle \mathrm N_i, \mathrm Y \rangle = b_i$$
where
$\mathrm M_i$ is the un-vectorization of the $i$-th row of $\mathrm I_n \otimes \mathrm A - \mathrm A^{\top} \otimes \mathrm I_n$
$\mathrm N_i$ is the un-vectorization of the $i$-th row of $\mathrm I_{n^2}$.