Hello

sorry to take your time

I do sparse recovery with cvx but it gives me NaN. Why do I get this and how can I solve it?

Thanks for any help.

n=100;

cvx_begin

variable xs(n)

minimize norm(xs,1) ;

subject to

norm(y-As*xs,2)<0.00001;

cvx_end

You haven’t provided us the values of A and y. Therefore, we can not reproduce your results.

If you provide the output when you run your code, then maybe we can say something about what happened.

My guess is that your problem is infeasible. Here is a simple version of your problem using n = 1, which I designed to be infeasible…

```
n=1;
y=[1;2];
As=[3;1];
cvx_begin
variable xs(n)
minimize norm(xs,1)
subject to
norm(y-As*xs,2)<0.00001
cvx_end
```

Here is what happens when it is run:

Warning: The use of strict inequalities in CVX is strongly discouraged,

because solvers treat them as non-strict inequalities. Please

consider using “<=” instead.In cvx.lt at 21

## Calling SeDuMi 1.34: 6 variables, 3 equality constraints

SeDuMi 1.34 (beta) by AdvOL, 2005-2008 and Jos F. Sturm, 1998-2003.

Alg = 2: xz-corrector, Adaptive Step-Differentiation, theta = 0.250, beta = 0.500

eqs m = 3, order n = 6, dim = 7, blocks = 2

nnz(A) = 8 + 0, nnz(ADA) = 9, nnz(L) = 6

it : by gap delta rate t/tPt/tD* feas cg cg prec

0 : 1.07E+01 0.000

1 : 2.21E+00 3.10E+00 0.000 0.2887 0.9000 0.9000 1.23 1 1 2.6E+00

2 : 6.61E+01 2.80E-01 0.000 0.0902 0.9900 0.9900 -0.37 1 1 3.1E+00

3 : 3.65E+04 5.25E-04 0.046 0.0019 0.9990 0.9990 -0.93 1 1 3.1E+00

4 : 1.18E+07 1.35E-06 0.000 0.0026 0.9990 0.9990 -1.00 2 1 2.5E+00

5 : 1.49E+09 1.07E-08 0.000 0.0079 0.9990 0.9990 -1.00 3 3

Primal infeasible, dual improving direction found.

iter seconds |Ax| [Ay]_+ |x| |y|

5 0.0 0.0e+00 3.1e-10 0.0e+00 1.1e+00

## Detailed timing (sec)

Pre IPM Post

7.001E-03 3.200E-02 1.006E-03

Max-norms: ||b||=2, ||c|| = 1,

Cholesky |add|=0, |skip| = 1, ||L.L|| = 1.Status: Infeasible

Optimal value (cvx_optval): +Inf

disp(xs)

NaN

If you re-run your problem, but making the objective

`norm(y-As*xs,2)`

and without any constraints, then the optimal objective value will be the smallest value you can use on the right-hand-side of the constraint in your original problem for it to be feasible.

Is cvx working on complex domain?

You can read the CVX Users’ Guide http://cvxr.com/cvx/doc/ to learn about its support is for complex variables and numbers. There is support for the “complex domain”, but that support is not unlimited. There are many rules which must be followed.

Was my guess as to your problem being infeasible correct?

Yes. I change that to lasso form I got something. (with extra peak)

how should I use Landa in that ? 0.1 or 0.0001 or 5

In your opinion which formulation I should use in sparse recovery with cvx?

I found TFOCS I will try it and say the result.

I used Lasso formulation

min norm(y-As*x,2)^2

subject to norm(xs,1)<sparse order

But I see in

http://cvxr.com/tfocs/functions/

They define lasso in another way is it important?

When, I do Montcarlo I got NAN.