M. Bogdan, E. van den Berg, W. Su, and E.J. Candes
October 6, 2013

1. Introduction
---------------

This directory contains a Matlab and an R implementation for the
SLOPE formulation

  Minimize   1/2*||Ax-b||_2^2 + sum_i (lambda_i * |x|_[i])  (SL1)
       b

where |x|_[i] denotes the i-th largest entry in |x|. The entries
in lambda must be nonnegative and in non-increasing order. When
lambda is a scalar, the above formulation reduces to the Lasso:

   Minimize 1/2*||Ax-b||_2^2 + lambda * ||x||_1.
       b


2. Compiling
------------

In order to use the Matlab version of the solver (Adlas.m), it
is necessary to compile the Mex interface. The easiest way to
do this is to run the provided makemex script from Matlab. Make
sure that Matlab has access to a compiler. To setup a compiler
type 'mex -setup' from the Matlab command line.

To get the solver (Adlas.R) to work from R type the following
in the terminal window:

   R CMD SHLIB cproxSortedL1.c proxSortedL1.c

This should generate the cproxSortedL1.so file needed by the
solver.


3. Example script
-----------------

The scripts testAdlas.m and testAdlas.R load a matrix A and
vectors b and lambda and apply SLOPE (SL1).

--- Matlab ---

>> testAdlas
 Iter    ||r||_2         Gap    Infeas.   Rel. gap
    1   1.57e+01    0.00e+00   4.78e+01   0.00e+00
    2   4.20e+00   -5.96e+00   2.44e+01   1.11e+00
    3   9.36e-01   -3.61e+00   7.12e+00   1.32e+00
   ..
   72   8.89e-02   -2.48e-07   7.22e-06   1.27e-07
   73   8.89e-02   -9.07e-08   3.18e-07   4.62e-08
Exiting with status 1 -- Optimal

x =

   -0.7833
    0.0217
   -1.1356
         0
    0.0217
         0
         0
         0
         0
         0

--- R ---

> source('testAdlas.R')
 Iter    ||r||_2         Gap    Infeas.   Rel. gap
    1   1.57e+01    0.00e+00   4.78e+01   0.00e+00
    2   1.48e+00   -7.50e-01   1.97e+01   2.23e-01
    3   5.00e-01   -2.10e+00   4.66e+00   8.44e-01
   ..
   88   8.89e-02    2.22e-07   2.70e-06   1.13e-07
   89   8.89e-02    4.46e-08   2.38e-07   2.28e-08
Exiting with status 1 -- Optimal
             [,1]
 [1,] -0.78334637
 [2,]  0.02170683
 [3,] -1.13560148
 [4,]  0.00000000
 [5,]  0.02170683
 [6,]  0.00000000
 [7,]  0.00000000
 [8,]  0.00000000
 [9,]  0.00000000
[10,]  0.00000000

