I would like to solve following SDP model using CVX.
But I get some errors which is strange and referring to some lines
number which is not here in the code.
Would you please help me to debugging this code?
n = 4; k = 3;
A =[8 -5 -4 3; -5 13 5 1; -4 5 1 0; 3 1 0 10]
variable Z(n,n) symmetric
Z == semidefinite(n)
I = eye(n);
minimize (y * k + Z)
y * I + Z >= A
Error using *
Inner matrix dimensions must agree.
Error in cvx_end (line 104)
pstr.result = pstr.result * ones(size(pstr.objective));
Your objective function appears to be a scalar added to a matrix. That is likely the problem. If your goal is the sum of the largest k eigenvalues, perhaps using lambda_sum_largest would work (see page 58 of the CVX user guide).
By the way I could get ride of the error by just eliminating the dimension of variable matrix Z and just let it be without dimension. It works nicely and finds the optimal solution. But what is interesting is that the primal and dual model optimal solution for distinct codes find different values.