Skip to content

Commit

Permalink
fixup! fix: consider type of t0 in promote_u0
Browse files Browse the repository at this point in the history
  • Loading branch information
AayushSabharwal committed May 27, 2024
1 parent 9c375c7 commit 986a43d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/forwarddiff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,9 @@ end

@inline function promote_u0(u0, p, t0)
Tu = eltype(u0)
if Tu <: ForwardDiff.Dual
return u0
end
Tp = anyeltypedual(p)
if Tp == Any
Tp = Tu
Expand All @@ -284,6 +287,9 @@ end

@inline function promote_u0(u0::AbstractArray{<:Complex}, p, t0)
Tu = real(eltype(u0))
if Tu <: ForwardDiff.Dual
return u0
end
Tp = anyeltypedual(p)
if Tp == Any
Tp = Tu
Expand All @@ -293,7 +299,7 @@ end
Tt = Tu
end
Tcommon = promote_type(eltype(u0), Tp, Tt)
return if Tcommon <: ForwardDiff.Dual
return if real(Tcommon) <: ForwardDiff.Dual
Tcommon.(u0)
else
u0
Expand Down

0 comments on commit 986a43d

Please sign in to comment.