Skip to content

Commit 077dcc9

Browse files
Fix ForwardDiff.Dual compatibility in CVHin initdt
Strip Dual tracking from hub_inv via DiffEqBase.value() so that hub → hg → hgs remain plain Float64. The step size bounds don't need AD tracking, and convert(_tType, hgs) was failing when hgs carried a Dual wrapper. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 3ff4d42 commit 077dcc9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/OrdinaryDiffEqCore/src/initdt.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,8 @@
312312
numers = @.. broadcast = false abs(f₀) * oneunit_tType
313313
hub_inv = maximum(numers ./ max.(denoms, eps(eltype(denoms))))
314314
end
315+
# Strip ForwardDiff.Dual tracking — step size bounds don't need AD
316+
hub_inv = DiffEqBase.value(hub_inv)
315317

316318
hub = convert(_tType, 0.1) * tdist
317319
if hub * hub_inv > 1
@@ -589,7 +591,7 @@ end
589591
# Upper bound: most restrictive component of |f₀| / (0.1*|u0| + tol)
590592
denoms = @.. broadcast = false convert(_tType, 0.1) * abs(u0) + sk
591593
numers = @.. broadcast = false abs(f₀) * oneunit_tType
592-
hub_inv = maximum(numers ./ max.(denoms, eps(eltype(denoms))))
594+
hub_inv = DiffEqBase.value(maximum(numers ./ max.(denoms, eps(eltype(denoms)))))
593595

594596
hub = convert(_tType, 0.1) * tdist
595597
if hub * hub_inv > 1

0 commit comments

Comments
 (0)