How can I express the square of Frobenius norm of a matrix in cvx?


#1

Hi, all.
I want to express the square of Frobenius norm of a matrix in cvx. For example, when I want to slove the problem \mathop {\min }\limits_{\mathbf{A}} \;\left\| {{\mathbf{A}} - {\mathbf{B}}} \right\|_{\text{F}}^2 and I express it in matlab as

B = ones(2,2);
cvx_begin quiet
variable A(2,2)
minimize square(norm(A-B,‘fro’))
cvx_end

the cvx gives me an error as

Disciplined convex programming error:
Illegal operation: pow_abs( {convex}, {2} ).

Is there anything wrong with my expression? I really appreciate your help.


(Mark L. Stone) #2

There are several options, including

  1. If there is no other term in the objective function, you might be content with
    minimize(norm(A-B,‘fro’))
    i.e., not squaring. It will have the same argmin as if the objective function were squared.

  2. Use square_pos
    minimize(square_pos(norm(A-B,'fro')))

  3. minimize(sum(sum_square(A-B)))

  4. If using CVX 3.0beta, you have the additional option of coding as you did, i.e.,
    minimize(square(norm(A-B,'fro')))

I suggest you read or re-read the CVX Users’ Guide http://cvxr.com/cvx/doc/ , including the function reference section. http://cvxr.com/cvx/doc/funcref.html#built-in-functions and http://cvxr.com/cvx/doc/funcref.html#new-functions .