Skip to content

Commit ef2ab48

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

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

src/globalization/line_search.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ function __internal_init(
101101
args...; stats, internalnorm::IN = DEFAULT_NORM, kwargs...) where {F, IN}
102102
T = promote_type(eltype(fu), eltype(u))
103103
if u isa Number
104-
autodiff = get_concrete_forward_ad(alg.autodiff, prob; check_forward_mode = true)
104+
autodiff = get_dense_ad(get_concrete_forward_ad(
105+
alg.autodiff, prob; check_forward_mode = true))
105106
if !(autodiff isa AutoForwardDiff ||
106107
autodiff isa AutoPolyesterForwardDiff ||
107108
autodiff isa AutoFiniteDiff)

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)