Skip to content

Commit

Permalink
Link to docs from README
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashwin Srinath committed Jul 8, 2018
1 parent a57a0cb commit 844b01a
Showing 1 changed file with 2 additions and 77 deletions.
79 changes: 2 additions & 77 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,80 +2,5 @@

[![Documentation Status](http://readthedocs.org/projects/pyamgx/badge/?version=latest)](http://pyamgx.readthedocs.io/en/latest/?badge=latest)

## Example usage

See `demo.py` for the full example.

```python
# Create matrices and vectors:
A = pyamgx.Matrix().create(rsc)
x = pyamgx.Vector().create(rsc)
b = pyamgx.Vector().create(rsc)

# Create solver:
solver = pyamgx.Solver().create(rsc, cfg)

# Upload system:
M = sparse.csr_matrix(np.random.rand(5, 5))
rhs = np.random.rand(5)
sol = np.zeros(5, dtype=np.float64)

A.upload_CSR(M)
b.upload(rhs)
x.upload(sol)

# Setup and solve:
solver.setup(A)
solver.solve(b, x)

# Download solution
x.download(sol)
print("pyamgx solution: ", sol)
print("scipy solution: ", splinalg.spsolve(M, rhs))
```

```
pyamgx solution: [-0.52114365 0.72874012 0.17712795 1.37890116 -1.03672993]
scipy solution: [-0.52114365 0.72874012 0.17712795 1.37890116 -1.03672993]
```

## Installation

### Requirements:

1. [AMGX](https://github.com/NVIDIA/AMGX)
1. [SciPy](https://www.scipy.org/scipylib/download.html)
1. [Cython](http://cython.org/)


### Install:

1. Set the environment variable `AMGX_DIR` to the AMGX root directory.

2. Clone this repository:

```bash
$ git clone https://github.com/shwina/pyamgx
```

3. Build and install `pyamgx`:

```bash
$ cd pyamgx
$ python setup.py build_ext
$ pip install .
```

**Note:** If you do not have administrative priveleges
and if you are *not* installing inside a virtualenv or conda environment,
replace the last command above with:

```bash
$ pip install . --user
```

4. Run the demo:

```
$ python demo.py
```
For installation instructions, overview and examples, see the
[documentation](pyamgx.readthedocs.io).

0 comments on commit 844b01a

Please sign in to comment.