Skip to main content

pypardiso-tests

PyPardiso

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.

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
conda-forge version PyPI version
conda install -c conda-forge pypardiso pip install pypardiso

Test complex numbers

import pypardiso
import numpy as np
import scipy.sparse as sp
from scipy.sparse.linalg import spsolve

A = sp.rand(10, 10, density=0.5, format='csr')
b = np.random.rand(10)
#x = pypardiso.spsolve(A, b)
x = pypardiso.spsolve(A, b, solver=pypardiso.PyPardisoSolver(mtype=pypardiso.Matrix_type.RNS))
print(x)
A = A.astype(np.cdouble)
b=b.astype(np.cdouble)
x = pypardiso.spsolve(A, b, solver=pypardiso.PyPardisoSolver(mtype=pypardiso.Matrix_type.CNS))
print(x)


A = sp.rand(10, 10, density=0.5, format='csr',dtype=np.cdouble)
x = pypardiso.spsolve(A, b, solver=pypardiso.PyPardisoSolver(mtype=pypardiso.Matrix_type.CNS))
print(x)

x1 = spsolve(A, b)
print(x1)

print(np.max(np.abs(x-x1)))

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):

In [1]: import pypardiso

In [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 '<class 'numpy.float64'>'
	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])

Metadata

Release files for pypardiso-mopt 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pypardiso-mopt 0.1.0
File Size Uploaded Provenance Actions
pypardiso_mopt-0.1.0.tar.gz 8.9 kB Without provenance Details for pypardiso_mopt-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pypardiso-mopt 0.1.0
File Interpreter ABI Platform Actions
pypardiso_mopt-0.1.0-py3-none-any.whl Python 3 none any Details for pypardiso_mopt-0.1.0-py3-none-any.whl

Total release size: 19.0 kB

Release files / pypardiso_mopt-0.1.0.tar.gz

Download URL pypardiso_mopt-0.1.0.tar.gz
Size 8.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d21dcaedcfa46454664053043d89867df270139255bb63741749ccc55f067074
BLAKE2b-256 checksum
How to use checksums
b53ea6884c3ca7980aae6d8ca24e52d0431d7ffdb115bf5cfda7f3aaaefbfe88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.11.2 Windows/10

Release files / pypardiso_mopt-0.1.0-py3-none-any.whl

Download URL pypardiso_mopt-0.1.0-py3-none-any.whl
Size 10.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
daf61d8402268e06924b409285ee00bda5510b8c9c826f856bfd26c46a64b667
BLAKE2b-256 checksum
How to use checksums
39371586e380e93eeb7949e1b8b66e95e21b79d0fd365261e4347690fa41b12d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.11.2 Windows/10

Security for pypardiso-mopt 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page