Ask for help: The expression trace(H_e1 * W1) results in a "not a square" error because H_e1 is a constant square matrix, while W1 is a variable matrix

![微信截图_20241211224121|690x59](upload://cRy3FXw6io40KHhytswOYm


QKSZ1.jpeg)

Any multiplication of CVX variables and/or expressions can trigger the Invalid quadratic form(s) :not a square error message.

I don’t think the error is for the reason you stated. CVX would allow constant matrix times variable matrix. So perhaps the matrix you claim to be constant is a CvX variable or expression. You have not shown us your entire program, so the forum readers don’t know what everything on that line of code is. There are multiplications on both sides of the inequality, so I don’t even know which side triggered the error message.