# How to express a product Ax where A and x are both cvx affine expressions?

Dear CVX community,

This is my optimization program:
$$\underset{C,\alpha}{\text{min}}|{C}|_1 + |{\alpha}|_1 \quad s.t. \begin{array}{l} \quad |y-HCW\alpha|_2 < \delta \ \quad diag© = 0 \end{array}$$

I have written a function to compute HCW\alpha. This function first computes W\alpha to obtain a vector, say x_{est}, then is performed the product Cx_{est} to finally multiply H by Cx_{est}. Due the nature of my model is necessary to perform those transformations in that order.

When the function is about to perform the product Cx_{est}, where both C (a 256x256 matrix) and x_{est} (a 256x1 vector) are cvx real affine expressions, the following message is delivered:

??? Error using ==> cvx.mtimes at 126

Disciplined convex programming error:
Only scalar quadratic forms can be specified in CVX

I do not figure out how to rewrite this product as a valid convex expression. Any hint would be a great help. Thanks.

Why don’t you lay out more clearly what your optimization model is? What are your optimization variables? What is the mathematical constraint (?) you’re trying to specify?

It is done Mark, I hope that in this way my question is going to be clearer. Thanks.

CWα is not convex (unless W is the zero matrix). In the 1 by 1 case (for C and α), the Hessian can readily be seen to be indefinite. So rewriting will not get your model to be accepted by cvx, unless the model itself is changed.

Did you prove that your model is convex before even attempting this? There is a reason CVX does not allow most variable-variable products: they are rarely convex. If you do prove it, then you will likely show yourself how to represent it in CVX: because CVX’s rules mirror common proof steps!