Skip to content

Commit 834516a

Browse files
committed
fix: partial revert of previous fix
1 parent b5981e2 commit 834516a

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/internal/helpers.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# Evaluate the residual function at a given point
22
function evaluate_f(prob::AbstractNonlinearProblem{uType, iip}, u) where {uType, iip}
3-
(; f, u0, p) = prob
3+
(; f, p) = prob
44
if iip
5-
fu = f.resid_prototype === nothing ? zero(u) :
6-
promote_type(eltype(u), eltype(f.resid_prototype)).(f.resid_prototype)
5+
fu = f.resid_prototype === nothing ? zero(u) : similar(f.resid_prototype)
76
f(fu, u, p)
87
else
98
fu = f(u, p)

src/internal/jacobian.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,10 @@ function JacobianCache(prob, alg, f::F, fu_, u, p; stats, autodiff = nothing,
9292
end
9393
end
9494
else
95-
# NOTE: don't use similar because that might lead to an unwrapped array
9695
if eltype(f.jac_prototype) <: Bool
97-
promote_type(eltype(fu), eltype(u)).(f.jac_prototype)
96+
similar(f.jac_prototype, promote_type(eltype(fu), eltype(u)))
9897
else
99-
copy(f.jac_prototype)
98+
similar(f.jac_prototype)
10099
end
101100
end
102101
end

0 commit comments

Comments
 (0)