@@ -79,13 +79,13 @@ function generate_chunked_partials(x,colorvec,::Val{chunksize}) where chunksize
79
79
chunked_partials
80
80
end
81
81
82
- @inline function forwarddiff_color_jacobian (f,
82
+ function forwarddiff_color_jacobian (f:: F ,
83
83
x:: AbstractArray{<:Number} ;
84
84
colorvec = 1 : length (x),
85
85
sparsity = nothing ,
86
86
jac_prototype = nothing ,
87
87
chunksize = nothing ,
88
- dx = sparsity === nothing && jac_prototype === nothing ? nothing : copy (x)) # if dx is nothing, we will estimate dx at the cost of a function call
88
+ dx = sparsity === nothing && jac_prototype === nothing ? nothing : copy (x)) where {F} # if dx is nothing, we will estimate dx at the cost of a function call
89
89
90
90
if sparsity === nothing && jac_prototype === nothing
91
91
cfg = if chunksize === nothing
95
95
ForwardDiff. JacobianConfig (f, x)
96
96
end
97
97
else
98
- ForwardDiff. JacobianConfig (f, x, ForwardDiff. Chunk ( getsize (chunksize)))
98
+ ForwardDiff. JacobianConfig (f, x, ForwardDiff. Chunk { getsize(chunksize)} ( ))
99
99
end
100
100
return ForwardDiff. jacobian (f, x, cfg)
101
101
end
@@ -105,21 +105,21 @@ end
105
105
return forwarddiff_color_jacobian (f,x,ForwardColorJacCache (f,x,chunksize,dx= dx,colorvec= colorvec,sparsity= sparsity),jac_prototype)
106
106
end
107
107
108
- @inline function forwarddiff_color_jacobian (J:: AbstractArray{<:Number} , f,
108
+ function forwarddiff_color_jacobian (J:: AbstractArray{<:Number} , f:: F ,
109
109
x:: AbstractArray{<:Number} ;
110
110
colorvec = 1 : length (x),
111
111
sparsity = nothing ,
112
112
jac_prototype = nothing ,
113
113
chunksize = nothing ,
114
- dx = similar (x, size (J, 1 ))) # dx kwarg can be used to avoid re-allocating dx every time
114
+ dx = similar (x, size (J, 1 ))) where {F} # dx kwarg can be used to avoid re-allocating dx every time
115
115
if sparsity === nothing && jac_prototype === nothing
116
116
cfg = chunksize === nothing ? ForwardDiff. JacobianConfig (f, x) : ForwardDiff. JacobianConfig (f, x, ForwardDiff. Chunk (getsize (chunksize)))
117
117
return ForwardDiff. jacobian (f, x, cfg)
118
118
end
119
119
return forwarddiff_color_jacobian (J,f,x,ForwardColorJacCache (f,x,chunksize,dx= dx,colorvec= colorvec,sparsity= sparsity))
120
120
end
121
121
122
- function forwarddiff_color_jacobian (f,x:: AbstractArray{<:Number} ,jac_cache:: ForwardColorJacCache ,jac_prototype= nothing )
122
+ function forwarddiff_color_jacobian (f:: F ,x:: AbstractArray{<:Number} ,jac_cache:: ForwardColorJacCache ,jac_prototype= nothing ) where F
123
123
124
124
if jac_prototype isa Nothing ? ArrayInterface. ismutable (x) : ArrayInterface. ismutable (jac_prototype)
125
125
# Whenever J is mutable, we mutate it to avoid allocations
@@ -136,7 +136,7 @@ function forwarddiff_color_jacobian(f,x::AbstractArray{<:Number},jac_cache::Forw
136
136
end
137
137
138
138
# When J is mutable, this version of forwarddiff_color_jacobian will mutate J to avoid allocations
139
- function forwarddiff_color_jacobian (J:: AbstractMatrix{<:Number} ,f,x:: AbstractArray{<:Number} ,jac_cache:: ForwardColorJacCache )
139
+ function forwarddiff_color_jacobian (J:: AbstractMatrix{<:Number} ,f:: F ,x:: AbstractArray{<:Number} ,jac_cache:: ForwardColorJacCache ) where F
140
140
t = jac_cache. t
141
141
dx = jac_cache. dx
142
142
p = jac_cache. p
0 commit comments