@@ -79,13 +79,13 @@ function generate_chunked_partials(x,colorvec,::Val{chunksize}) where chunksize
7979 chunked_partials
8080end
8181
82- @inline function forwarddiff_color_jacobian (f,
82+ function forwarddiff_color_jacobian (f:: F ,
8383 x:: AbstractArray{<:Number} ;
8484 colorvec = 1 : length (x),
8585 sparsity = nothing ,
8686 jac_prototype = nothing ,
8787 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
8989
9090 if sparsity === nothing && jac_prototype === nothing
9191 cfg = if chunksize === nothing
9595 ForwardDiff. JacobianConfig (f, x)
9696 end
9797 else
98- ForwardDiff. JacobianConfig (f, x, ForwardDiff. Chunk ( getsize (chunksize)))
98+ ForwardDiff. JacobianConfig (f, x, ForwardDiff. Chunk { getsize(chunksize)} ( ))
9999 end
100100 return ForwardDiff. jacobian (f, x, cfg)
101101 end
@@ -105,21 +105,21 @@ end
105105 return forwarddiff_color_jacobian (f,x,ForwardColorJacCache (f,x,chunksize,dx= dx,colorvec= colorvec,sparsity= sparsity),jac_prototype)
106106end
107107
108- @inline function forwarddiff_color_jacobian (J:: AbstractArray{<:Number} , f,
108+ function forwarddiff_color_jacobian (J:: AbstractArray{<:Number} , f:: F ,
109109 x:: AbstractArray{<:Number} ;
110110 colorvec = 1 : length (x),
111111 sparsity = nothing ,
112112 jac_prototype = nothing ,
113113 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
115115 if sparsity === nothing && jac_prototype === nothing
116116 cfg = chunksize === nothing ? ForwardDiff. JacobianConfig (f, x) : ForwardDiff. JacobianConfig (f, x, ForwardDiff. Chunk (getsize (chunksize)))
117117 return ForwardDiff. jacobian (f, x, cfg)
118118 end
119119 return forwarddiff_color_jacobian (J,f,x,ForwardColorJacCache (f,x,chunksize,dx= dx,colorvec= colorvec,sparsity= sparsity))
120120end
121121
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
123123
124124 if jac_prototype isa Nothing ? ArrayInterface. ismutable (x) : ArrayInterface. ismutable (jac_prototype)
125125 # 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
136136end
137137
138138# 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
140140 t = jac_cache. t
141141 dx = jac_cache. dx
142142 p = jac_cache. p
0 commit comments