@@ -18,8 +18,11 @@ presmoother!(s, A, x, b) = smoother!(s, s.sweep, A, x, b)
1818postsmoother! (s, A, x, b) = smoother! (s, s. sweep, A, x, b)
1919relax! (s, A, x, b) = smoother! (s, s. sweep, A, x, b)
2020
21- smoother! (s:: GaussSeidel , :: ForwardSweep , A, x, b) =
22- gs! (A, b, x, 1 , 1 , size (A, 1 ))
21+ function smoother! (s:: GaussSeidel , :: ForwardSweep , A, x, b)
22+ for i in 1 : s. iter
23+ gs! (A, b, x, 1 , 1 , size (A, 1 ))
24+ end
25+ end
2326
2427function smoother! (s:: GaussSeidel , :: SymmetricSweep , A, x, b)
2528 for i in 1 : s. iter
@@ -28,8 +31,11 @@ function smoother!(s::GaussSeidel, ::SymmetricSweep, A, x, b)
2831 end
2932end
3033
31- smoother! (s:: GaussSeidel , :: BackwardSweep , A, x, b) =
32- gs! (A, b, x, size (A,1 ), - 1 , 1 )
34+ function smoother! (s:: GaussSeidel , :: BackwardSweep , A, x, b)
35+ for i in 1 : s. iter
36+ gs! (A, b, x, size (A,1 ), - 1 , 1 )
37+ end
38+ end
3339
3440
3541function gs! (A, b, x, start, step, stop)
94100
95101struct DiagonalWeighting
96102end
103+ struct LocalWeighting
104+ end
97105
98106function smooth_prolongator (j:: JacobiProlongation ,
99107 A, T, S, B,
100108 degree = 1 ,
101- weighting = DiagonalWeighting ())
109+ weighting = LocalWeighting ())
102110 D_inv_S = weight (weighting, A, j. ω)
103111 P = T
104112 for i = 1 : degree
@@ -111,7 +119,14 @@ function weight(::DiagonalWeighting, S, ω)
111119 D_inv = 1 ./ diag (S)
112120 D_inv_S = scale_rows (S, D_inv)
113121 (eltype (S)(ω) / approximate_spectral_radius (D_inv_S)) * D_inv_S
114- # (ω) * D_inv_S
122+ # (ω) * D_inv_S
123+ end
124+
125+ function weight (:: LocalWeighting , S, ω)
126+ D = abs .(S) * ones (size (S, 1 ))
127+ D_inv = 1 ./ D[find (D)]
128+ D_inv_S = scale_rows (S, D_inv)
129+ eltype (S)(ω) * D_inv_S
115130end
116131
117132# approximate_spectral_radius(A) =
@@ -127,4 +142,4 @@ function scale_rows!(ret, S, v)
127142 end
128143 ret
129144end
130- scale_rows (S, v) = scale_rows! (deepcopy (S), S, v)
145+ scale_rows (S, v) = scale_rows! (deepcopy (S), S, v)
0 commit comments