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 Distributions
Built Distributions
Hashes for pyamg-4.2.1a6-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b0a25b1f00f6e80aaf86a30ffa8752ff4a82984b00329013884fe39773b7d419 |
|
MD5 | c39470e82306032a4dfde21b16c06bcb |
|
BLAKE2b-256 | 81c053395b257a89bee408f196c9cc13f70eaf1e61acb543aa1680a7a726cce5 |
Hashes for pyamg-4.2.1a6-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e06e77e2604fdce7c9f31457702a7005749870edf4426ba7a5b821e3574534dd |
|
MD5 | c8264521b39b611acc2423b20d8273e0 |
|
BLAKE2b-256 | 3f100270e9c1ea0edd5e948b25a5d1a3fead13b0aaf2047238aa0b2c9b83e076 |
Hashes for pyamg-4.2.1a6-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f04f561effdeb2c79889b062cd171e32f6fd03bc1dd144d67ed145992294aa9e |
|
MD5 | 9fb8256341cf9bd79d7717c1598376de |
|
BLAKE2b-256 | a8bce038cc564aeaea18959b6d8604d9b09a1ada3622e94602be0fb9cb7ba713 |
Hashes for pyamg-4.2.1a6-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 003a6f7ce4d5f9bf9ee22d271c7a9580a2363eae1ae79295d8ed2d9ce49b9d00 |
|
MD5 | 9f2280f8c59543852a8dd16fdfe5b943 |
|
BLAKE2b-256 | 153dab6ea7210e8ce1bee44095409adadb997e0fc1a53282aaa743fc7c449abf |
Hashes for pyamg-4.2.1a6-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7c640f1f35ff8b1c4f8f07389dcd6515b39afc5027a90abd883c5fc29ec05d4 |
|
MD5 | 324e9eae2e7f40814bd75069d521d5ca |
|
BLAKE2b-256 | 88b8d2d1c1d99efe3a11fbeb1e21572367cb01e02c541b3e92fbbb86f9ed4095 |
Hashes for pyamg-4.2.1a6-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5f26071ad20195b029c703eb429a9f21e5637a8e811e2397a1fbccc3337265e |
|
MD5 | 0da70f69dcd4e220131991fcf154c638 |
|
BLAKE2b-256 | 1c7ed1952aa994ad2eb281eab4ddee2727818f7d4421d9a484689c13296bde0d |
Hashes for pyamg-4.2.1a6-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8db873a288287c4fa6149ad80ba8391a7c088138301c1a6e9b6748a496c48080 |
|
MD5 | 7e785a4ed5a301a9a54bf2a577cbfef6 |
|
BLAKE2b-256 | 4e0a02a9047e02635f84167c00f71fcf37efb077f5d077be4f5b91cbdc22d407 |
Hashes for pyamg-4.2.1a6-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c38a292bba5b6d4ea44a35e28fd2357b68006ae90047b5c07528eb5197bcabd |
|
MD5 | 725eebb51c048c47d0f9bc8572bd1ecd |
|
BLAKE2b-256 | 765a550a7f46f6022db7ce012039581baf3d3f58d4f11a907e8fdb9af0249a2a |
Hashes for pyamg-4.2.1a6-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d49927d9b00f26d30d51cc335b70f7626e2552cd10429a24aa896f9e6adab77f |
|
MD5 | 86a0baa05af09b63ae5a68a8790afde5 |
|
BLAKE2b-256 | 8a93bb9eb837535a08dbbee5287049b6180f98592833c580adbab212e678f75e |
Hashes for pyamg-4.2.1a6-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 295951ae8ef4bef5514f9d2ba5d94daa05b961cd0a6eecbbd274d5dc12844629 |
|
MD5 | 862ecb214e203c2eb1d3f896ee8d8b9e |
|
BLAKE2b-256 | 9d6b5a1ad382b5c2dea2b58df31a7034065acda6c55f60a8132528fe42f4cd69 |
Hashes for pyamg-4.2.1a6-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 697288c5523361a55190be7413c854f7273d2f3e7cc4adb6e3775287df6d06fa |
|
MD5 | 62da95e573bfb75c04b62bdc643cb7fe |
|
BLAKE2b-256 | e06bd333f6924d2cd5696a2ca3e7e4eff0bd25554dfd4ba8c017b9afc2b4c92d |
Hashes for pyamg-4.2.1a6-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9915db775b0d86c9584c151f23ecfaaad4c6578dbe4c8afe3d34c752f85290ef |
|
MD5 | f359ec9f922f2b8edaa2260d3bb11ee0 |
|
BLAKE2b-256 | d4bbdc188b031cd0082a6f9f94b55e23142959f1a623a1c99ef48a6a55913ca2 |
Hashes for pyamg-4.2.1a6-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d979807f7651ff9a193980a11c4a118f53bcda73db26904913bfff04fa7cfde |
|
MD5 | a5d198a2e21c0de279026a87d2ed2aff |
|
BLAKE2b-256 | fd9feb5ca323b0e3755dfadd83a239d9496c1c2731bc1131eb2458b46a92477a |
Hashes for pyamg-4.2.1a6-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6fe9d5fb71ce81d1b69088cb53d5f219c0f62b376a79f75e4caaeb6bce4fa337 |
|
MD5 | cf5557790c89c6d7d91ab08f4e49df65 |
|
BLAKE2b-256 | 3c529b59a13523f21f2dce64f0be429178824dea1939af5a4efac2a2068144dc |
Hashes for pyamg-4.2.1a6-cp37-cp37m-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8d677919750684681ec86864671667d2c7bfbf499287afe591464acf3a4d336 |
|
MD5 | b32cded497a4f2d183ccd99cb07aa989 |
|
BLAKE2b-256 | bd34f9965329ed0566583c654730cef4b760058d87bf806fbacd6444059e25de |
Hashes for pyamg-4.2.1a6-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e55b813716cae61117284a2352b347f2f231d8b0278aa5cebd9398fcae80026 |
|
MD5 | 1340ea43ff6d8771f5e290b859359e60 |
|
BLAKE2b-256 | 40857607bb9c95b273d07ad1f10b6f03426a47006c730b7bab3db7c7bd0af914 |
Hashes for pyamg-4.2.1a6-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf63c89913e9254ac687d134c6c1756deba270a98a1d26640e564b9304f18dd6 |
|
MD5 | 230f4f72d39926af99017c2e1451f681 |
|
BLAKE2b-256 | 6ff66904498f8c77415bda5a63908e552fd561defe31b2229788b92918084bba |