Hello,

My objective function is y’*K*y + y’*L, which is quadratic. I know that in order this to be convex, K must be positive semidefinite.

In my case K is a sparse 25x25 matrix and its eigen values are roughly:

1st eigen value: 1000

2nd eigen value: 1

3rd eigen value: 0.5

4th eigen value: 0.2

and the rest is all zero.

I get an an error from function quad_form(), when i run cvx:

“The second argument must be positive or negative semidefinite”.

Even though all eigen values are non negative, how do i not have semidefinite matrix of K.

My code is

cvx begin

variable y(25,1)

minimize y’*K*y + y’*L

cvx end

Ps: There are some constraint equalities as well, but they dont affect whether I get this error or not.