Skip to content

Commit

Permalink
fix: minor test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
avik-pal committed Sep 27, 2024
1 parent be0f8da commit 19182ae
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 8 additions & 3 deletions src/internal/jacobian.jl
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,15 @@ function JacobianCache(prob, alg, f::F, fu_, u, p; stats, autodiff = nothing,
# While this is technically wasteful, it gives out the type of the Jacobian
# which is needed to create the linear solver cache
stats.njacs += 1
if iip
DI.jacobian(f, fu, di_extras, autodiff, u, Constant(p))
if has_analytic_jac
__similar(
fu, promote_type(eltype(fu), eltype(u)), length(fu), length(u))
else
DI.jacobian(f, autodiff, u, Constant(p))
if iip
DI.jacobian(f, fu, di_extras, autodiff, u, Constant(p))
else
DI.jacobian(f, autodiff, u, Constant(p))
end
end
else
zero(init_jacobian(sdifft_extras; preserve_immutable = Val(true)))
Expand Down
4 changes: 2 additions & 2 deletions test/misc/bruss_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@

cache = init(
prob_brusselator_2d, NewtonRaphson(; autodiff = AutoSparse(AutoForwardDiff())))
@test maximum(cache.sdifft_extras.jac_cache.coloring.colorvec) == 12
@test cache.sdifft_extras.autodiff isa AutoSparse{<:AutoForwardDiff}
@test maximum(cache.jac_cache.sdifft_extras.coloring.colorvec) == 12
@test cache.jac_cache.autodiff isa AutoSparse{<:AutoForwardDiff}
end

0 comments on commit 19182ae

Please sign in to comment.