How to solve A=2BXB-Diag(BXB) Given $X,B,A \in \mathbb{R}^{p \times p}$ how do you solve 
$A=2BXB - \text{Diag}(BXB)$ 
for $X$? Is there a closed-form? One can assume the following: $A,B$ and $X$ are symmetric positive definite.  
I can iteravitly solve the problem as follows :
$B^{-1}(A+\text{Diag}(BXB))B^{-1}/2=X_{+}$
Note: $Diag(BXB)$ is a diagonal matrix containing the diagonal elements of BXB. 
 A: Apologies, this has a trivial solution. On the diagonal, it is clear that $A_{ii}=(BXB)_{ii}$.
Thus $X=B^{-1}$(A + Diag(A))$B^{-1}/2$.
A: It may be easier for Readers to follow the solution if we decompose the problem into two phases.
Let $Y = BXB$, where $B$ is symmetric positive definite (and thus invertible).  So if $Y$ is determined, then also will $X=B^{-1}YB^{-1}$ be determined.  Furthermore $Y$ is symmetric if and only if $X$ is symmetric, and indeed $Y$ is symmetric positive definite if and only if $X$ is symmetric positive definite.
It remains to solve the simple problem:
$$ A = 2Y - \operatorname{Diag} (Y) $$
The entries of $Y$ are easily deduced.  The diagonal entries of $Y$ are the same as the diagonal entries of $A$, e.g. by taking the diagonal entries on both sides of the above matrix equation.  On the other hand the off-diagonal entries of $Y$ are half the corrresponding off-diagonal entries of $A$.  Thus the solution:
$$ Y = \frac{1}{2} (A + \operatorname{Diag} (A)) $$
If $A$ is symmetric positive definite, so too is $A + \operatorname{Diag} (A)$. Hence $Y$ will be symmetric positive definite if $A$ is, but there are slightly weaker conditions that would allow $A$ to be not-quite diagonally dominant and yet give $A + \operatorname{Diag} (A)$ positive definite.
In any case $X$ is symmetric positive definite if and only if $A + \operatorname{Diag} (A)$ is symmetric positive definite.
