Skip to content

Commit f178568

Browse files
Merge pull request #195 from JuliaDiff/tags
allow for setting tags in operators
2 parents 2b70cd9 + be69ae1 commit f178568

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-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 = "SparseDiffTools"
22
uuid = "47a9eef4-7e08-11e9-0b38-333d64bd3804"
33
authors = ["Pankaj Mishra <[email protected]>", "Chris Rackauckas <[email protected]>"]
4-
version = "1.25.1"
4+
version = "1.25.2"
55

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

src/differentiation/jaches_products.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,10 @@ struct JacVec{F,T1,T2,xType}
195195
autodiff::Bool
196196
end
197197

198-
function JacVec(f, x::AbstractArray; autodiff = true)
198+
function JacVec(f, x::AbstractArray, tag = DeivVecTag(); autodiff = true)
199199
if autodiff
200-
cache1 = Dual{typeof(ForwardDiff.Tag(DeivVecTag(),eltype(x))),eltype(x),1}.(x, ForwardDiff.Partials.(tuple.(x)))
201-
cache2 = Dual{typeof(ForwardDiff.Tag(DeivVecTag(),eltype(x))),eltype(x),1}.(x, ForwardDiff.Partials.(tuple.(x)))
200+
cache1 = Dual{typeof(ForwardDiff.Tag(tag,eltype(x))),eltype(x),1}.(x, ForwardDiff.Partials.(tuple.(x)))
201+
cache2 = Dual{typeof(ForwardDiff.Tag(tag,eltype(x))),eltype(x),1}.(x, ForwardDiff.Partials.(tuple.(x)))
202202
else
203203
cache1 = similar(x)
204204
cache2 = similar(x)
@@ -264,10 +264,10 @@ struct HesVecGrad{G,T1,T2,uType}
264264
autodiff::Bool
265265
end
266266

267-
function HesVecGrad(g, x::AbstractArray; autodiff = false)
267+
function HesVecGrad(g, x::AbstractArray, tag = DeivVecTag(); autodiff = false)
268268
if autodiff
269-
cache1 = Dual{typeof(ForwardDiff.Tag(DeivVecTag(),eltype(x))),eltype(x),1}.(x, ForwardDiff.Partials.(tuple.(x)))
270-
cache2 = Dual{typeof(ForwardDiff.Tag(DeivVecTag(),eltype(x))),eltype(x),1}.(x, ForwardDiff.Partials.(tuple.(x)))
269+
cache1 = Dual{typeof(ForwardDiff.Tag(tag,eltype(x))),eltype(x),1}.(x, ForwardDiff.Partials.(tuple.(x)))
270+
cache2 = Dual{typeof(ForwardDiff.Tag(tag,eltype(x))),eltype(x),1}.(x, ForwardDiff.Partials.(tuple.(x)))
271271
else
272272
cache1 = similar(x)
273273
cache2 = similar(x)

0 commit comments

Comments
 (0)