Skip to content

Commit e7e218b

Browse files
Merge pull request #474 from SciML/ap/patch
fix: don't use similar on prototype
2 parents d56476c + 834516a commit e7e218b

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "NonlinearSolve"
22
uuid = "8913a72c-1f9b-4ce2-8d82-65094dcecaec"
33
authors = ["SciML"]
4-
version = "3.15.0"
4+
version = "3.15.1"
55

66
[deps]
77
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"

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: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,11 @@ function JacobianCache(prob, alg, f::F, fu_, u, p; stats, autodiff = nothing,
9292
end
9393
end
9494
else
95-
jac_proto = if eltype(f.jac_prototype) <: Bool
95+
if eltype(f.jac_prototype) <: Bool
9696
similar(f.jac_prototype, promote_type(eltype(fu), eltype(u)))
9797
else
9898
similar(f.jac_prototype)
9999
end
100-
fill!(jac_proto, false)
101-
jac_proto
102100
end
103101
end
104102

0 commit comments

Comments
 (0)