Cannot perform the operation: constant complex affine .* convex

Dear developer,
one of my constraint is something like

-(x^2) * A - (y^2) * B == hermitian_semidefinite(3),
where x and y are real scalar. A =
[1,0,1;
0,1,0;
1,0,1],
B =
[1,0,1i;
0,1,0;
-1i,0,1].
Since B contains complex constant, implementing the constraint like above will encounter the error message:
Cannot perform the operation: {complex affine} .* {convex}”.

Could you give some advice on solving this problem? I really appreciate it.
Best regards,
Jane

For a constraint:
expression = hermitian_semidefinite(3)
expression needs to be affine. Even if you didn’t have the term involving B, you would still get an error message.

Can you use variables named xsq and ysq ? In any event, for these particular matrices A and B, which are (hermitian) semidefinite, the constraint you wish to enter can only be satisfied with x = y = 0.

As an example, this program is “kegal” but the optimal solution has x = y = 0 (within tolerance).

cvx_begin
variables xsq ysq
maximize(xsq + ysq)
-xsq * A - ysq * B == hermitian_semidefinite(3)
xsq >= 0
ysq >= 0
cvx_end

Thanks for your advice. But in my problem, x and y are used in other constraint and objective function. It is not possible to eliminate x and y and only keep xsqr and ysqr.
Suppose we don’t have B.
-(x^2) * A == semidefinite(3) will be also rejected by cvx due to the same reason as you mentioned. Could I use -(x^2) * A ≥ 0 instead? The inequality can be demonstrated as convex.

-(x^2) * A ≥ 0 is allowed if CVX is not in sdp mode. But in that case, it is treated as an element-wise inequality, not a semidefinite constraint.

As I wrote before, with this particular A and B, because the minimum eigenvalue of both A and B is zero, the only feasible x and y satisfying -(x^2) * A - (y^2) * B is hemnitian semidefinite is x = y = 0. And -(x^2) * A is hemnitian semidefinite requires x = 0.

Thanks for your explanation. The constraint I give above is a specific example of my original constraint. In my problem, it’s actually a linear matrix with x as its variable - quadratic function matrix also with x as its variable, which is required to be positive semidefinite.
In this case, If I use elementwise ≥, will cvx produce the expected results?

Besides I’m not very clear why x and y must be zero when the minimum eigenvalues of A and B are zero. If there’s an additional linear matirx with x and y, does it also hold? Would you mind to provide some reference I can learn the detail? Thanks again.

Element-wise is not a semidefinite constraint (unless matrix dimension = 1).

If you have a semoidefinite constraint which is not affine in the variables, then it is not an LMI, and can not be used in CVX. It might be a BMI (Bilinear Matrix Inequality, which is non convex, or a more general nonlinear SDP.

Without seeing the rest of your problem, we don’t know whether a reformulation into a problem acceptable to CVX is possible. But as now formulated, it is non-convex.

The onus is on you to prove you have a convex problem. If you have done so, people on this forum might be able to help you get entered in CVX, if that is possible. Why isn't CVX accepting my model? READ THIS FIRST! .