PyAMG: Algebraic Multigrid Solvers in Python
Project description
Installation
PyAMG requires numpy
and scipy
pip install pyamg
or
python setup.py install
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.1-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61ef581c5229cb61f364f14817258b736b39b041efe03054503dd2c197e5d122 |
|
MD5 | 8577e8c838d7c140e3ecf286a7f9857c |
|
BLAKE2b-256 | 3314c56173f4aecc46055a59ad16d8802b9c11974e3606a45d6cec0336b4462b |
Hashes for pyamg-4.2.1-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e3fc489fe5229b655b7e0fb27475818bce576d4c1833c77f3f072fa41c3a48c6 |
|
MD5 | 436da650931e8eaac9da8041347c888b |
|
BLAKE2b-256 | 131f761462869f057d34a0ab98247f0d749e602042c05d5cd99680b20585915d |
Hashes for pyamg-4.2.1-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed5694e0ab80b85ea1f44ce43659cc6f0f65187177743746108aa8b70ae1321f |
|
MD5 | ac39e03dce0b7a2c970dfbc627369d7d |
|
BLAKE2b-256 | 8b54bfe12bfcfdd30d6fb52e1600c1cdf159b42a30061638321c9ae2e754cb82 |
Hashes for pyamg-4.2.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0878ec7be3f4ee02579feaf2d41884c675fbdaf659145bfcebc66cfa67c1f374 |
|
MD5 | d5a172df541bd2f54d2a3488015486de |
|
BLAKE2b-256 | ed3bf78e547764a8867d8cbce650d7789aa8ba9897d8400e53902e23ad87974d |
Hashes for pyamg-4.2.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8bc28a2909b3a1eb1b822dfeaa39d11d8a199addfa66e654b88537e2c5cf5b9a |
|
MD5 | 817eadf4afacf6d1491bb9507c6e54f0 |
|
BLAKE2b-256 | 2319f219ee17015ecbd4dba07a1dfb6be6a88accdc95f4e9391c7816278c9142 |
Hashes for pyamg-4.2.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9db01b22c32da028e9f4d6ef06ebe18f6ea749ca9e7ab7486c9f8f9fb79b13b0 |
|
MD5 | 7ce2d6d9784e5c6137100e93494b3727 |
|
BLAKE2b-256 | ed1e65ac057d6b6588df6052245cb2859c21fb74c3f462afabb9b5b042bda822 |
Hashes for pyamg-4.2.1-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fcbbfbd1e8c2d995b38d05a9297c970e8110bbe8db62b2f0e5f4e2a2c2cf51c8 |
|
MD5 | 3d2cf95254e6a748b8808845bd305685 |
|
BLAKE2b-256 | 6530836b179f31202f09620623c7e1ddd2ce6bc23c7ec58063c0f4512040d995 |
Hashes for pyamg-4.2.1-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | adf075e3aa180163c971307098664fcb6ab0db029f515ed5708008f3f068650a |
|
MD5 | 3b825f69aae84f969723f5d9697cc135 |
|
BLAKE2b-256 | 652e7f74910ce23986d1d9d3d9a6aa969e1d05bf56af160c2cb994ce0affc95b |
Hashes for pyamg-4.2.1-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab18e9da400ce4f13b7985b44578aa0d07e2872806cb4cefa226a8293a7131f7 |
|
MD5 | 54e34db3bfc0a46b1abf82701f05f5fa |
|
BLAKE2b-256 | 1ae4af77081493645aeade5e313b367feb16dc1c8174f834b2c945ca39505690 |
Hashes for pyamg-4.2.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a461c1a0c20b8d2649206cde69d5e6bc5d2126883666dc38c0b4907b79567037 |
|
MD5 | 2163fbcdfd223bffd4d443667373fc88 |
|
BLAKE2b-256 | a876bac4fb22d2afabae9935aead4887a66c57e68fd82e964d3983933caf4ac5 |
Hashes for pyamg-4.2.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e0eba215b9da87e1d3e9ce244ab43adfd09bf40a3e2059d22004d352847103b |
|
MD5 | a9ad6859eb570c560585452ad7d99e4e |
|
BLAKE2b-256 | ccb3d8db8b0b2f5e6ad6498c687566ebb99ae1ab9a70c876d3ca4c0bf202ded7 |
Hashes for pyamg-4.2.1-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea6d18b9866d4952341c0c10fed13806595fcd6d159c8761287722deb3a34ba8 |
|
MD5 | 67a27bf169ea217e4e7de81bd37d2e1b |
|
BLAKE2b-256 | 0cdd2e328fc326aebe1ad2b8222dc1067c89c9840b0c41e749efbf479c54dd55 |
Hashes for pyamg-4.2.1-cp37-cp37m-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 668f4c3087ea5b5a67dae75ffa0d594da9c9b5ad4723d2deebf51ffe682aac14 |
|
MD5 | ca92b0517116485709973d14c019ecf9 |
|
BLAKE2b-256 | feb3c2f6a4ef91b1a29a5d5b7d5bd9aa27ba57fa2964a4418f4c8ca13ee4218c |
Hashes for pyamg-4.2.1-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f21f6ca57dd014899bcc4d89fbba48071888bfe686b01ad1d1347acbd12a968 |
|
MD5 | 5aa583201ed779576f2f04b11aef35fa |
|
BLAKE2b-256 | 7c2c1b35119268ae138d2e0544447f36555b10f048073bb93dcfbd01f3f1021c |
Hashes for pyamg-4.2.1-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6bf8522ee84e4b65ac44e7640991f0833d07f562d1227a3c4f9ced4b5aa536b5 |
|
MD5 | 3a5fc61d9d7c0aeb4707ef8d608c982e |
|
BLAKE2b-256 | f928ab38f102208201760bc6ebf4f734a9cf0b054262904396716cc7523f35f9 |