PCA problem occurs error:“Only scalar quadratic forms can be specified in CVX”

Q is a projection matrix, which is used to calculate the principal component Y of the original matrix X.
Y = Q^T*X, and there exists a cvx problem that

variable Q(m,n)
*maximize(trace(Q’AA’Q))
subject to
*Q’Q == I
I is a unit matrix
and the matlab shows the below error:
Disciplined convex programming error for the code “*maximize(trace(Q’AA’Q))”:
Only scalar quadratic forms can be specified in CVX

Hello, and a hearty welcome to the forum!!

trace(Q'*A*A'*Q) can be rewritten as square_pos(norm(A'*Q,'fro')) , which is convex. But maximizing that is not convex. Not squaring the ‘fro’ norm would be equivalent, and is convex, but maximizing it is not convex.

And the orthonormality constraint Q'*Q == eye(n) is non-convex.

So, except for the objective and constraint being non-convex, this would be a convex optimization problem.

Thank you very much!! :grinning:

PCA is not a convex optimazation problems, but it’s dual gap has been proven 0. So you can solve its dual problem(a SDP). Also, you can just use the special method to solve(eig vector…)

Do you have a linear SDP formulation of the dual? If so, you should be able to enter it into CVX and have ti call a solver to (attempt to) solve it.

Regarding “the special method to solve(eig vector…)” you will have to be clearer as to what you’re talking about.