Skip to content

Commit

Permalink
fix: partial revert of previous fix
Browse files Browse the repository at this point in the history
  • Loading branch information
avik-pal committed Oct 5, 2024
1 parent b5981e2 commit 834516a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions src/internal/helpers.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Evaluate the residual function at a given point
function evaluate_f(prob::AbstractNonlinearProblem{uType, iip}, u) where {uType, iip}
(; f, u0, p) = prob
(; f, p) = prob
if iip
fu = f.resid_prototype === nothing ? zero(u) :
promote_type(eltype(u), eltype(f.resid_prototype)).(f.resid_prototype)
fu = f.resid_prototype === nothing ? zero(u) : similar(f.resid_prototype)
f(fu, u, p)
else
fu = f(u, p)
Expand Down
5 changes: 2 additions & 3 deletions src/internal/jacobian.jl
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,10 @@ function JacobianCache(prob, alg, f::F, fu_, u, p; stats, autodiff = nothing,
end
end
else
# NOTE: don't use similar because that might lead to an unwrapped array
if eltype(f.jac_prototype) <: Bool
promote_type(eltype(fu), eltype(u)).(f.jac_prototype)
similar(f.jac_prototype, promote_type(eltype(fu), eltype(u)))
else
copy(f.jac_prototype)
similar(f.jac_prototype)
end
end
end
Expand Down

0 comments on commit 834516a

Please sign in to comment.