@@ -14,6 +14,7 @@ void_setindex!(args...) = (setindex!(args...); return)
14
14
gettag (:: Type{ForwardDiff.Dual{T}} ) where {T} = T
15
15
16
16
const default_chunk_size = ForwardDiff. pickchunksize
17
+ const SMALLTAG = ForwardDiff. Tag (missing ,Float64)
17
18
18
19
function ForwardColorJacCache (f:: F ,x,_chunksize = nothing ;
19
20
dx = nothing ,
@@ -41,7 +42,7 @@ function ForwardColorJacCache(f::F,x,_chunksize = nothing;
41
42
end
42
43
else
43
44
p = adapt .(parameterless_type (x),generate_chunked_partials (x,colorvec,chunksize))
44
- _t = Dual {T,eltype(x),length(first(first(p)))} .(vec (x),first (p))
45
+ _t = Dual {T,eltype(x),length(first(first(p)))} .(vec (x),ForwardDiff . Partials .( first (p) ))
45
46
t = ArrayInterface. restructure (x,_t)
46
47
end
47
48
@@ -52,7 +53,7 @@ function ForwardColorJacCache(f::F,x,_chunksize = nothing;
52
53
else
53
54
tup = ArrayInterface. allowed_getindex (ArrayInterface. allowed_getindex (p,1 ),1 ) .* false
54
55
_pi = adapt (parameterless_type (dx),[tup for i in 1 : length (dx)])
55
- fx = reshape (Dual {T,eltype(dx),length(tup)} .(vec (dx),_pi),size (dx)... )
56
+ fx = reshape (Dual {T,eltype(dx),length(tup)} .(vec (dx),ForwardDiff . Partials .( _pi) ),size (dx)... )
56
57
_dx = dx
57
58
end
58
59
@@ -170,7 +171,7 @@ function forwarddiff_color_jacobian(J::AbstractMatrix{<:Number},f::F,x::Abstract
170
171
171
172
for i in eachindex (p)
172
173
partial_i = p[i]
173
- t = reshape (Dual {gettag( eltype(t))} .(vecx, partial_i),size (t))
174
+ t = reshape (eltype (t).(vecx, ForwardDiff . Partials .( partial_i) ),size (t))
174
175
fx = f (t)
175
176
if ! (sparsity isa Nothing)
176
177
for j in 1 : chunksize
@@ -238,7 +239,7 @@ function forwarddiff_color_jacobian_immutable(f,x::AbstractArray{<:Number},jac_c
238
239
239
240
for i in eachindex (p)
240
241
partial_i = p[i]
241
- t = reshape (Dual {gettag( eltype(t))} .(vecx, partial_i),size (t))
242
+ t = reshape (eltype (t).(vecx, ForwardDiff . Partials .( partial_i) ),size (t))
242
243
fx = f (t)
243
244
if ! (sparsity isa Nothing)
244
245
for j in 1 : chunksize
@@ -319,10 +320,10 @@ function forwarddiff_color_jacobian!(J::AbstractMatrix{<:Number},
319
320
320
321
if vect isa Array
321
322
@inbounds @simd ivdep for j in eachindex (vect)
322
- vect[j] = Dual {gettag( eltype(t))} (vecx[j], partial_i[j])
323
+ vect[j] = eltype (t)(vecx[j], ForwardDiff . Partials ( partial_i[j]) )
323
324
end
324
325
else
325
- vect .= Dual {gettag( eltype(t))} .(vecx, partial_i)
326
+ vect .= eltype (t).(vecx, ForwardDiff . Partials .( partial_i) )
326
327
end
327
328
328
329
f (fx,t)
0 commit comments