Skip to main content

Accelerated sparse representations and compressive sensing

Project description

Documentation Status Unit Tests Coverage

An overview of the library.

This library aims to provide XLA/JAX based Python implementations for various algorithms related to:

  • Sparse approximation

  • Compressive sensing

  • Dictionary learning

The library also provides

  • Various simple dictionaries and sensing matrices

  • Sample data generation utilities

  • Framework for evaluation of sparse recovery algorithms

Example usage

A greedy pursuit based sparse recovery with synthetic data

Build a Gaussian dictionary/sensing matrix:

from jax import random
import cr.sparse.dict as crdict
M = 128
N = 256
key = random.PRNGKey(0)
Phi = crdict.gaussian_mtx(key, M,N)

Build a K-sparse signal with Gaussian non-zero entries:

import cr.sparse.data as crdata
import jax.numpy as jnp
K = 16
key, subkey = random.split(key)
x, omega = crdata.sparse_normal_representations(key, N, K, 1)
x = jnp.squeeze(x)

Build the measurement vector:

y = Phi @ x

Import the Compressive Sampling Matching Pursuit sparse recovery solver:

from cr.sparse.pursuit import cosamp

Solve the recovery problem:

solution =  cosamp.matrix_solve(Phi, y, K)

For the complete set of available solvers, see the documentation.

Citing CR.Sparse

To cite this repository:

@software{crsparse2021github,
author = {Shailesh Kumar},
title = {{CR.Sparse}: XLA Accelerated Functional Models and Algorithms for Sparse Representations based Signal Processing},
url = {https://cr-sparse.readthedocs.io/en/latest/},
version = {0.1.5},
year = {2021},
}

Documentation | Code | Issues | Discussions | Examples | Experiments | Sparse-Plex

Project details


Download files

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

Source Distribution

cr-sparse-0.1.5.tar.gz (161.6 kB view hashes)

Uploaded Source

Built Distribution

cr_sparse-0.1.5-py3-none-any.whl (226.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page