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.

  • $\begingroup$ Does it matter which programming language? Python, Matlab, etc.? $\endgroup$ Nov 7 '17 at 5:21
  • $\begingroup$ nope, anything is fine $\endgroup$
    – Pavan
    Nov 8 '17 at 8:55
  • $\begingroup$ @Pavan, Could you mark my question? $\endgroup$
    – Royi
    Mar 2 '20 at 14:06

SparseLab should be able to solve the positivity-constrained problem: SparseLab (Stanford) - Seeking Sparse Solutions to Linear System of Equations.

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

This toolbox depends on Matlab.

  • $\begingroup$ thank you very much, this is what I was looking for, esp. the non-negative fourier example $\endgroup$
    – Pavan
    Nov 27 '17 at 16:37
  • $\begingroup$ @Pavan you're welcome. Consider voting the answer up. $\endgroup$ 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 LP 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]));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.