PyAMG: Algebraic Multigrid Solvers in Python
Project description
Installation
PyAMG requires numpy
and scipy
pip install pyamg
or from source:
pip install .
(python setup.py install
will no longer work)
or with conda (see details below)
conda config --add channels conda-forge
conda install pyamg
Introduction
PyAMG is a library of Algebraic Multigrid (AMG) solvers with a convenient Python interface.
PyAMG is currently developed by Luke Olson, and Jacob Schroder.
Citing
@MISC{OlSc2018, author = "Olson, L. N. and Schroder, J. B.", title = "{PyAMG}: Algebraic Multigrid Solvers in {Python} v4.0", year = "2018", url = "https://github.com/pyamg/pyamg", note = "Release 4.0" }
Getting Help
For documentation see http://pyamg.readthedocs.io/en/latest/.
Create an issue.
Look at the Tutorial or the Examples (for instance the 0STARTHERE example).
What is AMG?
AMG is a multilevel technique for solving large-scale linear systems with optimal or near-optimal efficiency. Unlike geometric multigrid, AMG requires little or no geometric information about the underlying problem and develops a sequence of coarser grids directly from the input matrix. This feature is especially important for problems discretized on unstructured meshes and irregular grids.
PyAMG Features
PyAMG features implementations of:
- Ruge-Stuben (RS) or Classical AMG
- AMG based on Smoothed Aggregation (SA)
and experimental support for:
- Adaptive Smoothed Aggregation (αSA)
- Compatible Relaxation (CR)
The predominant portion of PyAMG is written in Python with a smaller amount of supporting C++ code for performance critical operations.
Example Usage
PyAMG is easy to use! The following code constructs a two-dimensional Poisson problem and solves the resulting linear system with Classical AMG.
import pyamg
import numpy as np
A = pyamg.gallery.poisson((500,500), format='csr') # 2D Poisson problem on 500x500 grid
ml = pyamg.ruge_stuben_solver(A) # construct the multigrid hierarchy
print(ml) # print hierarchy information
b = np.random.rand(A.shape[0]) # pick a random right hand side
x = ml.solve(b, tol=1e-10) # solve Ax=b to a tolerance of 1e-10
print("residual: ", np.linalg.norm(b-A*x)) # compute norm of residual vector
Program output:
multilevel_solver Number of Levels: 9 Operator Complexity: 2.199 Grid Complexity: 1.667 Coarse Solver: 'pinv2' level unknowns nonzeros 0 250000 1248000 [45.47%] 1 125000 1121002 [40.84%] 2 31252 280662 [10.23%] 3 7825 70657 [ 2.57%] 4 1937 17971 [ 0.65%] 5 483 4725 [ 0.17%] 6 124 1352 [ 0.05%] 7 29 293 [ 0.01%] 8 7 41 [ 0.00%] residual: 1.24748994988e-08
Conda
More information can be found at conda-forge/pyamg-feedstock.
Installing pyamg
from the conda-forge
channel can be achieved by adding conda-forge
to your channels with:
conda config --add channels conda-forge
Once the conda-forge
channel has been enabled, pyamg
can be installed with:
conda install pyamg
It is possible to list all of the versions of pyamg
available on your platform with:
conda search pyamg --channel conda-forge
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 pyamg-4.2.2-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 01cfe2b170fb6fbd74b74bc5764471811d7aad8f1c5842d97d6c91f7a8b68bf3 |
|
MD5 | 9e1033220c866a001e1947260df483f7 |
|
BLAKE2b-256 | 1fb68d481af2cb3105656fd28fda5169311cf9249e41f567ac75e7e17d789980 |
Hashes for pyamg-4.2.2-cp310-cp310-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50f07ebf437c45abf8f8d323f73cd0be54bfb07d3e2d75af130daf2088598491 |
|
MD5 | 66fb720e08236d3813a673294e5f5d25 |
|
BLAKE2b-256 | 4d35ff3d1b258e4e565f597c0ba94c8e15f1c7c4d366030e9b7d99455fc34843 |
Hashes for pyamg-4.2.2-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 12da5985758999c712146ef8994a985947b4bdfd78576e6c25ec439273925f82 |
|
MD5 | fcff3fc1766a27502c63535c3590ff71 |
|
BLAKE2b-256 | b06f3f4ad9885abf1434f1e4f321ada13edb130b3d44331ce445944d19c66fc4 |
Hashes for pyamg-4.2.2-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 32e9760b465a1256c0be8bd41f3be31ddfcb427a2d4829d8e3565c826a28ecd2 |
|
MD5 | 479eb5ff57fd6061efb4b844ce2bf7f4 |
|
BLAKE2b-256 | baf5dc6091923425100e15731cb186d7853e95b9f266275f66e3c6130b6e5d1e |
Hashes for pyamg-4.2.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5ddaa92502c8512dffbb7ef44c026b0a9a6d8818319d55b2eabb303552add60 |
|
MD5 | 68e83ef7ec46bb1986af52dede18a6df |
|
BLAKE2b-256 | a88909e24134af12e15736e7ba3e941cace7c9708d3d2f518c274b6e3eacee87 |
Hashes for pyamg-4.2.2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31f8060713ea206e39a970dcda194edb730327f0bb64c6125ae4e7018416de50 |
|
MD5 | bfee3328441d2c19627c8019ffd5e001 |
|
BLAKE2b-256 | 7f4f307b81e87adf17f3dea79ac26a27d522aa67d78c38668a0c3ad319557f1c |
Hashes for pyamg-4.2.2-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0367d77b061691ae83aff33136fe6b396f28be4809e6d0a706f4cdea7278728 |
|
MD5 | d3c01df39cfb9807aec1abc04f706100 |
|
BLAKE2b-256 | cfb130435aeede2cb91ba5eaed2b3cbe42d5fe15f7006bb87779d72b1c833f90 |
Hashes for pyamg-4.2.2-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ffaa88afde751fbc683146b26bae8e4a24f863f44bd9b70ce1cf3b13419ced08 |
|
MD5 | e2c1dfcbbf978e9e3527b9ecbcc990fe |
|
BLAKE2b-256 | 446ea50d8fe02a0490cad386272ea01d1896a0bd3cbad03598be5b32192cd993 |
Hashes for pyamg-4.2.2-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 094a2250485dde43c3a9d7a8c0ea44dddfbd4772ee12c41615d7df2a625aa5b0 |
|
MD5 | 23716ed51c13d15ed9251a90d5f132c8 |
|
BLAKE2b-256 | 0e84937bcdd18ed562b2b726efe95a93843e58eaf856418a2bc56f63800a5a72 |
Hashes for pyamg-4.2.2-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7afc986e74d964f0068f7072262e4a42e070d1d9ddd4e9cd0f1acd628e2b9950 |
|
MD5 | 6181076bf2e64aa8efff72fa166a3382 |
|
BLAKE2b-256 | 6436d16c910c07fc83dbf634dbc611340ed8b427b33c470f2595b58d6dcf9b64 |
Hashes for pyamg-4.2.2-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a676557340603c08a6f9fd3a5d40ff7456a4bace401ea0310749956ee0cebc2c |
|
MD5 | d7b3d3dc4298433e53c6d15546aa7bea |
|
BLAKE2b-256 | 68a069670a5db222bde4f843ee400a01f9ae8fba5aa7cb0086b486d421ad90d2 |
Hashes for pyamg-4.2.2-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa8282ec1201355ff7ff8d3e5e593ee63a012e607a6f2ad9a7f0a3133dfd6c12 |
|
MD5 | 8ac5faa8ab1ec17eb822338b0f66cbd4 |
|
BLAKE2b-256 | b527f4ba391467936508df48b3e357767ed1c02d05b1ac21d35ff8b6dbf99733 |
Hashes for pyamg-4.2.2-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f523174faa9cc47e4689fffaaf9f2a562890d2c30f124096a4c822af499f62d |
|
MD5 | 1fb4a91fc0fab54f8cdce0f9b0286b79 |
|
BLAKE2b-256 | cefb25249af17011946fc77f77879ffc775e403940276ae292cbcdd3fb602446 |
Hashes for pyamg-4.2.2-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50d09bb86bcf3cc7de6346f09f73a84e03e8fb71d84c0ec7d33317852c174a6c |
|
MD5 | 3026813b6584e8f389397980be2ed8c5 |
|
BLAKE2b-256 | 03ef8e380e9b1a855b21a7f9da45ae4bc5fea8cf17a30717e6bcf84548ab087f |
Hashes for pyamg-4.2.2-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1b63ae254511febced47601815358da5a76c65fda0a9b387af879ec3e186b63 |
|
MD5 | 1955f1559753ed41f5986b854156717c |
|
BLAKE2b-256 | eabdcdbbb8f1dbd6d819d6c372729057148200293f060af34bcc5f7d7a835608 |
Hashes for pyamg-4.2.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7dd8c79fa1847f6769ff2e2d0852e6a35c2b42f86edfd08dd8df6e8d6b2e6bd5 |
|
MD5 | 2b30b05b2ddad1e507db89c99bdbd58e |
|
BLAKE2b-256 | 911fddf15fc7b21505e30449ed07cf1aaf2b715871d05bebe877e4e835deb5eb |
Hashes for pyamg-4.2.2-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6875d0ba46fb009b4adc446f8cf56ac493b01763cfc973fb44e4da892b007764 |
|
MD5 | fde4f8ee1de762ca0fd012039939b5b4 |
|
BLAKE2b-256 | 435f52a4af64916d4d359ede008b0ce22275659eb211bdeaf5a476365049b3f6 |
Hashes for pyamg-4.2.2-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a87fecd32ce7974c07b6c25e75842363deaf96ec7f8a2ae5be39568fb27d3b9 |
|
MD5 | 7fb085374659d8bbc0aec60200a5672e |
|
BLAKE2b-256 | b1ae660ec00cedb186f6e8e9d526a2a0be948341f8815a9beaf892e060e0d480 |
Hashes for pyamg-4.2.2-cp37-cp37m-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c447a387b2d4324fa550011f2054d8b42c072d24769bde4e48df80d7e2ed1161 |
|
MD5 | 35db7410cf982af05f8a4221e00f980b |
|
BLAKE2b-256 | 3d2d912218e48ab304a8b8ef54b0096563addc00a4679cf6ddc14d2f8367b455 |
Hashes for pyamg-4.2.2-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d989cc63ad1d17924b358d087da43501d6683889c6cec1c0668e23357e95dfee |
|
MD5 | 4c8a6107982653e21c7221251ac1e122 |
|
BLAKE2b-256 | e4bd1baf58a67b5b347df1acdff04fa9a362839c6f66059dde511365f72ae11b |
Hashes for pyamg-4.2.2-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 933b1753c4cb40c5ad9415dde8b0267f509236bb4e56fe454621c3d49184ed04 |
|
MD5 | ceb0f3740295d0aac5e5a31dffa93c77 |
|
BLAKE2b-256 | 2b5e4f996dd26ee7496e5e271312808554e7e1a1f7db52630cb9d607366075cd |