Disciplined convex programming error:Only scalar quadratic forms can be specified in CVX. How to add additional constraint

Line 227 gives disciplined convex programming error. I want to add an additional constraint related to Z matrix and trying to define the Z matrix using these lines:
A_mat = xExE’;
Z = B
A_mat*C;
Z = Z^h;

Can someone please explain what is the correct way to do this?

Hello, and welcome to the forum.

Are you trying to impose an equality constraint Z == Z^n on the matrix Z? That doesn’t look convex to me.

Hi, I want to define a matrix Z such that if I multiply it h times with itself the last row should have atleast one non zero element for which flag has been used in the constraint. So, Z= Z^h is used as an assignment here and not as equality constraint.

I believe that constraint would be non-convex,and not even doable with .MIDCP.due to the matrix multiplication

Can you suggest other ways to do this? If an additional constraint needs to be added, which requires matrix multiplication along with Ax==y

Please read the link,. CVX is not appropriate for this problem.

Is matrix multiplication not allowed in CVX according to DCP rules? In the process of using a convex constraint if we require matrix multiplication, can that be done?

Matrix multiplication in which both matrices are CVX variables or expressions is a violation of DCP rules, and is not allowed by CVX.

If a constraint involving multiplication of matrix variables actually is convex (but many such constraints are not convex), in some cases it can be reformulated to comply with CVX’s rules, as for example in my post at How to deal trace(X^H*A*X) in cvx