We provide Matlab and R scripts for solving the SLOPE formulation:

Unpacking with create a directory called ‘SLOPE_code’ in the current directory. Both version of the solver depend on a C code for the fast prox evaluation, and the suitable interface to this C code must be compiled prior to use. In Matlab this is done by running the makemex script from the Matlab command line; for R the interface ( can be compiled from a terminal window by typing the following command in the SLOPE_code directory:

R CMD SHLIB cproxSortedL1.c proxSortedL1.c

Examples of the use of the solvers are found in testAdlas.m and testAdlas.R. More detailed information can be found in the README file included with the source code.

TFOCS Implementation

SLOPE is also included in TFOCS. When used with default options the following command can be used:

beta = solver_SLOPE( X, y, lambda);

For more control it is possible to instantiate the prox function and call the general TFOCS solver using

prox = prox_Sl1(lambda);

beta = tfocs( smooth_quad, { X, -y }, prox, beta0, opts );

Figures and tables

The scripts for Figures 1–9 were written in R and are available here:

Plots are generated using the scripts in the R directory. The input data required for these scripts are generated by the Matlab scripts in the scripts directory, and are stored in the data directory. The setup.m script helps set up all required paths for Matlab, except for the SLOPE solver itself, which should be added manually.

Code for the generation of the remaining figures and tables can be found here:

All of these figures and tables are generated from Matlab and are made available through the generateFigure and generateTable scripts in the FiguresAndTables directory. In order to run them, make sure to first run setup from the same directory. Once that is done, simply type


to generate Figure 12 from the paper, for example.

The source package comes with pre-computed results. Any of these can be deleted and regenerated when needed (note that regeneration can take a considerable amount of time). For this to work, also make sure to add the SLOPE solver to the search path. In addition the Spot linear-operator toolbox needs to be available.


  • [1] S. Becker, E. J. Cand├Ęs and M. Grant, “Templates for convex cone problems with applications to sparse signal recovery,” Mathematical Programming Computation, Volume 3, Number 3, August 2011.

  • [2] E. van den Berg and M.P. Friedlander, Spot – A Linear Operator Toolbox,

  • [3] M. Guerquin-Kern, L. Lejeune, K.P. Pruessmann, and M. Unser, “Realistic Analytical Phantoms for Parallel Magnetic Resonance Imaging,” IEEE Transactions on Medical Imaging, Volume 31, Number 3, pp. 626-636, March 2012.

  • [4] Matthieu Guerquin-Kern, et al.,