# Reference Code for Positive Basis Pursuit Denoising

I am trying to reconstruct a positive sparse signal using compressed sensing (friedlanders code), I cannot find a way to impose the positivity constraint for this implementation. I have seen some papers discussing positive signals case but cannot find any code implementations, can anyone please point out to any relevant code.

• Does it matter which programming language? Python, Matlab, etc.? – Thomas Arildsen Nov 7 '17 at 5:21
• nope, anything is fine – Pavan Nov 8 '17 at 8:55
• Could you specify the problem itself? Is it the classic Basis Pursuit with Positivity Constraint of the solution? – Royi Apr 2 '18 at 14:47

SparseLab should be able to solve the positivity-constrained problem: http://sparselab.stanford.edu/

See Donoho & Tanner, "Precise Undersampling Theorems" for a definition of the problem.

This toolbox depends on Matlab.

• thank you very much, this is what I was looking for, esp. the non-negative fourier example – Pavan Nov 27 '17 at 16:37
• @Pavan you're welcome. Consider voting the answer up. – Thomas Arildsen Nov 28 '17 at 17:07

I assume you're after the following optimization problem:

\begin{align*} \arg \min_{x} \; & {\left\| x \right\|}_{1} \\ \text{subject to} \; & A x = b \\ & x \succeq 0 \end{align*}

This is pretty simple problem if we pay attention fo the fast that given $x \succeq 0$ then ${\left\| x \right\|}_{1} = \boldsymbol{1}^{T} x$.

This means the above problem is equivalent of:

\begin{align*} \arg \min_{x} \; & \boldsymbol{1}^{T} x \\ \text{subject to} \; & A x = b \\ & x \succeq 0 \end{align*}

Now, this is a Linear Programming problem which can be easily solved using MATLAB or any other solver.

For instance, in MATLAB it will be something like that:

numRows = 10;
numCols = 100;

mA = randn([numRows, numCols]);
vB = randn([numRows, 1]);

vE = ones([numCols, 1]); %<! Vector of ones to sum vX

vX = linprog(vE, [], [], mA, vB, zeros([numCols, 1]), inf([numCols, 1]));