Linear matrix Inequality

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 $$


X & x \
x^T & 1
\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

    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
        X_sdp - x*x'  == semidefinite(10)

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.


X_sdp - x*x'  == semidefinite(10)


[X_sdp x;x' 1] == semidefinite(11)

Then it will run.

That’s right. I’m curious why the author even felt the need to do the conversion, the model was right in its original form.

Mark’s right below. But I should add, instead of that for loop, just do diag(X_sdp)==1.