Hi, everyone.I have problem to solve the following question.

cvx_begin
cvx_solver MOSEK;
variable x(a) complex;
minimize(norm(Z_T_Reshape-Dic_Reshape*x, 2));
subject to
for i = 1:d_len
sum(x((i-1)*f_len+1:i*f_len)) == 1;
end
for i = 1:a
x(i)*(x(i)-1) <= eps;
end
cvx_end

error

错误使用 .*
Disciplined convex programming error:
Invalid quadratic form(s): not a square.
出错 * (第 36 行)
z = feval( oper, x, y );
出错 Opt_Constrain (第 237 行)
x(i)*(x(i)-1) <= eps;

I would greatly appreciate your assistance in resolving this error.

The error is because x is complex. So CVX doesn’t allow x(i)^2, which is what it objects to in x(i)*(x(i)-1).

You need to figure out what your inequality constraint is supposed to be. If you want to use CVX, that constraint needs to be convex. Keep in mind that the LHS of <= constraint needs to evaluate to real convex. Also keep in mind that the equality constraint is not only constraining the real part, but is also constraining the imaginary part of the LHS to 0. So you need to rethink how you are using complex numbers and variables, and what the constraints are supposed to be.

One or both sides of an equality constraint may be complex; inequality constraints, on the other hand, must be real. A complex equality constraint is equivalent to two real equality constraints, one for the real part and one for the imaginary part. An equality constraint with a real side and a complex side has the effect of constraining the imaginary part of the complex side to be zero.

I understand what my mistake was, and I greatly appreciate your assistance. The CVX Users’ Guide has been instrumental in helping me grasp the finer details of constructing this model.