I am trying to minimize the function f(Z)=v^TZZ^Tv, for a given vector v. It is easy to check that this function is convex. My cvx code looks as follows
I got the error: “Disciplined convex programming error: Only scalar quadratic forms can be specified in CVX”
. Since v is a vector the result of v^TZZ^Tv is indeed a scalar. So it is not clear to me, why I get the above error. I guess my code is not in the DCP form, but after going through the cvx guide, I could not come up with a better way.
The reason you get the error is that CVX is not a parser. It cannot evaluate the quad_form expression in total; it must evaluate each expression as it is encountered. Yes, v^TZZ^Tv is a scalar, but what it is seeing at that point is ZZ^T, which is not.
Why doesn’t norm(Zopt'*vin) work? It is true that will give you a different objective value. But it’s just the square root of the value you’re seeking. The optimal point it will return is identical. Of course, if you’re adding other terms to the objective it is not equivalent.