Skip to content

Commit 33db259

Browse files
committed
test: precs need concrete jacobian
1 parent 8762dcc commit 33db259

File tree

1 file changed

+26
-16
lines changed

1 file changed

+26
-16
lines changed

lib/NonlinearSolveFirstOrder/test/rootfind_tests.jl

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,22 @@ end
3838
@testset "[IIP] u0: $(typeof(u0))" for u0 in ([1.0, 1.0],)
3939
ad isa AutoZygote && continue
4040

41-
@testset for linsolve in (
42-
nothing,
43-
KrylovJL_GMRES(; precs = nothing),
44-
KrylovJL_GMRES(;
45-
precs = (A, p = nothing) -> (
46-
Diagonal(randn!(similar(A, size(A, 1)))), LinearAlgebra.I
41+
@testset for (concrete_jac, linsolve) in (
42+
(Val(false), nothing),
43+
(Val(false), KrylovJL_GMRES(; precs = nothing)),
44+
(
45+
Val(true),
46+
KrylovJL_GMRES(;
47+
precs = (A, p = nothing) -> (
48+
Diagonal(randn!(similar(A, size(A, 1)))), LinearAlgebra.I
49+
)
4750
)
4851
),
49-
\
52+
(Val(false), \)
5053
)
51-
solver = NewtonRaphson(; linsolve, linesearch, autodiff = ad)
54+
solver = NewtonRaphson(;
55+
linsolve, linesearch, autodiff = ad, concrete_jac
56+
)
5257

5358
sol = solve_iip(quadratic_f!, u0; solver)
5459
@test SciMLBase.successful_retcode(sol)
@@ -114,17 +119,22 @@ end
114119
@testset "[IIP] u0: $(typeof(u0))" for u0 in ([1.0, 1.0],)
115120
ad isa AutoZygote && continue
116121

117-
@testset for linsolve in (
118-
nothing,
119-
KrylovJL_GMRES(; precs = nothing),
120-
KrylovJL_GMRES(;
121-
precs = (A, p = nothing) -> (
122-
Diagonal(randn!(similar(A, size(A, 1)))), LinearAlgebra.I
122+
@testset for (concrete_jac, linsolve) in (
123+
(Val(false), nothing),
124+
(Val(false), KrylovJL_GMRES(; precs = nothing)),
125+
(
126+
Val(true),
127+
KrylovJL_GMRES(;
128+
precs = (A, p = nothing) -> (
129+
Diagonal(randn!(similar(A, size(A, 1)))), LinearAlgebra.I
130+
)
123131
)
124132
),
125-
\
133+
(Val(false), \)
126134
)
127-
solver = PseudoTransient(; alpha_initial = 10.0, linsolve, autodiff = ad)
135+
solver = PseudoTransient(;
136+
alpha_initial = 10.0, linsolve, autodiff = ad, concrete_jac
137+
)
128138
sol = solve_iip(quadratic_f!, u0; solver)
129139
@test SciMLBase.successful_retcode(sol)
130140
err = maximum(abs, quadratic_f(sol.u, 2.0))

0 commit comments

Comments
 (0)