@@ -100,19 +100,31 @@ end
100
100
end
101
101
102
102
@testset " Solver" begin
103
+ fsmoother = GaussSeidel (ForwardSweep ())
104
+
103
105
A = poisson (1000 )
104
106
A = float .(A)
105
107
ml = ruge_stuben (A)
106
108
x = solve (ml, A * ones (1000 ))
107
109
@test sum (abs2, x - ones (1000 )) < 1e-8
108
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
+
116
+
109
117
A = load (" randlap.jld" )[" G" ]
110
- smoother = GaussSeidel ( ForwardSweep ())
111
- ml = ruge_stuben (A, presmoother = smoother ,
112
- postsmoother = smoother )
118
+
119
+ ml = ruge_stuben (A, presmoother = fsmoother ,
120
+ postsmoother = fsmoother )
113
121
x = solve (ml, A * ones (100 ))
114
122
@test sum (abs2, x - zeros (100 )) < 1e-8
115
123
124
+ ml = ruge_stuben (A)
125
+ x = solve (ml, A * ones (100 ))
126
+ @test sum (abs2, x - zeros (100 )) < 1e-6
127
+
116
128
end
117
129
118
130
@testset " Preconditioning" begin
@@ -167,5 +179,34 @@ diff = x - [ 0.82365077, -0.537589 , -0.30632349, -0.19370186, -0.14773294,
167
179
0.04968258 , 0.04968737 , 0.05105749 , 0.05009268 , 0.04972329 ,
168
180
0.04970173 ]
169
181
@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
+
170
211
end
171
212
end
0 commit comments