
Security News
OWASP 2025 Top 10 Adds Software Supply Chain Failures, Ranked Top Community Concern
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.
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.
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.
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.
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
The solver is based on the algorithms PTRANS-I and PTRANS-II presented by Askar et al. 2015.
You can find the documentation under https://pentapy.readthedocs.org.
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
In the following a couple of solvers for pentadiagonal systems are compared:
np.linalg.solvescipy.sparse.linalg.spsolvescipy.linalg.solve_bandedsolver=1solver=2
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.
You can contact us via info@geostat-framework.org.
MIT © 2019 - 2023
FAQs
pentapy: A toolbox for pentadiagonal matrizes.
We found that pentapy demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.