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

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.

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

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.

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.

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.

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.

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?

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

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.

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.