@@ -100,23 +100,39 @@ end
100100end
101101
102102@testset " Solver" begin
103+ fsmoother = GaussSeidel (ForwardSweep ())
104+
103105A = poisson (1000 )
104106A = float .(A)
105107ml = ruge_stuben (A)
106108x = solve (ml, A * ones (1000 ))
107- @test sum (abs2, x - ones (1000 )) < 1e-10
109+ @test sum (abs2, x - ones (1000 )) < 1e-8
110+
111+ ml = ruge_stuben (A, presmoother = fsmoother,
112+ postsmoother = fsmoother)
113+ x = solve (ml, A * ones (1000 ))
114+ @test sum (abs2, x - ones (1000 )) < 1e-8
115+
108116
109117A = load (" randlap.jld" )[" G" ]
118+
119+ ml = ruge_stuben (A, presmoother = fsmoother,
120+ postsmoother = fsmoother)
121+ x = solve (ml, A * ones (100 ))
122+ @test sum (abs2, x - zeros (100 )) < 1e-8
123+
110124ml = ruge_stuben (A)
111125x = solve (ml, A * ones (100 ))
112- @test sum (abs2, x - zeros (100 )) < 1e-10
126+ @test sum (abs2, x - zeros (100 )) < 1e-6
113127
114128end
115129
116130@testset " Preconditioning" begin
117131A = load (" thing.jld" )[" G" ]
118132n = size (A, 1 )
119- ml = ruge_stuben (A)
133+ smoother = GaussSeidel (ForwardSweep ())
134+ ml = ruge_stuben (A, presmoother = smoother,
135+ postsmoother = smoother)
120136p = aspreconditioner (ml)
121137b = zeros (n)
122138b[1 ] = 1
@@ -163,5 +179,34 @@ diff = x - [ 0.82365077, -0.537589 , -0.30632349, -0.19370186, -0.14773294,
163179 0.04968258 , 0.04968737 , 0.05105749 , 0.05009268 , 0.04972329 ,
164180 0.04970173 ]
165181@test sum (abs2, diff) < 1e-8
182+
183+ # Symmetric GaussSeidel Smoothing
184+
185+ ml = ruge_stuben (A)
186+ p = aspreconditioner (ml)
187+
188+ x = cg (A, b, Pl = p, maxiter = 100_000 , tol = 1e-6 )
189+ diff = x - [0.823762 , - 0.537478 , - 0.306212 , - 0.19359 , - 0.147621 , 0.685002 ,
190+ - 0.155389 , - 0.127703 , - 0.111867 , 0.453735 , - 0.0856607 , - 0.0858715 ,
191+ - 0.0846678 , 0.129962 , 0.0281662 , - 0.0389642 , - 0.0593981 , - 0.0653311 ,
192+ 0.0545782 , - 0.0474255 , - 0.0519275 , - 0.0467483 , - 0.0448061 , 0.056504 ,
193+ 0.0280386 , - 0.0227138 , - 0.0405172 , - 0.0431067 , - 0.0440778 , 0.076042 ,
194+ 0.052232 , 0.0447537 , 0.05847 , 0.0509098 , 0.0484189 , 0.0528356 ,
195+ 0.0503983 , 0.0495933 , 0.0497211 , 0.0497731 , 0.0497942 , 0.049799 ,
196+ 0.0511691 , 0.0502043 , 0.0498349 , 0.0498134 ]
197+ @test sum (abs2, diff) < 1e-8
198+
199+ x = solve (ml, b, 1 , V (), 1e-12 )
200+ diff = x - [0.775725 , - 0.571202 , - 0.290989 , - 0.157001 , - 0.106981 , 0.622652 ,
201+ - 0.122318 , - 0.0891874 , - 0.0709834 , 0.392621 , - 0.055544 , - 0.0507485 ,
202+ - 0.0466376 , 0.107175 , 0.0267468 , - 0.0200843 , - 0.0282827 , - 0.0299929 ,
203+ 0.0420468 , - 0.0175585 , - 0.0181318 , - 0.0121591 , - 0.00902523 , 0.0394795 ,
204+ 0.019981 , - 0.00270916 , - 0.0106855 , - 0.0093661 , - 0.00837619 , 0.052532 ,
205+ 0.0301423 , 0.0248904 , 0.0333098 , 0.0262179 , 0.0246211 , 0.026778 ,
206+ 0.0245746 , 0.0238448 , 0.0233892 , 0.0231593 , 0.0230526 , 0.0229771 ,
207+ 0.0247913 , 0.0238555 , 0.0233681 , 0.023096 ]
208+ @test sum (abs2, diff) < 1e-8
209+
210+
166211end
167212end
0 commit comments