Skip to content

Commit

Permalink
[py] convert README to rst due to
Browse files Browse the repository at this point in the history
  • Loading branch information
rayglover-ibm committed May 26, 2018
1 parent 0088a36 commit f076a14
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 24 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required (VERSION 3.2)
cmake_policy (SET CMP0048 NEW) # project versioning

project (core LANGUAGES C CXX VERSION 0.8.3)
project (core LANGUAGES C CXX VERSION 0.8.4)

set (CMAKE_CXX_STANDARD 14)
set (CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down
51 changes: 30 additions & 21 deletions bindings/python/README.in
Original file line number Diff line number Diff line change
@@ -1,31 +1,40 @@
#${ss}
${ss}
-------

```python
import sparsesolvers as ss
import numpy as np
.. code:: python

N = 10
import sparsesolvers as ss
import numpy as np

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

# An incoming signal
signal = np.zeros(N)
signal[2] = 1
# Create an example sensing matrix
A = np.random.normal(loc=0.025, scale=0.025, size=(N, N)) + np.identity(N)

# Use the homotopy solver to produce sparse solution, x.
x, info = ss.Homotopy(A).solve(signal, tolerance=0.1)
# An incoming signal
signal = np.zeros(N)
signal[2] = 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),
np.argmax(x)))
```
# Use the homotopy solver to produce sparse solution, x.
x, info = ss.Homotopy(A).solve(signal, tolerance=0.1)

## References
# 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),
np.argmax(x)))

1. _A. Y. Yang, Z. Zhou, A. Ganesh, S. S. Sastry, and Y. Ma_ – __Fast ℓ₁-minimization Algorithms For Robust Face Recognition__ – IEEE Trans. Image Processing, vol. 22, pp. 3234–3246, Aug 2013.
References
----------

2. _R. Chartrand, W. Yin_ – __Iteratively Reweighted Algorithms For Compressive Sensing__ – Acoustics Speech and Signal Processing 2008. ICASSP 2008. IEEE International Conference, pp. 3869-3872, March 2008.
1. *A. Y. Yang, Z. Zhou, A. Ganesh, S. S. Sastry, and Y. Ma* – **Fast
ℓ₁-minimization Algorithms For Robust Face Recognition** – IEEE
Trans. Image Processing, vol. 22, pp. 3234–3246, Aug 2013.

3. _D. O’Leary_ – __Robust Regression Computation Using Iteratively Reweighted Least Squares__ – Society for Industrial and Applied Mathematics, 1990
2. *R. Chartrand, W. Yin* – **Iteratively Reweighted Algorithms For
Compressive Sensing** – Acoustics Speech and Signal Processing 2008.
ICASSP 2008. IEEE International Conference, pp. 3869-3872, March
2008.

3. *D. O’Leary* – **Robust Regression Computation Using Iteratively
Reweighted Least Squares** – Society for Industrial and Applied
Mathematics, 1990
3 changes: 1 addition & 2 deletions bindings/python/setup.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ setup(
'Topic :: Software Development :: Libraries :: Python Modules',
],

long_description=readme_text,
long_description_content_type='text/markdown',
long_description = readme_text,

packages = ['${ss}'],
package_dir={'${ss}':'${ss}'},
Expand Down

0 comments on commit f076a14

Please sign in to comment.