Rank one plus diagonal matrix approximation Given $A \in R^{n \times n}$, $A$ symmetric. I'm trying to solve the following minimization problem:
$\underset{u \in R^n, d \in R^n} \min \, \frac{1}{2} \|X - A\|_F^2$ subject to $X = u u^T + \mathrm{diag}(d)$.
Is there a closed form solution to that problem? I'm not even sure if the problem is convex. 
I know that for best rank-r approximations there is SVD, but I'm not sure what to do with the additional diagonal part.
EDIT: And what about the case when $diag(d)$ has to be positive definite?
 A: I am not sure if there is any closed form solution, but given $u$, there is at least a closed form solution for $d$.
Let $\renewcommand{\diag}{\operatorname{diag}}\renewcommand{\tr}{\operatorname{tr}}D=\diag(d)$ and let $a\in\mathbb R^n$ be the diagonal of $A$. Rewrite the squared Frobenius norm as follows:
\begin{align}
\|X-A\|_F^2
=& \tr\left[(uu^T+D-A)^2\right]\\
=& \phantom{}\|u\|_2^4 - 2u^TAu + \tr(D^2 - 2DA) + 2u^TDu + \tr(A^2).\tag{1}
\end{align}
For fixed $u$, the partial sum $\tr(D^2 - 2DA) + 2u^TDu = \sum_i [d_i^2 - 2(a_{ii} - u_i^2)d_i]$ is minimised when $d_i = a_{ii} - u_i^2$ for all $i$, i.e. when
$$
d=a-u\circ u\tag{2}
$$
and the minimum value is $-\sum_i (a_{ii} - u_i^2)^2 = -\|a\|_2^2 +  2u^T\diag(a)u - \sum_i u_i^4$. Substitute this back into $(1)$, we in turn need to minimise
$$
\|u\|_2^4 - \sum_i u_i^4 + 2u^T\left(\diag(a)-A\right)u + \tr(A^2) - \|a\|_2^2\tag{3}$$
(with $\|u\|_2^4 - \sum_i u_i^4=2\sum_{i<j}u_i^2u_j^2$), which does not appear to have any closed form solution.
