Only scalar quadratic forms can be specified in CVX


(mehdi) #1

I’m trying to solve a problem by a special convex function define by myself.
The following is my code
cvx_begin
variable A(n,m)
minimize (trace(Y_2*(Y_2)’*A’*inv(M)*A))
subject to
for r=1:1:N
abs(A(r,r))==1;
end
But it pop up this error massage:
Only scalar quadratic forms can be specified in CVX
I can’t find out why, please help me.


(Mark L. Stone) #2

Your objective function needs to evaluate to a real scalar. It appears to evaluate to a matrix, not a scalar.

Once you have an objective function which evaluate to a scalar, then it needs to be convex, and to be formulated in compliance with CVX’s DCP rules.


(mehdi) #3

evaluate to a real scalar?
please help me


(Mark L. Stone) #4

Given numerical values for all variables, if the objective function evaluates to 5, that is an example of a real scalar. if it evaluates to [8 2;2 1], which is a matrix, that is not a real scalar.