Skip to content
This repository was archived by the owner on Aug 22, 2025. It is now read-only.

Commit 25ca2e0

Browse files
hotfix dx type
1 parent 94c4199 commit 25ca2e0

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "SparseDiffTools"
22
uuid = "47a9eef4-7e08-11e9-0b38-333d64bd3804"
33
authors = ["Pankaj Mishra <pankajmishra1511@gmail.com>", "Chris Rackauckas <contact@chrisrackauckas.com>"]
4-
version = "0.10.2"
4+
version = "0.10.3"
55

66
[deps]
77
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"

src/differentiation/compute_jacobian_ad.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ end
6666

6767
function forwarddiff_color_jacobian(f,
6868
x::AbstractArray{<:Number};
69-
dx = similar(x), #if dx is nothing, we will estimate dx at the cost of a function call
69+
dx = copy(x), #if dx is nothing, we will estimate dx at the cost of a function call
7070
colorvec = 1:length(x),
7171
sparsity = nothing,
7272
jac_prototype = nothing)
@@ -87,7 +87,7 @@ function forwarddiff_color_jacobian(f,x::AbstractArray{<:Number},jac_cache::Forw
8787
maxcolor = maximum(colorvec)
8888

8989
vecx = vec(x)
90-
90+
9191
J = jac_prototype isa Nothing ? (sparsity isa Nothing ? false .* vec(dx) .* vecx' : zeros(eltype(x),size(sparsity))) : zero(jac_prototype)
9292
nrows,ncols = size(J)
9393

test/test_ad.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,4 +224,4 @@ forwarddiff_color_jacobian!(J,iipf,x,dx=similar(x))
224224
x = SVector{1}([1.])
225225
f(x) = x
226226
J = forwarddiff_color_jacobian(f,x)
227-
@test J SMatrix{1,1}([1.])
227+
@test J SMatrix{1,1}([1.])

0 commit comments

Comments
 (0)