I’m trying to solve a problem by a special convex function define by myself.
The following is my code:
cvx_begin
variable x1(N,L)
minimize(trace(x1*x1'));
subject to
A*x1 == z;
cvx_end
But it pop up this error massage:
Error using cvx/mtimes (line 126)
Disciplined convex programming error:
Only scalar quadratic forms can be specified in CVX
I can’t find out why, please help me.
In the problem, x, A, z are all matrices.
While it is true that trace(x1*x1') is convex, CVX has no way of knowing that, because it does not consider expressions in total—it only considers them one piece at a time. And the internal piece x1*x1' is neither convex nor concave. You must rewrite it in a compliant manner. It’s the same reason why sqrt(sum(square(x)) is rejected by CVX.
In this case, however, we have trace(x1*x1') is the same as trace(x1'*x1) which is in turn the same as sum_square(x1(:)) or square_pos(norm(x1,'fro')). If possible, I would drop the extra squaring and just minimize norm(x1,'fro') instead.