Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_mumps-0.0.1.post1.tar.gz (19.1 kB view details)

Uploaded Source

Built Distribution

python_mumps-0.0.1.post1-cp311-cp311-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (18.4 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.12+ x86-64

File details

Details for the file python_mumps-0.0.1.post1.tar.gz.

File metadata

  • Download URL: python_mumps-0.0.1.post1.tar.gz
  • Upload date:
  • Size: 19.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for python_mumps-0.0.1.post1.tar.gz
Algorithm Hash digest
SHA256 58bf081147c7a4c8fb80ca30a5f5008bd816bc6349fd969edad8dda058648bdb
MD5 566045cba30a8d7e7533dc69363ffb29
BLAKE2b-256 5616a50d1a5f2ba11ce9a2ddf6f14f96418e14037270e98497c5be901ddfda1b

See more details on using hashes here.

File details

Details for the file python_mumps-0.0.1.post1-cp311-cp311-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for python_mumps-0.0.1.post1-cp311-cp311-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 f5fda249cdc02b08af9941a22a825a443e8866484d3c134b5f2ca954c581b6a4
MD5 6befafc7ca61036c33d729d66d57bf20
BLAKE2b-256 70df671a5baa5f70e3985aafe5a9ff2dd46fe0f64cfd3522e69678f7e161511a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page