Semidefinite optimization

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]

cvx_begin sdp

variable Z(n,n) symmetric
Z == semidefinite(n)
variable y
I = eye(n);
minimize (y * k + Z)
subject to
        y * I + Z >= A

cvx_end

Error is:

Error using *
Inner matrix dimensions must agree.

Error in cvx_end (line 104)
pstr.result = pstr.result * ones(size(pstr.objective));

Error in dual (line 13)
cvx_end

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).

Thanks Bien,

Actually I am modeling sum of the k-largest eigenvalues of a symmetric matrix and I am sure that the objective function is correct, as the general model for a matrix A \in \cal S^n is:

\min ~\lambda k + Z

s.t. ~~~\lambda I + Z - A \succeq 0

$~~~~~~~Z \succeq 0, ~ \lambda~$free

Actually because I am interested in some individual number of eigenvalues then first I have to know the k-largest or smallest eigenvalues and then choose from them. I think this would not help me.

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.

I am going to post on another post to get help why it is happening while the strong duality holds for the primal-dual pair.

Yes, the cryptic error message is due to a bug in CVX. However, the model is flawed, as Bien has correctly pointed out, because your objective function is not a scalar.

That objective function simply cannot be correct, for the simple reason that it is not a scalar.

You’are right mcg. that was a mistake. Actually it is exactly trace(I, Z) not only Z.
(Please see my new post.)