Comments (3)
Actually smoothed_aggregation
also diverges, while pyamg.smoothed_aggregation_solver
with exactly the same setting works fine.
ml_sa = AMG.smoothed_aggregation(A)
AMG._solve(ml_sa, b, verbose=true, maxiter=20)
gives:
Norm of residual at iteration 1 is 1.8735e+06
Norm of residual at iteration 2 is 1.5396e+07
Norm of residual at iteration 3 is 9.8877e+08
Norm of residual at iteration 4 is 6.4761e+10
Norm of residual at iteration 5 is 4.2368e+12
Norm of residual at iteration 6 is 2.7722e+14
Norm of residual at iteration 7 is 1.8138e+16
Norm of residual at iteration 8 is 1.1868e+18
Norm of residual at iteration 9 is 7.7650e+19
Norm of residual at iteration 10 is 5.0806e+21
Norm of residual at iteration 11 is 3.3242e+23
Norm of residual at iteration 12 is 2.1750e+25
Norm of residual at iteration 13 is 1.4231e+27
Norm of residual at iteration 14 is 9.3112e+28
Norm of residual at iteration 15 is 6.0923e+30
Norm of residual at iteration 16 is 3.9861e+32
Norm of residual at iteration 17 is 2.6081e+34
Norm of residual at iteration 18 is 1.7065e+36
Norm of residual at iteration 19 is 1.1165e+38
Norm of residual at iteration 20 is 7.3054e+39
Both AMG.jl and PyAMG generate the same coarse grid hierachy (below), but their interpolation weights are quite different.
Multilevel Solver
-----------------
Operator Complexity: 1.022
Grid Complexity: 1.009
No. of Levels: 3
Coarse Solver: Pinv
Level Unknowns NonZeros
----- -------- --------
1 85623 2374949 [97.85%]
2 777 52035 [ 2.14%]
3 5 25 [ 0.00%]
from algebraicmultigrid.jl.
It is actually the smoother's fault. Swapping out the built-in smoother by IterativeSolvers: gauss_seidel!
solves the problem.
using MatrixMarket
import AlgebraicMultigrid as AMG
import IterativeSolvers: gauss_seidel!
A = MatrixMarket.mmread("poisson3Db.mtx")
b = MatrixMarket.mmread("poisson3Db_b.mtx") |> vec
ml = AMG.ruge_stuben(
A,
presmoother = (A, x, b) -> gauss_seidel!(x, A, b),
postsmoother = (A, x, b) -> gauss_seidel!(x, A, b)
)
AMG._solve(ml, b, verbose=true, maxiter=20) # now converges
gauss_seidel!
should be functionally equivalent to AMG.GaussSeidel(AMG.ForwardSweep(), 1),
, but in practice the results are quite different, maybe due to numerical instability.
from algebraicmultigrid.jl.
Since I am currently working a bit myself on AMG stuff I take a deeper look into this. The problem seems to be that your matrix is non-symmetric (see https://www.cise.ufl.edu/research/sparse/matrices/FEMLAB/poisson3Db.html ), but the internal Gauss-Seidel uses the assumption that the provided CSC matrix is symmetric (i and j are swapped, see https://github.com/JuliaLinearAlgebra/AlgebraicMultigrid.jl/blob/master/src/smoother.jl#L33-L36 and the docs for CSC https://docs.julialang.org/en/v1/stdlib/SparseArrays/#SparseArrays.nzrange).
from algebraicmultigrid.jl.
Related Issues (20)
- Support custom interpolations
- Multithreading not working when using OpenBLAS HOT 9
- Creating multigrid hierarchy (e.g., `ruge_stuben`) allocates too much memory
- Increase test coverage with MatrixDepot.jl
- Info about upcoming removal of packages in the General registry HOT 4
- Info about upcoming removal of packages in the General registry HOT 1
- Dependency cleanup HOT 4
- verbose HOT 1
- Hessian vector products HOT 7
- TagBot trigger issue HOT 6
- Got unsupported keyword arguments "strength", "max_levels", "max_coarse" HOT 1
- User-defined near null space HOT 3
- Move from Travis to Github Actions HOT 3
- Optimization-Based Algebraic Multigrid Coarsening Using Reinforcement Learning (NeurIPS 2021)
- Avoid printing numerical values of Coarse Solver when summarizing MultiLevel solver HOT 2
- Printed Grid Complexity is wrong (just copies Operator Complexity) HOT 2
- Support for CuSparse HOT 3
- Use sparse LU as a faster coarse solver than Pinv HOT 4
- Inf on preconditioner \ b HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from algebraicmultigrid.jl.