2

In the CVX package for Matlab, I want to minimize a function like $|Ax-b|_2^2$ . Meaning the square of a 2-norm. How do I code that in CVX? I tried both:

minimize (norm(A*x-b,2)^2);

and

minimize (norm(A*x-b,2)*norm(A*x-b,2));

but both threw errors. Is there a builtin function I'm supposed to be using?

(Note, really I'm trying to minimize the sum of that norm squared plus another norm like minimize (norm(A*x-b,2)^2 + norm(x,1)); so that's why I'm trying to specify the norm squared and not just be satisfied with finding the minimum of the norm unsquared.)

Leo 254
  • 151
  • 1
  • 8
  • 1
    What about [`sum_square_abs( A*x-b )`](http://web.cvxr.com/cvx/doc/dcp.html#scalar-quadratic-forms)? Also, regardless of the success, I'm wondering why you wish to do this; minimization of the norm is a minimization of the norm squared. – TroyHaskin Apr 11 '16 at 23:44
  • 1
    Well the square norm is differentiable, while the norm itself is not. That's a big plus. – Shawn Apr 12 '16 at 01:05

1 Answers1

5

CVX does not support the ()^2 operator. You can either do

(A*x-b)'*(A*x-b)  

or

power(2,norm(A*x-b,2))
ThP
  • 2,206
  • 3
  • 19
  • 25