PyPardiso is a python package to solve large sparse linear systems of equations with the Intel oneAPI Math Kernel Library PARDISO solver, a shared-memory multiprocessing parallel direct sparse solver.
PyPardiso provides the same functionality as SciPy's 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 and it also doesn't currently support complex numbers. Check out JuliaSparse/Pardiso.jl for these more advanced use cases.
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.
How to solve the sparse linear system
A is a square, sparse matrix in CSR (or CSC) format and
b is a vector (or matrix):
In : import pypardiso In : import numpy as np In : import scipy.sparse as sp In : A = sp.rand(10, 10, density=0.5, format='csr') In : A Out: <10x10 sparse matrix of type '<class 'numpy.float64'>' with 50 stored elements in Compressed Sparse Row format> In : b = np.random.rand(10) In : x = pypardiso.spsolve(A, b) In : x Out: array([ 0.02918389, 0.59629935, 0.33407289, -0.48788966, 3.44508841, 0.52565687, -0.48420646, 0.22136413, -0.95464127, 0.58297397])