Matlab cvx : Invalid quadratic form(s): not a square

Uncategorized
Apr 7, 2022
L

How can I realize the v*v’ in CVX?where v is a vector and also the variable of CVX, I met the problem in the picture. Thank you!!

J

use sum_square(). pls read the cvx user’s guide

L
Replying to #2

Thanks! I will have a try.

L
Replying to #2

But the result I want is a matrix, v*v’,where v’ is the ranspose matrix of v, sum_square caculate a value.

M

Reformulate
trace(Z'*H*v*v'*H'*Z)
as
square_pos(norm(v'*H'*Z,'fro'))

I don’t think you will need to bother with the real.

L
Replying to #6

Thanks a lot! The problem is solved.
I need the result to be a real number,so I use real.
So would you tell me how can i realize it.?

take the picture below for example, the MSEk,j is real,but the matrixs are complex.

J
Replying to #8

It will be real, according to math. Just do the Conjugate transpose of the formula in this picture, it will stay the same.

L
Replying to #9

Oh,Yes! It is naturally real. Thanks

M

The output of norm will be real, with no possibility of roundoff level imaginary term. On the other hand, a Hermitian semidefinite quadratic form could potentially have a roundoff level imaginary term (which CVX might “object” to), especially if there are multiple non-parenthesized multiplications, even though in exact arithmetic, the imaginary component would be exactly zero.

L
Replying to #11

Yes, though the MSE is real in arithmetic, when I use MSE in CVX object, it says"Error using cvxprob/newobj (line 43)Expressions in objective functions must be real."

So what should I do with MSE?Would you please give me some advice?

M

If you have an expression which is real, except for roundoff level imaginary term, you can apply real to it. Or you can do something like X = W*V, u'*X'*X*u instead of u'*V'*W'*W*V*u or just u'*(W*V)'*(W*V)*u

But why are u'*H*v and v'*H'*u real (even if they were computed in exact arithmetic(, and therefore, why is MSE real?

L
Replying to #13

Because if we conjugate transpose MSE, we can find the result eqaul to itself. if a+bi=(a+bi)’,b=0

L
Replying to #13

(u’Hv)’=v’H’u, Their imaginary parts are offset when they are added。a+bi+a-bi=2a,so MSE is real. Is that right?

M

O.k. So apply real(...) to remove any roundoff level imaginary part.