# The Product of Two Traces: "not a square" Error

I have an objective function as obj = \mbox{tr} (XA) \mbox{tr} (X^H A^H), which the diagonal complex matrix X \in C^{M \times M} has to be optimized in, and A \in C^{M \times M} is a known matrix. The second derivative of the objective can be proven that is zero, hence the objective is convex. However, using CVX, I came across a DCP error, “Invalid quadratic form(s): not a square”. How should I reformulate the objective function, so the error would be resolved?

Best Regards,

square_abs(trace(X*A))

But A^H X^H \neq X^H A^H

the diagonal complex matrix X, as you said.

1 Like

tr(AB)=tr(BA)

Also if this really is your full objective without any extra terms then why not just replace it with abs(tr(XA)). The same optima but one less nonlinearity in the model.

1 Like