Skip to content

Commit 6302183

Browse files
committed
Add a test with Left Preconditioner
1 parent 913231f commit 6302183

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

test/basictests.jl

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ sol = benchmark_scalar(sf, csu0)
4747
# @test (@ballocated benchmark_mutable(ff, cu0)) < 200
4848
# @test (@ballocated benchmark_scalar(sf, csu0)) < 400
4949

50-
function benchmark_inplace(f, u0, linsolve)
50+
function benchmark_inplace(f, u0, linsolve, precs)
5151
probN = NonlinearProblem{true}(f, u0)
52-
solver = init(probN, NewtonRaphson(; linsolve), abstol = 1e-9)
52+
solver = init(probN, NewtonRaphson(; linsolve, precs), abstol = 1e-9)
5353
sol = solve!(solver)
5454
end
5555

@@ -58,8 +58,13 @@ function ffiip(du, u, p)
5858
end
5959
u0 = [1.0, 1.0]
6060

61-
for linsolve in (nothing, KrylovJL_GMRES())
62-
sol = benchmark_inplace(ffiip, u0, linsolve)
61+
precs = [
62+
NonlinearSolve.DEFAULT_PRECS,
63+
(args...) -> (Diagonal(rand!(similar(u0))), nothing)
64+
]
65+
66+
for prec in precs, linsolve in (nothing, KrylovJL_GMRES())
67+
sol = benchmark_inplace(ffiip, u0, linsolve, prec)
6368
@test sol.retcode === ReturnCode.Success
6469
@test all(abs.(sol.u .* sol.u .- 2) .< 1e-9)
6570
end

0 commit comments

Comments
 (0)