Skip to content

Commit 8470862

Browse files
Merge pull request #2682 from jClugstor/sparsity_detection_fix
AutoSparse Detection Fix for BDF etc.
2 parents 9662d08 + 5ff4290 commit 8470862

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

lib/OrdinaryDiffEqNonlinearSolve/src/utils.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ function build_nlsolver(
181181

182182
if nlalg isa Union{NLNewton, NonlinearSolveAlg}
183183
nf = nlsolve_f(f, alg)
184-
J, W = build_J_W(alg, u, uprev, p, t, dt, f, nothing, uEltypeNoUnits, Val(true))
185184

186185
# TODO: check if the solver is iterative
187186
weight = zero(u)
@@ -199,6 +198,7 @@ function build_nlsolver(
199198
end
200199
jac_config = build_jac_config(alg, nf, uf, du1, uprev, u, ztmp, dz)
201200
end
201+
J, W = build_J_W(alg, u, uprev, p, t, dt, f, jac_config, uEltypeNoUnits, Val(true))
202202
linprob = LinearProblem(W, _vec(k); u0 = _vec(dz))
203203
Pl, Pr = wrapprecs(
204204
alg.precs(W, nothing, u, p, t, nothing, nothing, nothing,

test/interface/autosparse_detection_tests.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ prob = prob_ode_2Dlinear
1111

1212
@test_nowarn solve(prob, Rodas5P(autodiff = ad, linsolve = LinearSolve.KrylovJL_GMRES()))
1313

14+
@test_nowarn solve(prob, FBDF(autodiff = ad))
15+
1416
# Test that no dense matrices are made sparse
1517
diag_prob = ODEProblem((du, u, p, t) -> du .= -1.0 .* u, rand(Int(1e7)), (0, 1.0))
1618

0 commit comments

Comments
 (0)