Skip to main content

PyAMG: Algebraic Multigrid Solvers in Python

Project description

CI PyPi codecov

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.

Linux: Circle CI

OSX: TravisCI

Windows: AppVeyor

Version: Anaconda-Server Badge

Downloads: Anaconda-Server Badge

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

pyamg-4.2.0-pp37-pypy37_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (1.6 MB view hashes)

Uploaded PyPy manylinux: glibc 2.12+ x86-64

pyamg-4.2.0-pp37-pypy37_pp73-manylinux_2_12_i686.manylinux2010_i686.whl (1.7 MB view hashes)

Uploaded PyPy manylinux: glibc 2.12+ i686

pyamg-4.2.0-pp37-pypy37_pp73-macosx_10_9_x86_64.whl (1.5 MB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

pyamg-4.2.0-cp310-cp310-win_amd64.whl (1.4 MB view hashes)

Uploaded CPython 3.10 Windows x86-64

pyamg-4.2.0-cp310-cp310-win32.whl (1.3 MB view hashes)

Uploaded CPython 3.10 Windows x86

pyamg-4.2.0-cp310-cp310-musllinux_1_1_x86_64.whl (2.0 MB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

pyamg-4.2.0-cp310-cp310-musllinux_1_1_i686.whl (2.1 MB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ i686

pyamg-4.2.0-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (1.7 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.12+ x86-64

pyamg-4.2.0-cp310-cp310-manylinux_2_12_i686.manylinux2010_i686.whl (1.7 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.12+ i686

pyamg-4.2.0-cp310-cp310-macosx_10_9_x86_64.whl (1.5 MB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

pyamg-4.2.0-cp39-cp39-win_amd64.whl (1.4 MB view hashes)

Uploaded CPython 3.9 Windows x86-64

pyamg-4.2.0-cp39-cp39-win32.whl (1.3 MB view hashes)

Uploaded CPython 3.9 Windows x86

pyamg-4.2.0-cp39-cp39-musllinux_1_1_x86_64.whl (2.0 MB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

pyamg-4.2.0-cp39-cp39-musllinux_1_1_i686.whl (2.1 MB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ i686

pyamg-4.2.0-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (1.7 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

pyamg-4.2.0-cp39-cp39-manylinux_2_12_i686.manylinux2010_i686.whl (1.7 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.12+ i686

pyamg-4.2.0-cp39-cp39-macosx_10_9_x86_64.whl (1.5 MB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

pyamg-4.2.0-cp38-cp38-win_amd64.whl (1.4 MB view hashes)

Uploaded CPython 3.8 Windows x86-64

pyamg-4.2.0-cp38-cp38-win32.whl (1.3 MB view hashes)

Uploaded CPython 3.8 Windows x86

pyamg-4.2.0-cp38-cp38-musllinux_1_1_x86_64.whl (2.0 MB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ x86-64

pyamg-4.2.0-cp38-cp38-musllinux_1_1_i686.whl (2.1 MB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ i686

pyamg-4.2.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (1.7 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

pyamg-4.2.0-cp38-cp38-manylinux_2_12_i686.manylinux2010_i686.whl (1.7 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.12+ i686

pyamg-4.2.0-cp38-cp38-macosx_10_9_x86_64.whl (1.5 MB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

pyamg-4.2.0-cp37-cp37m-win_amd64.whl (1.4 MB view hashes)

Uploaded CPython 3.7m Windows x86-64

pyamg-4.2.0-cp37-cp37m-win32.whl (1.3 MB view hashes)

Uploaded CPython 3.7m Windows x86

pyamg-4.2.0-cp37-cp37m-musllinux_1_1_x86_64.whl (2.0 MB view hashes)

Uploaded CPython 3.7m musllinux: musl 1.1+ x86-64

pyamg-4.2.0-cp37-cp37m-musllinux_1_1_i686.whl (2.1 MB view hashes)

Uploaded CPython 3.7m musllinux: musl 1.1+ i686

pyamg-4.2.0-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (1.7 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

pyamg-4.2.0-cp37-cp37m-manylinux_2_12_i686.manylinux2010_i686.whl (1.7 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.12+ i686

pyamg-4.2.0-cp37-cp37m-macosx_10_9_x86_64.whl (1.5 MB view hashes)

Uploaded CPython 3.7m macOS 10.9+ x86-64

pyamg-4.2.0-cp36-cp36m-win_amd64.whl (1.4 MB view hashes)

Uploaded CPython 3.6m Windows x86-64

pyamg-4.2.0-cp36-cp36m-win32.whl (1.3 MB view hashes)

Uploaded CPython 3.6m Windows x86

pyamg-4.2.0-cp36-cp36m-musllinux_1_1_x86_64.whl (2.0 MB view hashes)

Uploaded CPython 3.6m musllinux: musl 1.1+ x86-64

pyamg-4.2.0-cp36-cp36m-musllinux_1_1_i686.whl (2.1 MB view hashes)

Uploaded CPython 3.6m musllinux: musl 1.1+ i686

pyamg-4.2.0-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (1.7 MB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

pyamg-4.2.0-cp36-cp36m-manylinux_2_12_i686.manylinux2010_i686.whl (1.7 MB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.12+ i686

pyamg-4.2.0-cp36-cp36m-macosx_10_9_x86_64.whl (1.5 MB view hashes)

Uploaded CPython 3.6m macOS 10.9+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page