So I’m trying to convert the following semidefinite problem into cvx code. This is actually the semidefinite relaxation of the boolean least squares problem.
$$min ,,\phi_{sdp} = trace(A^T A X) - 2b^TAx + b^Tb $$
$$s.t.$$
$$\begin{bmatrix}
X & x \
x^T & 1
\end{bmatrix}
\succeq0 \ $$
$$X_{ii} = 1, i=1, 2, …, n$$
Note that the first constraint is equivalent to $$ X \succeq xx^T $$
Here’s the code I have
A=randn(10)
b=randn(10,1)+1
cvx_begin
variable X_sdp(10,10) symmetric
variables x(10,1)
minimize (trace(A'*A*X_sdp) - 2*b'*A*x + b'*b)
subject to
for i=1:10,
X_sdp(i, i) == 1
end
X_sdp - x*x' == semidefinite(10)
cvx_end
The error I’m running into is
"Only scalar quadratic forms can be specified in CVX".
which I think refers to the line of the last constraint.