# How to solve the error Only scalar quadratic forms can be specified in CVX

(Shuimei Zhang) #1

Hi,

I would like to put a constraint like \boldsymbol{x}^{H}*\boldsymbol{x}>=\boldsymbol{a}. But I am unable to make it in cvx.

(Mark L. Stone) #2

That is non-convex. Even if x were a scalar, the inequality is going the wrong direction to be convex.

(Shuimei Zhang) #3

Thanks for your quick response? Is there any way I can incorporate the information regarding the absolute of the variable? Because I already known the absolute value of the variable.

(Mark L. Stone) #4

If it is a scalar, then you can solve two separate problems, one for each value (positive and negative) of the variable. In each problem, just input its value as data, i.e., do not declare it as a CVX variable.

if it is an n by 1 vector with n > 1, then no.

(Shuimei Zhang) #5

Thanks for your reply. I was wondering is there any iterative way I can use to make the \boldsymbol{x}^{H}*\boldsymbol{x}==a, \boldsymbol{x} is a n by 1 vector.

(Mark L. Stone) #6

You can try something similar to @stephen_boyd’s answer in How to handle nonlinear equality constraints?

But there is no guarantee it will converge to anything, let alone a local optimum, let alone a global optimum. Maybe you should just use a non-convex nonlinear optimizer.

(Shuimei Zhang) #7

Thanks for your suggestion. I tried that. It gives me an error Invalid constraint: {complex affine} >= {real constant}. Could you please tell me how can I solve the problem?

(Shuimei Zhang) #8

Is q=(Aw^\mathrm{prev})/\|Aw^\mathrm{prev}\|_2 a constant vector?

(Mark L. Stone) #9

You haven;t shown your code, so I don;t know what you did wrong. Perhaps it is just roundoff-level imaginary term, which can be dealt with real(LHS).

My advice still stands to use a non-convex nonlinear optimizer.

(Mark L. Stone) #10

I really don;t know how well this approach works with complex vectors. it might take some effort to get a good implementation. You are on your own, as you are now outside the scope of this forum. So you’ll have to put in the effort.

I will state yet again: My advice still stands to use a non-convex nonlinear optimizer.