Skip to content

Commit 88fee87

Browse files
committed
Use a weighting metric that isn't based on app. spectral radius
1 parent b31832f commit 88fee87

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/multilevel.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ function solve{T}(ml::MultiLevel, b::Vector{T},
8888
push!(residuals, T(norm(b - A * x)))
8989
end
9090

91-
@show residuals
91+
# @show residuals
9292
if log
9393
return x, residuals
9494
else

src/smoother.jl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,13 @@ end
100100

101101
struct DiagonalWeighting
102102
end
103+
struct LocalWeighting
104+
end
103105

104106
function smooth_prolongator(j::JacobiProlongation,
105107
A, T, S, B,
106108
degree = 1,
107-
weighting = DiagonalWeighting())
109+
weighting = LocalWeighting())
108110
D_inv_S = weight(weighting, A, j.ω)
109111
P = T
110112
for i = 1:degree
@@ -120,6 +122,13 @@ function weight(::DiagonalWeighting, S, ω)
120122
# (ω) * D_inv_S
121123
end
122124

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
130+
end
131+
123132
#approximate_spectral_radius(A) =
124133
# eigs(A, maxiter = 15, tol = 0.01, ritzvec = false)[1][1] |> real
125134

0 commit comments

Comments
 (0)