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 0_start_here example).
-
Run the unit tests (
pip install pytest
):- With PyAMG installed and from a non-source directory:
import pyamg pyamg.test()
- From the PyAMG source directory and installed (e.g. with
pip install -e .
):
pytest .
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.3-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9fea7c57b0c9b9c04d6717f9ebe9607e6cfea8afeb5be127ff9c2fb76b6b0149 |
|
MD5 | 66b9e81b96ab2ffd1fc1df2a9ad81518 |
|
BLAKE2b-256 | 94eab8548319fcefcad2282781219112de8e1f1f76da542a434ecc76c589ce0d |
Hashes for pyamg-4.2.3-cp310-cp310-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 71887d6e1899dd4af24f6f232001feaf2ace21498bce6485333e20c36a7c1e2d |
|
MD5 | 127dda32ba2519156af84b19dc49c458 |
|
BLAKE2b-256 | 422c43de8008fbdaa73482e7f8e67dab0c995124c77b6ae4a1c4bc494bde4c74 |
Hashes for pyamg-4.2.3-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eba62a2c32d67128dcc5f583816310c3262714f83f94b6e2c9d3290fc8f055ff |
|
MD5 | 622047ea02422a76440a88688cc6f898 |
|
BLAKE2b-256 | 756d0d4998e8173600572ca93eef169259e2aa273e14b437d98cade2f81b0921 |
Hashes for pyamg-4.2.3-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 771ab589091934bfe6c803c4e55c9e99e79e2ec6e3705d0a80b2c4360d754040 |
|
MD5 | 93345764f8b9268b25f7bf08a877d7e1 |
|
BLAKE2b-256 | 35f2c4700605fda76d76c6393ba20e1643a83dee4ad199c7bf840fe0d9fd2331 |
Hashes for pyamg-4.2.3-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 487206fdd40dbfe8efc14e7b12f551c1317b03412184a2a53d35ac51bd07b9be |
|
MD5 | 6541c9c474eee3be4217b3fb341fd6cf |
|
BLAKE2b-256 | 6c575d71e1ebaa7f673647e858d0af8f8a2cff5126ff3855929d5a4257aebe23 |
Hashes for pyamg-4.2.3-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 944c4f4cc97d798bbbdadaf86185e6911d5e930ddc38fb5ed2fe683228f4166c |
|
MD5 | 3e3b5738edd0a88b6fc22808f8caeabf |
|
BLAKE2b-256 | 9e14f422b8fece9acf5e854cb6dbf92448c7f8248b2a03610ff8905bf6d03213 |
Hashes for pyamg-4.2.3-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 236c5caeb9c811b96ea3137ed63af1050150ba1639b2507e9c7dee318e65f944 |
|
MD5 | f8f2cceefdd6b62a163dc6cfeec9065c |
|
BLAKE2b-256 | 8f6af9a6bc06596a750637627d0f4d82b7d89006f4366d0c0467c160514dfb97 |
Hashes for pyamg-4.2.3-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | da73a026dbc93644918733cf42acc86cb2dc1dad3685afad5ace41eefe4f1119 |
|
MD5 | 10646a87bed32ba4db0c4ce812eddb91 |
|
BLAKE2b-256 | 38c6538efb5ac826f6617c103c49b112280a0d942c7a70a1463d73da93e13d47 |
Hashes for pyamg-4.2.3-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1827249145a8876eb954db88ba6be5f58a95254d6f46cdd86e0371468a2640e |
|
MD5 | a08a6bc427fb3e923934327fb0603646 |
|
BLAKE2b-256 | f013213ed7130d9a1c451b01c6742b7f0719d802b046beb9273c7f9cf211492f |
Hashes for pyamg-4.2.3-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 18af99d2551df07951c35cf270dc76703f8c5d30b16ea8e61657fda098f57dd7 |
|
MD5 | 858f5e449450fb8172d1052cd4a588f9 |
|
BLAKE2b-256 | 8e08d512b6e34d502152723b5a4ad9d962a6141dfe83cd8bcd01af4cb6e84f28 |
Hashes for pyamg-4.2.3-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ced128e79742594121d38a411d86ba0b099ebc098f3428d4b5f5ce95dd6d318 |
|
MD5 | 4c288d787935abc7daefa58ad4425fe5 |
|
BLAKE2b-256 | 45729dc9bf4f3cffb38615c082c532fc8bdbfd16846fb0da1e09ca232a21c94c |
Hashes for pyamg-4.2.3-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc88ce72a5de1080266dfd9c8ada5b61e4af3d2276aa6b15532300596adbac97 |
|
MD5 | 8674628d1b9807aadd9c48ab075861de |
|
BLAKE2b-256 | ea479f2463404dfb0645e1497a0e9a848f5eb66285318850723ec02de757877d |
Hashes for pyamg-4.2.3-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d42a316d834d8867422204011817b7d55774a646e94da4d7839cfaad5422f16f |
|
MD5 | 295e1e9791674bac549f47c059a6dc99 |
|
BLAKE2b-256 | 204ee1bd8b8864382388a1d376f2344fbbb84b38fd8e7ab0f3953f0b271cffd0 |
Hashes for pyamg-4.2.3-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc2d11a01ce754e9167faa67857fe7bc920ff99b20e2fbc990e091e1aed3b148 |
|
MD5 | eb257269e34cf15173390c5cc4423d2d |
|
BLAKE2b-256 | e0793e6acf0e98cfe1fe9ce5e4d7100b00024d59ac6a541ed3c6e554afb1837b |
Hashes for pyamg-4.2.3-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2c55a49353f8a8a71584caa05b196290111a0ccc7de98c784fe9f71848560c7 |
|
MD5 | 7fc8d5f9d587463b45ccbed6a2026d43 |
|
BLAKE2b-256 | a0f38b90c86d3ca7841dfcde1f70f96d5b7c42f314422fa39d57a3f91827ff85 |
Hashes for pyamg-4.2.3-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1196a26277df0361621d46d7b8cc6b1d2de97f4448136db491edc83c8b9c9fe4 |
|
MD5 | b6b5440ba1b7f21af555ceaf87462eeb |
|
BLAKE2b-256 | fb9f2775bce5afb3c19559e74828609e63ece2011b489779c6f3f3bfb89502cd |
Hashes for pyamg-4.2.3-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c6c4105ad4c4cf4d4d6d2d8150f7910fce0bc7d155ddb2a049690ecea3f3975 |
|
MD5 | b6b5a29fa56fc98993565a8b2f88995d |
|
BLAKE2b-256 | b6ec238ba818d9ae7b6f6d262d5e86dbd985147f82e00330d341f98ba919aeed |
Hashes for pyamg-4.2.3-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96765421a6cb03b4c947d3e3ae3bb2dc01c744998914553b86fff635c122a54c |
|
MD5 | 103c7a0a937c47a45acd5b33e021cb0c |
|
BLAKE2b-256 | 8dcab0a80a32ea7702810c1a59801a1ac187a77682193963b926bad82e8c6338 |
Hashes for pyamg-4.2.3-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f091d6739cd3d46fc642f986be8f3dc0a72147e91da04ecef4f3636d857f5760 |
|
MD5 | 907813484fd0085d7e478121eb7b6f8d |
|
BLAKE2b-256 | 5c6159fb9c7e232186b60c794fece5213bfeff65cffc92a0cccbb03ef5e24e4d |
Hashes for pyamg-4.2.3-cp37-cp37m-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0172a7331136b6f0b5f017d9acf7939ddfdadd9304ce74817ab8036928125097 |
|
MD5 | 1941e1371229919b8d56ed6f27c68660 |
|
BLAKE2b-256 | 44bfd9de76b38c542ddc2a2a780cd8bd601bbaf09f59b553e6d7ef90b5e4ef15 |
Hashes for pyamg-4.2.3-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ead2de0e9f44e13e6da4fe2a3a1115c513b47eae1325002622f49d52114107f |
|
MD5 | ac862a7d644f780d37e33ec296443242 |
|
BLAKE2b-256 | 86df08f72d4c4246cefc1161ada95da9ce24045a5f8acedd90e6df6d4ae9bfa5 |
Hashes for pyamg-4.2.3-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c38c615ed5c684051cfe9648dc1cb695ed45ff0ed84bb1417b1be9c7790d0d6 |
|
MD5 | 21e5e2b4e1905b5ccbd4f0c8e8cddd2d |
|
BLAKE2b-256 | 3005c98e18508912bd9402bd75e0c7351f3041b3f80a71e314da535553f6d63b |