Undefinite quad_form


Dear all,

I’m optimizing the following problem

    cvx_begin  quiet
    variable p(N,1) 
    minimize( quad_form(p,H))
    subject to
    quad_form( p , G )  <= 1; 
    quad_form( p , J)  <= 1;

where H, G, and J are semidefinite positive matrices. However, I obtain the following error message:

Error using cvx/quad_form (line 230)
The second argument must be positive or negative semidefinite.

Error in pSCA (line 30)
quad_form( p , J) <= 1;

How can I express this problem? Just for the completeness, eigs(J) provides

ans =

-0.0000 - 0.0000i
-0.0000 + 0.0000i
-0.0000 + 0.0000i
-0.0000 - 0.0000i

(Mark L. Stone) #2

Based on the output you show, it looks like J has slightly negative eigenvalues, which is what is causing the error message.

How are you constructing or getting J? Either improve the way it is constructed, or modify it to be psd, such as by adding a small multiple of the identity matrix.

And don’t use the quiet option until your program is running well and reliably.


Thanks Mark,

Based on your comment, I updated Ji= Ji + alpha*eye(N,N);

And only when alpha >= 1, the error disappears. Even for alpha= 1e-1 it remains. I think I’d re-write the problem somehow. In any case, I think it’s important to find another way to tunning how CVX considers a matrix to be undefined.

Thanks in any case,

(Mark L. Stone) #4

You only showed the result of eigs , which if run with default settings, displays the 6 largest magnitude eigenvalues.

Is N larger than 6? If so, perhaps you have significantly negative eigenvalue(s). What is the result of min(eig(J)) ? If that is about -1, then “updating” J by adding eye(N,N) is resulting in your solving a different problem than what you originally specified. If so, you need to rethink/reexamine your problem formulation.


N is lower than 6.

min(eig(J)) equals to zero

J = [1 0 0 -1; 0 0 0 0; 0 0 0 0; 0 0 0 0;];

Thanks for your time Mark,


(Mark L. Stone) #6

I don’t know why you showed 6 eigenvalues for J when it is 4 by 4.

Nevertheless, your J is not symmetric. The CVX Users’ Guide says the 2nd argument of quad_form must be symmetric (among other things). It appears that CVX is accepting J + eye(4) in quad_form even though that is not symmetric - so that is a disparity between the CVX documentation and the code.