Skip to content

Commit 6af7d5e

Browse files
authored
Merge pull request #302 from h-larsson/dbg
IDRS: Move preconditioning
2 parents 02b577b + 9426d0a commit 6af7d5e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/idrs.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,12 @@ function idrs_method!(log::ConvergenceHistory, X, A, C::T,
131131
Q .+= c[i-k+1] .* U[i]
132132
end
133133

134-
# Preconditioning
135-
ldiv!(Pl, V)
136-
137134
# Compute new U[:,k] and G[:,k], G[:,k] is in space G_j
138135
V .= R .- V
139136

137+
# Preconditioning
138+
ldiv!(Pl, V)
139+
140140
U[k] .= Q .+ om .* V
141141
mul!(G[k], A, U[k])
142142

test/idrs.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ end
5151
@test history.isconverged
5252
@test norm(A * x - b) / norm(b) reltol
5353

54-
Apre = lu(A)
54+
Apre = lu(droptol!(copy(A), 0.1)) # inexact preconditioner
5555
xpre, historypre = idrs(A, b, Pl = Apre, log=true)
5656
@test historypre.isconverged
5757
@test norm(A * xpre - b) / norm(b) reltol
5858

5959
@test isapprox(x, xpre, rtol = 1e-3)
60-
@test historypre.iters < history.iters
60+
@test historypre.iters < 0.5history.iters
6161

6262
end
6363

0 commit comments

Comments
 (0)