cvx_begin
variables x y z
X = [ x 0; z 1 ];
Y = [ 1 0; z y ];
X*Y == [ 1 0; 2 1 ];
cvx_end

Although the product X*Y is a nonconvex quadratic, when you expand it out, it is linear in the variables x,y,z. CVX recognizes it as such and returns no error. However, CVX parses the expression incorrectly. The code above evaluates as infeasible (v.2.1, Build 1107), even though it’s a set of linear equations with x=y=z=1 as a solution. If you comment out the “cvx_end” and type:

X*Y

It returns

cvx real affine expression (2x2 matrix, 2 nonzeros)

which is already incorrect; there should be three nonzeros.

Thanks for offering this, up… it’s actually on my to-do list, but it is not as easy as you might think, and I cannot tell you for sure if or when it will be fixed.

To be frank, even allowing products of CVX expressions, so that it can handle quadratic expressions like x'*P*x without the need for quad_form, is an aesthetic compromise. It’s not a valid application of the disciplined convex programming rules.

So what I may end up having to do is reject such expressions altogether. A workaround is for you to write it as cvx_constant(X) * Y + ( X - cvx_constant(X) ) * cvx_constant(Y).

Thanks! In my application I have products of cvx expressions that I know are affine; I’m just using the CVX language to help parse the expressions for me. So perhaps your workaround will be sufficient for my application. Just curious — what does cvx_constant do? I couldn’t find it in the user manual