Skip to content

Commit 19182ae

Browse files
committed
fix: minor test fixes
1 parent be0f8da commit 19182ae

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/internal/jacobian.jl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,15 @@ function JacobianCache(prob, alg, f::F, fu_, u, p; stats, autodiff = nothing,
9999
# While this is technically wasteful, it gives out the type of the Jacobian
100100
# which is needed to create the linear solver cache
101101
stats.njacs += 1
102-
if iip
103-
DI.jacobian(f, fu, di_extras, autodiff, u, Constant(p))
102+
if has_analytic_jac
103+
__similar(
104+
fu, promote_type(eltype(fu), eltype(u)), length(fu), length(u))
104105
else
105-
DI.jacobian(f, autodiff, u, Constant(p))
106+
if iip
107+
DI.jacobian(f, fu, di_extras, autodiff, u, Constant(p))
108+
else
109+
DI.jacobian(f, autodiff, u, Constant(p))
110+
end
106111
end
107112
else
108113
zero(init_jacobian(sdifft_extras; preserve_immutable = Val(true)))

test/misc/bruss_tests.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,6 @@
7373

7474
cache = init(
7575
prob_brusselator_2d, NewtonRaphson(; autodiff = AutoSparse(AutoForwardDiff())))
76-
@test maximum(cache.sdifft_extras.jac_cache.coloring.colorvec) == 12
77-
@test cache.sdifft_extras.autodiff isa AutoSparse{<:AutoForwardDiff}
76+
@test maximum(cache.jac_cache.sdifft_extras.coloring.colorvec) == 12
77+
@test cache.jac_cache.autodiff isa AutoSparse{<:AutoForwardDiff}
7878
end

0 commit comments

Comments
 (0)