Bindings and Python interface for the MUMPS sparse solver
Project description
Python-MUMPS
Python bindings for the MUMPS: a parallel sparse direct solver.
Scope
This package targets MUMPS packaged by conda-forge using Cython bindings. It aims to provide a full wrapper of the MUMPS sequential API. Its primary target OS is Linux.
Next steps include:
- Support for Windows and OSX
- Support for distributed (MPI) MUMPS
Installation
python-mumps
works with Python 3.10 and higher on Linux, Windows and Mac.
The recommended way to install python-mumps
is using mamba
/conda
.
mamba install -c conda-forge python-mumps
python-mumps
can also be installed from PyPI, however this is a more involved procedure
that requires separately installing the MUMPS library and a C compiler.
Usage example
The following example shows how Python-MUMPS can be used to implement sparse diagonalization with Scipy.
import scipy.sparse.linalg as sla
from scipy.sparse import identity
import mumps
def sparse_diag(matrix, k, sigma, **kwargs):
"""Call sla.eigsh with mumps support.
See scipy.sparse.linalg.eigsh for documentation.
"""
class LuInv(sla.LinearOperator):
def __init__(self, A):
inst = mumps.Context()
inst.analyze(A, ordering='pord')
inst.factor(A)
self.solve = inst.solve
sla.LinearOperator.__init__(self, A.dtype, A.shape)
def _matvec(self, x):
return self.solve(x.astype(self.dtype))
opinv = LuInv(matrix - sigma * identity(matrix.shape[0]))
return sla.eigsh(matrix, k, sigma=sigma, OPinv=opinv, **kwargs)
Development
python-mumps
recommends Spin. Get spin with:
pip install spin
Then to build, test and install python-mumps
:
spin build
spin test -- --lf # (Pytest arguments go after --)
spin install
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for python_mumps-0.0.1a0-cp311-cp311-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 038b84724cb4ff734d04bec3624548c31bd69ac7cbbc8f19e2645bd5fe90d8bd |
|
MD5 | 5fea7d5ac8847fc8ca700b78e239a95c |
|
BLAKE2b-256 | 44bb9c7fddb235a2123aa3e26678af5e00b2ca8f45c54ba0007a8b256b0d9b51 |