pentapy: A toolbox for pentadiagonal matrizes.
Project description
Welcome to pentapy
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.
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 geostat-framework.readthedocs.io.
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:
- Solver 1: Standard linear algebra solver of Numpy
np.linalg.solve
- Solver 2:
scipy.sparse.linalg.spsolve
- Solver 3: Scipy banded solver
scipy.linalg.solve_banded
- Solver 4: pentapy.solve with
solver=1
- Solver 5: pentapy.solve with
solver=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/04_perform_simple.py
.
Requirements:
Optional
Contact
You can contact us via info@geostat-framework.org.
License
MIT © 2019
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 Distributions
Hashes for pentapy-1.0.2-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e18b1a512dbf6a531024bb1436511c8723fad34bc71ce523290b676bec22c6e |
|
MD5 | 1c05b7f13127a7214874186662e01ab8 |
|
BLAKE2b-256 | 0f80fad328fe4c64ec6669a4e44cea0296a34134e5a27ed083ef6da60bb10123 |
Hashes for pentapy-1.0.2-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b6d6fb09631a935b79d13347ba823508cb475faa64f89378a193232dbe78ed7d |
|
MD5 | 5e3fe29dfec5761edc94c2bb3ef9cc7b |
|
BLAKE2b-256 | 46682854c11a747bc95e1bbbc55a0ea4a38db5d74c3cf3699a095503cbf1f7e9 |
Hashes for pentapy-1.0.2-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e104cd5a99497f6760a83665fae7148f1628226d3f4c7113983d8664dd6c2fb |
|
MD5 | 7fdd079b11fd3120032d3ccc29dbe18a |
|
BLAKE2b-256 | 3e3a62b9db61030ed12f2cc89a9d528ee2573b4047f5f30661dd74284cddcbb1 |
Hashes for pentapy-1.0.2-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65f66d38a9a0e7e860d89351368ec782ad1619300562d3e50bcf91f0c0ab1d42 |
|
MD5 | 8bc36fed21708d1a624f609b7c9d20ce |
|
BLAKE2b-256 | 34b5b2a5638cac469e1e7ff458c98f3273dec5b4d85670478952cd484ef77215 |
Hashes for pentapy-1.0.2-cp37-cp37m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0ef1f24c060fdbef1a142ff674690b0e8a33693a70ad1321d643ff3172ddf78 |
|
MD5 | bb6cd7a61597e760fbaba7cd1cfc0e4b |
|
BLAKE2b-256 | 81972973ee1120e0be6060abf607bf99cf6216dd2331bf2707e91471ce3b4f6a |
Hashes for pentapy-1.0.2-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a35a7bb84ce3049f74472bccc9eb544d7e8533223cae127b9346299ff21ac2df |
|
MD5 | 31eee893024bcc9bd031901a70aa268c |
|
BLAKE2b-256 | d6e265bea05b3695ca2fc186759cf9c37859e2c46ed30ba6ccc56c352722467e |
Hashes for pentapy-1.0.2-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16ebc7c1e7f7ec8cc6c4edac60378af8ed5f4ce1b68f455847fd3b413b00a624 |
|
MD5 | e28330bd31a89250bb9a9ff61099db28 |
|
BLAKE2b-256 | abb62536d87020c397d937bc39bdc3486758f030976f4553e9f1262abab156d3 |
Hashes for pentapy-1.0.2-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 499b0e3f09818eff5581246712cc2b513c0a233b495ec5ed9b812f41cf139e34 |
|
MD5 | a5c62bbc43e6f44e7fe7dc29c4fc0899 |
|
BLAKE2b-256 | b79e1c8be50204ec3239bbea7e87b93a5066c329f298e220506a27efc4894a3d |
Hashes for pentapy-1.0.2-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7dcffe81fe23dae680a2586fd6505b067c0a57ab0a99f02ad9aff20ab850fa32 |
|
MD5 | 8c6edce5d2651b0e5f3a1de3912abdf9 |
|
BLAKE2b-256 | 863ff5d93f90c04a1195459ff64fadadd02232437db34083cce0fdbc6774839b |
Hashes for pentapy-1.0.2-cp36-cp36m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bea29429eee7e3182b2a6e41f8efb62991c81edaff8c184aa59f7dd0035353ed |
|
MD5 | 7f287b28a5678916480d286224fd8def |
|
BLAKE2b-256 | 5e818a04eef7414dd55468702608d08766c3d41a6245526242636635180148a7 |
Hashes for pentapy-1.0.2-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36892a969d5ab58d44bdaf720ceb1c5f60e8caf91141184e307dc3022a3d49ff |
|
MD5 | 6843b52da215c8d0d64e6f6c77cc4060 |
|
BLAKE2b-256 | ffc4fcd630d3a8c9ef42c32cb561523bde62b0ff9cb3112957a2d09ba6f71d82 |
Hashes for pentapy-1.0.2-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e520abfd7226872b19413d242a547fe8e7b45ee3ea9f759df2395fc6ffd2170 |
|
MD5 | c47a337c339d24aee726a4dc614a17ef |
|
BLAKE2b-256 | d71fa83d641e49034bba9bece5015868b8d10ae0c558269b295ce308bf080849 |
Hashes for pentapy-1.0.2-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 238c948e9a51aa62b6e844b6512d95df1cc9717f75d344c5e6d7758b9d8a339c |
|
MD5 | 0ea183d91324039d0a63a1c567890c3c |
|
BLAKE2b-256 | c84505aa00e1781b5509f7d8c9e5b90344ce77ec0632f3c0f8bf5431d62bd7af |
Hashes for pentapy-1.0.2-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | afa7bf0ee18531176ade17b1284e0cce1f0bb1b3a6c8e651d44a140d0ce88c75 |
|
MD5 | 1090971bb0e5708af125b9fbadfe7bda |
|
BLAKE2b-256 | 1a03e2293a412e6e8fd6eb6ff7601f05ae5911edf0abf2ffedaaee7c55675bc1 |
Hashes for pentapy-1.0.2-cp35-cp35m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f15eebf92480401fcb8ca80f6560a7388db0ebb23acd018aa448b5ed3ca2308 |
|
MD5 | c2b7a2197ac79a5154173d307482c176 |
|
BLAKE2b-256 | bec61e33abd919ea67802f23562c9ec550eda3e67184bd400111ab3f5bb5c2dc |
Hashes for pentapy-1.0.2-cp34-cp34m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f22c24f9820c2c320da8897f046b55416980a8ba3175a69bb61b89f475fa577f |
|
MD5 | c89bb027aeb7b443f195f1cb12ed25a0 |
|
BLAKE2b-256 | cae040589b0ceb26188fc658522054be0ea0709c00b2dc4563cb4f98e6f17717 |
Hashes for pentapy-1.0.2-cp34-cp34m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 309ccc29276c7295fd6deb80370de0fcf711db07df2722f20ca5934abfaad7ad |
|
MD5 | f0c2b6e5d00aa0a873fdf75dc1a8d201 |
|
BLAKE2b-256 | 3873b4256f59c68c4c16647ed03fa16a3cbb71958c48d5397cc17b7e44a42dff |
Hashes for pentapy-1.0.2-cp34-cp34m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0617042c20435ea9401e88cdd63d5e2db302cccbc98efe385041fa66402b79f |
|
MD5 | 438e128b91df067fe2268f300eb75637 |
|
BLAKE2b-256 | b9a030dacde0a2856419b716452480a1b88b6d7f275ffa10baa43e1d405bc5e5 |
Hashes for pentapy-1.0.2-cp34-cp34m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f3645c99b2fc27b2ba483e484cd38043b7b40d8447b7fec5f512074354dea71 |
|
MD5 | bbc24dfa51823d78a7697feffa7d79fb |
|
BLAKE2b-256 | c6566b8cd702e4b83601a3f2291a82abcd78d859628744ff8e58c51218426230 |
Hashes for pentapy-1.0.2-cp34-cp34m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d4f05e329f1cec9b443060974b61b58fdb31daacbc6e5ae008684f678d19273 |
|
MD5 | 2a67cb374e7ed088efd107dc3d526912 |
|
BLAKE2b-256 | d70d54dedacbc7cf1ddf4d271e50ae6cd3b4c011b67a4fe013d7d070f3f0d96b |
Hashes for pentapy-1.0.2-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7829990a2ca2a4d7bbb0d3d590908a8cff6e53203aaf7eafe19b2099a7512e9 |
|
MD5 | 71ce67583d3fc710293b12205e2d8aad |
|
BLAKE2b-256 | cf64a78be30009557f5b37f2f5821e6d85f0ab025fa63f2d3b617be7fc3f53a9 |
Hashes for pentapy-1.0.2-cp27-cp27mu-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb2ee3d85e336a2d2b1f6108af0e661c294d15920ab9b9d6333595e9c22b4e92 |
|
MD5 | ef554737431f6b1001e95e0bb876eef9 |
|
BLAKE2b-256 | 8f7fe4cf2a2117922113b7cdb0981da64e8cc59f78ace5663ff6dacf9f4aaa53 |
Hashes for pentapy-1.0.2-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a413b7556b29b8f17c1324aae82fd979074ddb9e533d22bbf8b5ffb0e8c22289 |
|
MD5 | a1c98df954c25d5fd207903aa3d49bbd |
|
BLAKE2b-256 | cc38b8afc61c59030b6f7f29fd87a66b4397e2e662dde10af98aa6a4c59ef520 |
Hashes for pentapy-1.0.2-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65019154a485d562a36059261941acc41794b4dcee17ee6aaf6c86572e2298f2 |
|
MD5 | d2acc05a4a6547d2f4dfecfccac8db33 |
|
BLAKE2b-256 | 298f7d97d5887760e8505e3b87215ea2c5911e2ba59ddb4933016a76da0d919f |
Hashes for pentapy-1.0.2-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a99322d5c7823ca6351042383e1d2e5907407a0749e9ea5ddfa0b5f717659a6 |
|
MD5 | b5b2845e26bd97cea394746b8a5f0639 |
|
BLAKE2b-256 | 25014fb6f1e0076d165c893a219842d69b268183c1e85478bf5d0d6a8b8e021b |
Hashes for pentapy-1.0.2-cp27-cp27m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47a4767786e2d2936efc46e84c50149a7543bdd18d57b34d4113b0007d4c84ce |
|
MD5 | af466ea4c8ca09077f49720e7d6dc60c |
|
BLAKE2b-256 | b4e513353b1ae23a07a0859dfd48278d881019e021302d3c87ab243817b81c3a |
Hashes for pentapy-1.0.2-cp27-cp27m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 268c9bcb5d1ee8d3a5908d66385f5ced70d32a9165e4fe17769c179c74c6539e |
|
MD5 | 3e1451028c5f3bb9fd1e420e83cfe1a9 |
|
BLAKE2b-256 | 855493896e16987cfff4d2c314a96f80b6d4da4e4ee1401893717cfb93d2b6d1 |