From fd6c5c6502fe762169976619da5c8b8b7ee32d03 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Tue, 24 Dec 2019 15:54:03 -0500 Subject: [PATCH 1/4] Make the tag be a ForwardDiff.Tag type --- src/differentiation/compute_jacobian_ad.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/differentiation/compute_jacobian_ad.jl b/src/differentiation/compute_jacobian_ad.jl index 29b167b6..f8bdcb12 100644 --- a/src/differentiation/compute_jacobian_ad.jl +++ b/src/differentiation/compute_jacobian_ad.jl @@ -31,7 +31,7 @@ function ForwardColorJacCache(f,x,_chunksize = nothing; end p = adapt.(typeof(x),generate_chunked_partials(x,colorvec,chunksize)) - t = reshape(Dual{typeof(f)}.(vec(x),first(p)),size(x)...) + t = reshape(Dual{ForwardDiff.Tag(typeof(f),typeof(vec(x)))}.(vec(x),first(p)),size(x)...) if dx isa Nothing fx = similar(t) From 98d1e05baa3e398bc485a44397e3cfd3816a227f Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Wed, 25 Dec 2019 05:29:57 -0500 Subject: [PATCH 2/4] Update compute_jacobian_ad.jl --- src/differentiation/compute_jacobian_ad.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/differentiation/compute_jacobian_ad.jl b/src/differentiation/compute_jacobian_ad.jl index f8bdcb12..9336056e 100644 --- a/src/differentiation/compute_jacobian_ad.jl +++ b/src/differentiation/compute_jacobian_ad.jl @@ -31,7 +31,7 @@ function ForwardColorJacCache(f,x,_chunksize = nothing; end p = adapt.(typeof(x),generate_chunked_partials(x,colorvec,chunksize)) - t = reshape(Dual{ForwardDiff.Tag(typeof(f),typeof(vec(x)))}.(vec(x),first(p)),size(x)...) + t = reshape(Dual{ForwardDiff.Tag(f,vec(x)}.(vec(x),first(p)),size(x)...) if dx isa Nothing fx = similar(t) From 034fe5af6fe5ac48a1a2656f1dda0498d4c3c43b Mon Sep 17 00:00:00 2001 From: Chris Rackauckas Date: Wed, 25 Dec 2019 05:52:08 -0500 Subject: [PATCH 3/4] fix Dual tags --- src/differentiation/compute_jacobian_ad.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/differentiation/compute_jacobian_ad.jl b/src/differentiation/compute_jacobian_ad.jl index 9336056e..7c9d36c6 100644 --- a/src/differentiation/compute_jacobian_ad.jl +++ b/src/differentiation/compute_jacobian_ad.jl @@ -31,7 +31,7 @@ function ForwardColorJacCache(f,x,_chunksize = nothing; end p = adapt.(typeof(x),generate_chunked_partials(x,colorvec,chunksize)) - t = reshape(Dual{ForwardDiff.Tag(f,vec(x)}.(vec(x),first(p)),size(x)...) + t = reshape(Dual{ForwardDiff.Tag(f,eltype(vec(x)))}.(vec(x),first(p)),size(x)...) if dx isa Nothing fx = similar(t) @@ -43,7 +43,7 @@ function ForwardColorJacCache(f,x,_chunksize = nothing; else pi = pi[1:length(dx)] end - fx = reshape(Dual{typeof(f)}.(vec(dx),pi),size(dx)...) + fx = reshape(Dual{ForwardDiff.Tag(f,eltype(vec(x)))}.(vec(dx),pi),size(dx)...) _dx = dx end @@ -99,7 +99,7 @@ function forwarddiff_color_jacobian(f,x::AbstractArray{<:Number},jac_cache::Forw for i in eachindex(p) partial_i = p[i] - t = reshape(Dual{typeof(f)}.(vecx, partial_i),size(t)) + t = reshape(Dual{ForwardDiff.Tag(f,eltype(vecx))}.(vecx, partial_i),size(t)) fx = f(t) if !(sparsity isa Nothing) for j in 1:chunksize @@ -169,7 +169,7 @@ function forwarddiff_color_jacobian!(J::AbstractMatrix{<:Number}, for i in eachindex(p) partial_i = p[i] - vect .= Dual{typeof(f)}.(vecx, partial_i) + vect .= Dual{ForwardDiff.Tag(f,eltype(vecx))}.(vecx, partial_i) f(fx,t) if !(sparsity isa Nothing) for j in 1:chunksize From 7fc6792e35ca1f8d120ee3310eca4d65bbd3aca8 Mon Sep 17 00:00:00 2001 From: Chris Rackauckas Date: Wed, 25 Dec 2019 05:57:31 -0500 Subject: [PATCH 4/4] patch release --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index dd836c7d..308f4663 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "SparseDiffTools" uuid = "47a9eef4-7e08-11e9-0b38-333d64bd3804" authors = ["Pankaj Mishra ", "Chris Rackauckas "] -version = "1.1.0" +version = "1.1.1" [deps] Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"