python-mumps


Namepython-mumps JSON
Version 0.0.3 PyPI version JSON
download
home_pageNone
SummaryBindings and Python interface for the MUMPS sparse solver
upload_time2024-10-24 12:02:40
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseBSD 2-Clause License Copyright (c) 2018 Python-MUMPS Authors All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Python-MUMPS

Python bindings for the [MUMPS](http://mumps-solver.org/): 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`.

```bash
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.

```python
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

### Pixi

`python-mumps` recommends [pixi](https://pixi.sh/).

After installing pixi, use

```bash
pixi run test -v  # (Pytest arguments go after test)
```

This will also install the necessary dependencies.

### pre-commit

`python-mumps` uses [pre-commit](https://pre-commit.com/) to enforce code style. After installing it, run

```bash
pre-commit install
```

or if you want to use pre-commit provided by pixi, run

```bash
pixi run pre-commit install
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "python-mumps",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "Python-MUMPS authors <authors@kwant-project.org>",
    "download_url": "https://files.pythonhosted.org/packages/4a/fa/3e6bbb37d03fdff6b105c8f9b9f1051c5305a0c86dda85f23b2a02b95c35/python_mumps-0.0.3.tar.gz",
    "platform": null,
    "description": "# Python-MUMPS\n\nPython bindings for the [MUMPS](http://mumps-solver.org/): a parallel sparse direct solver.\n\n## Scope\n\nThis package targets MUMPS packaged by conda-forge using Cython bindings. It\naims to provide a full wrapper of the MUMPS sequential API. Its primary target\nOS is Linux.\n\nNext steps include:\n\n- Support for Windows and OSX\n- Support for distributed (MPI) MUMPS\n\n## Installation\n\n`python-mumps` works with Python 3.10 and higher on Linux, Windows and Mac.\n\nThe recommended way to install `python-mumps` is using `mamba`/`conda`.\n\n```bash\nmamba install -c conda-forge python-mumps\n```\n\n`python-mumps` can also be installed from PyPI, however this is a more involved procedure\nthat requires separately installing the MUMPS library and a C compiler.\n\n## Usage example\n\nThe following example shows how Python-MUMPS can be used to implement sparse diagonalization\nwith Scipy.\n\n```python\nimport scipy.sparse.linalg as sla\nfrom scipy.sparse import identity\nimport mumps\n\n\ndef sparse_diag(matrix, k, sigma, **kwargs):\n    \"\"\"Call sla.eigsh with mumps support.\n\n    See scipy.sparse.linalg.eigsh for documentation.\n    \"\"\"\n    class LuInv(sla.LinearOperator):\n        def __init__(self, A):\n            inst = mumps.Context()\n            inst.analyze(A, ordering='pord')\n            inst.factor(A)\n            self.solve = inst.solve\n            sla.LinearOperator.__init__(self, A.dtype, A.shape)\n\n        def _matvec(self, x):\n            return self.solve(x.astype(self.dtype))\n\n    opinv = LuInv(matrix - sigma * identity(matrix.shape[0]))\n    return sla.eigsh(matrix, k, sigma=sigma, OPinv=opinv, **kwargs)\n```\n\n## Development\n\n### Pixi\n\n`python-mumps` recommends [pixi](https://pixi.sh/).\n\nAfter installing pixi, use\n\n```bash\npixi run test -v  # (Pytest arguments go after test)\n```\n\nThis will also install the necessary dependencies.\n\n### pre-commit\n\n`python-mumps` uses [pre-commit](https://pre-commit.com/) to enforce code style. After installing it, run\n\n```bash\npre-commit install\n```\n\nor if you want to use pre-commit provided by pixi, run\n\n```bash\npixi run pre-commit install\n```\n",
    "bugtrack_url": null,
    "license": "BSD 2-Clause License  Copyright (c) 2018 Python-MUMPS Authors  All rights reserved.  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:  * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.  * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ",
    "summary": "Bindings and Python interface for the MUMPS sparse solver",
    "version": "0.0.3",
    "project_urls": {
        "homepage": "https://gitlab.kwant-project.org/kwant/python-mumps"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4afa3e6bbb37d03fdff6b105c8f9b9f1051c5305a0c86dda85f23b2a02b95c35",
                "md5": "6658f841a3ea21236d5743f5d948c6a7",
                "sha256": "bb10a6bb3fd1522ed5771b832f99ed0c590b2524d5ae672cbb1b7348634be550"
            },
            "downloads": -1,
            "filename": "python_mumps-0.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "6658f841a3ea21236d5743f5d948c6a7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 47593,
            "upload_time": "2024-10-24T12:02:40",
            "upload_time_iso_8601": "2024-10-24T12:02:40.846875Z",
            "url": "https://files.pythonhosted.org/packages/4a/fa/3e6bbb37d03fdff6b105c8f9b9f1051c5305a0c86dda85f23b2a02b95c35/python_mumps-0.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-24 12:02:40",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "python-mumps"
}
        
Elapsed time: 0.89551s