https://github.com/haasad/PyPardisoProject
Python interface to the Intel MKL Pardiso library to solve large sparse linear systems of equations
https://github.com/haasad/PyPardisoProject
Last synced: 3 months ago
JSON representation
Python interface to the Intel MKL Pardiso library to solve large sparse linear systems of equations
- Host: GitHub
- URL: https://github.com/haasad/PyPardisoProject
- Owner: haasad
- License: bsd-3-clause
- Created: 2016-09-13T13:06:59.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2024-04-06T09:40:32.000Z (about 1 year ago)
- Last Synced: 2024-05-21T21:14:25.670Z (about 1 year ago)
- Language: Python
- Homepage:
- Size: 787 KB
- Stars: 125
- Watchers: 8
- Forks: 19
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-oneapi - PyPardisoProject - Pypardiso is a Python package for solving large sparse linear systems of equations using the Intel oneAPI Math Kernel Library Pardiso solver. It provides the same functionality as Scipy's spsolve but is faster in many cases. (Table of Contents / Mathematics and Science)
README
[](https://github.com/haasad/PyPardisoProject/actions/workflows/tests.yaml)
# PyPardisoPyPardiso is a python package to solve large sparse linear systems of equations with the [Intel oneAPI Math Kernel Library PARDISO solver](https://www.intel.com/content/www/us/en/develop/documentation/onemkl-developer-reference-fortran/top/sparse-solver-routines/onemkl-pardiso-parallel-direct-sparse-solver-iface.html), a shared-memory multiprocessing parallel direct sparse solver.
PyPardiso provides the same functionality as SciPy's [scipy.sparse.linalg.spsolve](https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.linalg.spsolve.html#scipy.sparse.linalg.spsolve) for solving the sparse linear system `Ax=b`. However in many cases it is significantly faster than SciPy's built-in single-threaded SuperLU solver.
PyPardiso is not a python interface to the PARDISO Solver from the [PARDISO 7.2 Solver Project](https://www.pardiso-project.org/) and it also doesn't currently support complex numbers. Check out [JuliaSparse/Pardiso.jl](https://github.com/JuliaSparse/Pardiso.jl/) for these more advanced use cases.
## Installation
PyPardiso runs on Linux, Windows and MacOS. It can be installed with __conda__ or __pip__. It is recommended to install PyPardiso using a virtual environment.
conda-forge | PyPI
:---:|:---:
[](https://anaconda.org/conda-forge/pypardiso) | [](https://pypi.org/project/pypardiso/)
`conda install -c conda-forge pypardiso` | `pip install pypardiso`## Basic usage
How to solve the sparse linear system `Ax=b` for `x`, where `A` is a square, sparse matrix in CSR (or CSC) format and `b` is a vector (or matrix):
```python
In [1]: import pypardisoIn [2]: import numpy as np
In [3]: import scipy.sparse as sp
In [4]: A = sp.rand(10, 10, density=0.5, format='csr')
In [5]: A
Out[5]:
<10x10 sparse matrix of type ''
with 50 stored elements in Compressed Sparse Row format>In [6]: b = np.random.rand(10)
In [7]: x = pypardiso.spsolve(A, b)
In [8]: x
Out[8]:
array([ 0.02918389, 0.59629935, 0.33407289, -0.48788966, 3.44508841,
0.52565687, -0.48420646, 0.22136413, -0.95464127, 0.58297397])
```