Skip to content

Commit b5981e2

Browse files
committed
fix: use a copy
1 parent 16d66b1 commit b5981e2

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/internal/jacobian.jl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,11 @@ 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
9596
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
97+
promote_type(eltype(fu), eltype(u)).(f.jac_prototype)
9998
else
100-
f.jac_prototype
99+
copy(f.jac_prototype)
101100
end
102101
end
103102
end

0 commit comments

Comments
 (0)