Skip to main content

pentapy: A toolbox for pentadiagonal matrizes.

Project description

Welcome to pentapy

status DOI PyPI version Build Status Coverage Status Documentation Status Code style: black

pentapy-LOGO

Purpose

pentapy is a toolbox to deal with pentadiagonal matrices in Python.

Pentadiagonal linear equation systems arise in many areas of science and engineering: e.g. when solving differential equations, in interpolation problems, or in numerical schemes like finite difference.

Installation

The package can be installed via pip. On Windows you can install WinPython to get Python and pip running.

pip install pentapy

There are pre-built wheels for Linux, MacOS and Windows for most Python versions (2.7, 3.4-3.7).

If your system is not supported and you want to have the Cython routines of pentapy installed, you have to provide a c-compiler and run:

pip install numpy cython
pip install pentapy

To get the scipy solvers running, you have to install scipy or you can use the following extra argument:

pip install pentapy[all]

Instead of "all" you can also typ "scipy" or "umfpack" to get one of these specific packages.

Citation

If you use pentapy in your publication, please cite it:

Müller, (2019). pentapy: A Python toolbox for pentadiagonal linear systems. Journal of Open Source Software, 4(42), 1759, https://doi.org/10.21105/joss.01759

To cite a certain release, have a look at the Zenodo site: https://doi.org/10.5281/zenodo.2587158

References

The solver is based on the algorithms PTRANS-I and PTRANS-II presented by Askar et al. 2015.

Documentation and Examples

You can find the documentation under https://pentapy.readthedocs.org.

Solving a pentadiagonal linear equation system

This is an example of how to solve a LES with a pentadiagonal matrix.

import numpy as np
import pentapy as pp

size = 1000
# create a flattened pentadiagonal matrix
M_flat = (np.random.random((5, size)) - 0.5) * 1e-5
V = np.random.random(size) * 1e5
# solve the LES with M_flat as row-wise flattened matrix
X = pp.solve(M_flat, V, is_flat=True)

# create the corresponding matrix for checking
M = pp.create_full(M_flat, col_wise=False)
# calculate the error
print(np.max(np.abs(np.dot(M, X) - V)))

This should give something like:

4.257890395820141e-08

Performance

In the following a couple of solvers for pentadiagonal systems are compared:

Performance

The implementations of pentapy are almost one order of magnitude faster than the scipy algorithms for banded or sparse matrices.

The performance plot was created with perfplot. Have a look at the script: examples/03_perform_simple.py.

Requirements:

Optional

Contact

You can contact us via info@geostat-framework.org.

License

MIT © 2019 - 2021

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

pentapy-1.1.1.tar.gz (299.7 kB view hashes)

Uploaded Source

Built Distributions

pentapy-1.1.1-cp39-cp39-win_amd64.whl (204.6 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

pentapy-1.1.1-cp39-cp39-win32.whl (191.1 kB view hashes)

Uploaded CPython 3.9 Windows x86

pentapy-1.1.1-cp39-cp39-manylinux2010_x86_64.whl (503.2 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

pentapy-1.1.1-cp39-cp39-manylinux2010_i686.whl (482.4 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.12+ i686

pentapy-1.1.1-cp39-cp39-manylinux1_x86_64.whl (503.2 kB view hashes)

Uploaded CPython 3.9

pentapy-1.1.1-cp39-cp39-manylinux1_i686.whl (482.4 kB view hashes)

Uploaded CPython 3.9

pentapy-1.1.1-cp39-cp39-macosx_10_9_x86_64.whl (206.7 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

pentapy-1.1.1-cp38-cp38-win_amd64.whl (204.5 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

pentapy-1.1.1-cp38-cp38-win32.whl (191.1 kB view hashes)

Uploaded CPython 3.8 Windows x86

pentapy-1.1.1-cp38-cp38-manylinux2010_x86_64.whl (517.2 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

pentapy-1.1.1-cp38-cp38-manylinux2010_i686.whl (497.4 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.12+ i686

pentapy-1.1.1-cp38-cp38-manylinux1_x86_64.whl (517.2 kB view hashes)

Uploaded CPython 3.8

pentapy-1.1.1-cp38-cp38-manylinux1_i686.whl (497.4 kB view hashes)

Uploaded CPython 3.8

pentapy-1.1.1-cp38-cp38-macosx_10_9_x86_64.whl (205.0 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

pentapy-1.1.1-cp37-cp37m-win_amd64.whl (203.3 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

pentapy-1.1.1-cp37-cp37m-win32.whl (190.1 kB view hashes)

Uploaded CPython 3.7m Windows x86

pentapy-1.1.1-cp37-cp37m-manylinux2010_x86_64.whl (474.0 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

pentapy-1.1.1-cp37-cp37m-manylinux2010_i686.whl (455.1 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.12+ i686

pentapy-1.1.1-cp37-cp37m-manylinux1_x86_64.whl (474.0 kB view hashes)

Uploaded CPython 3.7m

pentapy-1.1.1-cp37-cp37m-manylinux1_i686.whl (455.1 kB view hashes)

Uploaded CPython 3.7m

pentapy-1.1.1-cp37-cp37m-macosx_10_9_x86_64.whl (205.4 kB view hashes)

Uploaded CPython 3.7m macOS 10.9+ x86-64

pentapy-1.1.1-cp36-cp36m-win_amd64.whl (203.3 kB view hashes)

Uploaded CPython 3.6m Windows x86-64

pentapy-1.1.1-cp36-cp36m-win32.whl (190.1 kB view hashes)

Uploaded CPython 3.6m Windows x86

pentapy-1.1.1-cp36-cp36m-manylinux2010_x86_64.whl (474.8 kB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

pentapy-1.1.1-cp36-cp36m-manylinux2010_i686.whl (454.6 kB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.12+ i686

pentapy-1.1.1-cp36-cp36m-manylinux1_x86_64.whl (474.8 kB view hashes)

Uploaded CPython 3.6m

pentapy-1.1.1-cp36-cp36m-manylinux1_i686.whl (454.6 kB view hashes)

Uploaded CPython 3.6m

pentapy-1.1.1-cp36-cp36m-macosx_10_9_x86_64.whl (205.3 kB view hashes)

Uploaded CPython 3.6m macOS 10.9+ x86-64

pentapy-1.1.1-cp35-cp35m-win_amd64.whl (201.9 kB view hashes)

Uploaded CPython 3.5m Windows x86-64

pentapy-1.1.1-cp35-cp35m-win32.whl (189.1 kB view hashes)

Uploaded CPython 3.5m Windows x86

pentapy-1.1.1-cp35-cp35m-manylinux2010_x86_64.whl (467.6 kB view hashes)

Uploaded CPython 3.5m manylinux: glibc 2.12+ x86-64

pentapy-1.1.1-cp35-cp35m-manylinux2010_i686.whl (449.1 kB view hashes)

Uploaded CPython 3.5m manylinux: glibc 2.12+ i686

pentapy-1.1.1-cp35-cp35m-manylinux1_x86_64.whl (467.6 kB view hashes)

Uploaded CPython 3.5m

pentapy-1.1.1-cp35-cp35m-manylinux1_i686.whl (449.1 kB view hashes)

Uploaded CPython 3.5m

pentapy-1.1.1-cp35-cp35m-macosx_10_9_x86_64.whl (202.4 kB view hashes)

Uploaded CPython 3.5m macOS 10.9+ x86-64

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