Skip to content

Commit 16d66b1

Browse files
committed
fix: don't use similar on prototype
1 parent d56476c commit 16d66b1

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
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/jacobian.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,13 @@ 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
96-
similar(f.jac_prototype, promote_type(eltype(fu), eltype(u)))
95+
if eltype(f.jac_prototype) <: Bool
96+
jac_proto = similar(f.jac_prototype, promote_type(eltype(fu), eltype(u)))
97+
fill!(jac_proto, false)
98+
jac_proto
9799
else
98-
similar(f.jac_prototype)
100+
f.jac_prototype
99101
end
100-
fill!(jac_proto, false)
101-
jac_proto
102102
end
103103
end
104104

0 commit comments

Comments
 (0)