JuliaLinearAlgebra / AlgebraicMultigrid.jl

Algebraic Multigrid in Julia
Other
117 stars 22 forks source link

`ruge_stuben` fails for small matrices (edited) #31

Closed cortner closed 6 years ago

cortner commented 6 years ago
julia> Pkg.status("AMG")
 - AMG                           0.1.0

julia> using AMG
INFO: Initializing AMG to use 4 threads

julia>

julia> ruge_stuben( speye(10) )
Error showing value of type AMG.MultiLevel{AMG.Pinv,AMG.GaussSeidel{AMG.SymmetricSweep},AMG.GaussSeidel{AMG.SymmetricSweep},Float64,Int64}:
ERROR: ArgumentError: reducing over an empty collection is not allowed
Stacktrace:
 [1] mr_empty_iter(::Function, ::Function, ::Base.Generator{Array{AMG.Level{Float64,Int64},1},AMG.##7#8}, ::Base.EltypeUnknown) at ./reduce.jl:257
 [2] mapfoldl(::Base.#identity, ::Function, ::Base.Generator{Array{AMG.Level{Float64,Int64},1},AMG.##7#8}) at ./reduce.jl:69
 [3] operator_complexity(::AMG.MultiLevel{AMG.Pinv,AMG.GaussSeidel{AMG.SymmetricSweep},AMG.GaussSeidel{AMG.SymmetricSweep},Float64,Int64}) at /Users/ortner/.julia/v0.6/AMG/src/multilevel.jl:50
 [4] show(::IOContext{Base.Terminals.TTYTerminal}, ::AMG.MultiLevel{AMG.Pinv,AMG.GaussSeidel{AMG.SymmetricSweep},AMG.GaussSeidel{AMG.SymmetricSweep},Float64,Int64}) at /Users/ortner/.julia/v0.6/AMG/src/multilevel.jl:24
 [5] display(::Base.REPL.REPLDisplay{Base.REPL.LineEditREPL}, ::MIME{Symbol("text/plain")}, ::AMG.MultiLevel{AMG.Pinv,AMG.GaussSeidel{AMG.SymmetricSweep},AMG.GaussSeidel{AMG.SymmetricSweep},Float64,Int64}) at ./REPL.jl:122
 [6] display(::Base.REPL.REPLDisplay{Base.REPL.LineEditREPL}, ::AMG.MultiLevel{AMG.Pinv,AMG.GaussSeidel{AMG.SymmetricSweep},AMG.GaussSeidel{AMG.SymmetricSweep},Float64,Int64}) at ./REPL.jl:125
 [7] display(::AMG.MultiLevel{AMG.Pinv,AMG.GaussSeidel{AMG.SymmetricSweep},AMG.GaussSeidel{AMG.SymmetricSweep},Float64,Int64}) at ./multimedia.jl:218
 [8] eval(::Module, ::Any) at ./boot.jl:235
 [9] print_response(::Base.Terminals.TTYTerminal, ::Any, ::Void, ::Bool, ::Bool, ::Void) at ./REPL.jl:144
 [10] print_response(::Base.REPL.LineEditREPL, ::Any, ::Void, ::Bool, ::Bool) at ./REPL.jl:129
 [11] (::Base.REPL.#do_respond#16{Bool,Base.REPL.##26#36{Base.REPL.LineEditREPL,Base.REPL.REPLHistoryProvider},Base.REPL.LineEditREPL,Base.LineEdit.Prompt})(::Base.LineEdit.MIState, ::Base.AbstractIOBuffer{Array{UInt8,1}}, ::Bool) at ./REPL.jl:646
cortner commented 6 years ago

actually, this has nothing to do with speye , everything seems to fail right now. wait for more info, probably a problem at my end.

cortner commented 6 years ago

Seems this is just matrix size:

julia> ruge_stuben(poisson(11))
Multilevel Solver
-----------------
Operator Complexity: 1.419
Grid Complexity: 1.455
No. of Levels: 2
Coarse Solver: AMG.Pinv()
Level     Unknowns     NonZeros
-----     --------     --------
    1           11           31 [70.45%]
    2            5           13 [29.55%]
julia> ruge_stuben(poisson(10))
Error showing value of type AMG.MultiLevel{AMG.Pinv,AMG.GaussSeidel{AMG.SymmetricSweep},AMG.GaussSeidel{AMG.SymmetricSweep},Float64,Int64}:
ERROR: ArgumentError: reducing over an empty collection is not allowed
ranjanan commented 6 years ago

Hi @cortner, yes, I have been a little lax with testing the ruge_stuben. The smoothed_aggregation is perhaps a little more robust. I will look through this as well as issue #32 and fix all of them. Other than that I'll add a bunch of tests for the classical amg. Thanks for considering using this package! :-)

ranjanan commented 6 years ago

This is actually a display issue that fails for matrices smaller than max_coarse

cortner commented 6 years ago

interesring, and not to worry about the bugs, just trying to help find them. I’ll try out smoothed aggregation