Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

High performance ℓ₁-minimization solvers

Project description

import sparsesolvers as ss
import numpy as np

N = 10

# Create an example sensing matrix
A = np.random.normal(loc=0.025, scale=0.025, size=(N, N)) + np.identity(N)

# An incoming signal
signal = np.zeros(N)
signal[2] = 1

# Use the homotopy solver to produce sparse solution, x.
x, info = ss.Homotopy(A).solve(signal, tolerance=0.1)

# Example output: error=0.064195, sparsity=0.9, argmax=2
print("error=%f, sparsity=%f, argmax=%i" % (
    info.solution_error, 1 - np.count_nonzero(x) / np.double(N),


  1. A. Y. Yang, Z. Zhou, A. Ganesh, S. S. Sastry, and Y. MaFast ℓ₁-minimization Algorithms For Robust Face Recognition – IEEE Trans. Image Processing, vol. 22, pp. 3234–3246, Aug 2013.
  2. R. Chartrand, W. YinIteratively Reweighted Algorithms For Compressive Sensing – Acoustics Speech and Signal Processing 2008. ICASSP 2008. IEEE International Conference, pp. 3869-3872, March 2008.
  3. D. O’LearyRobust Regression Computation Using Iteratively Reweighted Least Squares – Society for Industrial and Applied Mathematics, 1990

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for sparsesolvers, version 0.8.8
Filename, size File type Python version Upload date Hashes
Filename, size sparsesolvers-0.8.8-cp27-cp27mu-manylinux1_x86_64.whl (1.4 MB) File type Wheel Python version cp27 Upload date Hashes View hashes
Filename, size sparsesolvers-0.8.8-cp35-cp35m-manylinux1_x86_64.whl (1.4 MB) File type Wheel Python version cp35 Upload date Hashes View hashes
Filename, size sparsesolvers-0.8.8-cp36-cp36m-manylinux1_x86_64.whl (1.4 MB) File type Wheel Python version cp36 Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page