A problem about square norm in CVX

i need to calculate the term {\left| {h_i^TW} \right|^2} in CVX, where h_i is a column vector with dimension N, W is a matrix with dimension N*I. T in the upperscript means transpose.

In this term, h_i is a given vector and W is a matrix variable. Is this term can be represented as

square_pos(hi.'*W)

I think
square_pos(norm(hi.'*W))
is what you want. Note that here is no . after hi

Edit: Note, I inserted a missing ' which I meant to include. And the . I misread the order of . and ' in your original post.

Thanks. But i think the result should be square_pos(norm(hi.’ * W)).

.’ means transpose (not just .*, i think you miss the ’ in my code).

Since hi is a column vector (N*1 dimension), and W is a N*I dimensional matrix, hi should be taken transpose and then multiply with W to make the dimension right.

Thanks. Now fixed. My mistake was a combination of misreading and making a typo.

It is your contribution, bro. I have one last question, since W is a N*I dimensional matrix, how to obtain the {\left| W \right|^2}, where this norm is Frobenius-norm of a matrix?

square_pos(norm(W,'fro'))
or
square_pos(norm(W(:)))
or
W(:)'*W(:)

hi, It seems to be some thing wrong with the square_pos(norm()). When i debug my code in cvx, i test the value of the following two variables.


Their values should be the same, but their values are different.
Here,

hi

and

MMS_W_hat_s_nan

are respectively the given N dimensional vector and N*I dimensional matrix, they are not the optimization variables.

After that, i test this result

,
where

MMS_W_s_nan

is a N*I dimensional matrix needed to be optimized. It says it is a cvx convex expression and i cannot check the value. But i wonder whether it is still different from the actual value of the norm square of

hi.'*MMS_W_s_nan

See Only scalar quadratic forms can be specified in CVX toolbox - #7 by Mark_L_Stone and my subsequent posts in that topic.

Thanks. I have one last question. In your former suggestion about CVXQUAD

Replace
log(cvx_expression)
with
-rel_entr(1,cvx_expresion)

If i want to calculate a log of a function (not a cvx expression or optimization variable), can i just use log(function) instead of -rel_entr(1,function)?

Yes. That alternative formulation is only needed on CVX expressions, and only when the exponential.m replacement of CVXQUAD is used for Pade apprcximants instead of CVX’s Successive approximation. There’s no need for any of that if Mosek is used as solver.