DCP error: Only scalar quadratic forms can be specified in CVX 2

Disciplined convex programming error:
Only scalar quadratic forms can be specified in CVX
.

variables a(N,1)
minimize( sum( sum((a*a').*(label*label').*test(x)) ) - sum(a))

I want to realize a*a’ to get a matrix, while the error occurs, how can I still get this matrix?

a*a' involves product terms which are disallowed by CVX, and might be non-convex.

Have you proved the problem is convex? Yf so, perhaps a reformulation for CVX is possible. If it is not convex, then it can’t be handled by CVX. You haven’t shown enough information on your problem, so i don’t whether the problem can be reformulated for CVX.

I’m trying to write a code about nonlinear-SVM using CVX.
It can be shown below:


My a stands for the alpha in the picture and label stands for y. test is my function to return kernel function(In a form of matrix). I want to use the dot product of the matrix, and add all the entries together, then I can get the sum term which I want to minimize in the picture(minus to maximize).

You need to rewrite that as a quadratic form, -1/2*y'*M*y, where M is a psd matrix. Doing so is a math problem, not a CVX matter.

1 Like