@@ -104,23 +104,13 @@ Base.eltype(cfg::AbstractConfig) = eltype(typeof(cfg))
104
104
@inline (chunksize (:: AbstractConfig{N} ):: Int ) where {N} = N
105
105
106
106
function maketag (tagstyle:: Union{Symbol,Nothing} , f, X)
107
- if tagstyle === :default
108
- @static if VERSION ≥ v " 1.11"
109
- return HashTag (f, X)
110
- else
111
- # On ≤1.10, the hash of a type cannot be computed at compile-time,
112
- # making `HashTag(...)` type-unstable, so `Tag(...)` is left as
113
- # as the default.
114
- return Tag (f, X)
115
- end
116
- elseif tagstyle === :type
117
- return Tag (f, X)
118
- elseif tagstyle === :hash
107
+ @static if VERSION ≥ v " 1.11"
119
108
return HashTag (f, X)
120
- elseif tagstyle === nothing
121
- return nothing
122
109
else
123
- throw (ArgumentError (" tag may be :default, :type, :hash, or nothing" ))
110
+ # On ≤1.10, the hash of a type cannot be computed at compile-time,
111
+ # making `HashTag(...)` type-unstable, so `Tag(...)` is left as
112
+ # as the default.
113
+ return Tag (f, X)
124
114
end
125
115
end
126
116
@@ -133,7 +123,7 @@ struct DerivativeConfig{T,D} <: AbstractConfig{1}
133
123
end
134
124
135
125
"""
136
- ForwardDiff.DerivativeConfig(f!, y::AbstractArray, x::Real; tagstyle::Union{Symbol,Nothing} = :default )
126
+ ForwardDiff.DerivativeConfig(f!, y::AbstractArray, x::Real)
137
127
138
128
Return a `DerivativeConfig` instance based on the type of `f!`, and the types/shapes of the
139
129
output vector `y` and the input value `x`.
@@ -153,16 +143,9 @@ This constructor does not store/modify `y` or `x`.
153
143
"""
154
144
@inline function DerivativeConfig (f:: F ,
155
145
y:: AbstractArray{Y} ,
156
- x:: X ;
157
- tagstyle:: Union{Symbol,Nothing} = :default ) where {F,X<: Real ,Y<: Real }
158
- # @inline ensures that, e.g., DerivativeConfig(...; tagstyle = :small) will be well-inferred
159
- @static if VERSION ≥ v " 1.8"
160
- T = @inline maketag (tagstyle, f, X)
161
- return @noinline DerivativeConfig (f,y,x,T)
162
- else
163
- T = maketag (tagstyle, f, X)
164
- return DerivativeConfig (f,y,x,T)
165
- end
146
+ x:: X ) where {F,X<: Real ,Y<: Real }
147
+ T = maketag (f, X)
148
+ return DerivativeConfig (f,y,x,T)
166
149
end
167
150
168
151
function DerivativeConfig (f:: F ,
@@ -186,7 +169,7 @@ struct GradientConfig{T,V,N,D} <: AbstractConfig{N}
186
169
end
187
170
188
171
"""
189
- ForwardDiff.GradientConfig(f, x::AbstractArray, chunk::Chunk = Chunk(x); tagstyle::Union{Symbol,Nothing} = :default )
172
+ ForwardDiff.GradientConfig(f, x::AbstractArray, chunk::Chunk = Chunk(x))
190
173
191
174
Return a `GradientConfig` instance based on the type of `f` and type/shape of the input
192
175
vector `x`.
@@ -205,16 +188,9 @@ This constructor does not store/modify `x`.
205
188
"""
206
189
@inline function GradientConfig (f:: F ,
207
190
x:: AbstractArray{V} ,
208
- c:: Chunk{N} = Chunk (x);
209
- tagstyle:: Union{Symbol,Nothing} = :default ) where {F,V,N}
210
- # @inline ensures that, e.g., GradientConfig(...; tagstyle = :small) will be well-inferred
211
- @static if VERSION ≥ v " 1.8"
212
- T = @inline maketag (tagstyle, f, V)
213
- return @noinline GradientConfig (f,x,c,T)
214
- else
215
- T = maketag (tagstyle, f, V)
216
- return GradientConfig (f,x,c,T)
217
- end
191
+ c:: Chunk{N} = Chunk (x)) where {F,V,N}
192
+ T = maketag (f, V)
193
+ return GradientConfig (f,x,c,T)
218
194
end
219
195
220
196
function GradientConfig (f:: F ,
@@ -239,7 +215,7 @@ struct JacobianConfig{T,V,N,D} <: AbstractConfig{N}
239
215
end
240
216
241
217
"""
242
- ForwardDiff.JacobianConfig(f, x::AbstractArray, chunk::Chunk = Chunk(x); tagstyle::Union{Symbol,Nothing} = :default )
218
+ ForwardDiff.JacobianConfig(f, x::AbstractArray, chunk::Chunk = Chunk(x))
243
219
244
220
Return a `JacobianConfig` instance based on the type of `f` and type/shape of the input
245
221
vector `x`.
@@ -259,16 +235,9 @@ This constructor does not store/modify `x`.
259
235
"""
260
236
@inline function JacobianConfig (f:: F ,
261
237
x:: AbstractArray{V} ,
262
- c:: Chunk{N} = Chunk (x);
263
- tagstyle:: Union{Symbol,Nothing} = :default ) where {F,V,N}
264
- # @inline ensures that, e.g., JacobianConfig(...; tagstyle = :small) will be well-inferred
265
- @static if VERSION ≥ v " 1.8"
266
- T = @inline maketag (tagstyle, f, V)
267
- return @noinline JacobianConfig (f,x,c,T)
268
- else
269
- T = maketag (tagstyle, f, V)
270
- return JacobianConfig (f,x,c,T)
271
- end
238
+ c:: Chunk{N} = Chunk (x)) where {F,V,N}
239
+ T = maketag (f, V)
240
+ return JacobianConfig (f,x,c,T)
272
241
end
273
242
274
243
function JacobianConfig (f:: F ,
@@ -281,7 +250,7 @@ function JacobianConfig(f::F,
281
250
end
282
251
283
252
"""
284
- ForwardDiff.JacobianConfig(f!, y::AbstractArray, x::AbstractArray, chunk::Chunk = Chunk(x); tagstyle::Union{Symbol,Nothing} = :default )
253
+ ForwardDiff.JacobianConfig(f!, y::AbstractArray, x::AbstractArray, chunk::Chunk = Chunk(x))
285
254
286
255
Return a `JacobianConfig` instance based on the type of `f!`, and the types/shapes of the
287
256
output vector `y` and the input vector `x`.
@@ -302,16 +271,9 @@ This constructor does not store/modify `y` or `x`.
302
271
@inline function JacobianConfig (f:: F ,
303
272
y:: AbstractArray{Y} ,
304
273
x:: AbstractArray{X} ,
305
- c:: Chunk{N} = Chunk (x);
306
- tagstyle:: Union{Symbol,Nothing} = :default ) where {F,Y,X,N}
307
- # @inline ensures that, e.g., JacobianConfig(...; tagstyle = :small) will be well-inferred
308
- @static if VERSION ≥ v " 1.8"
309
- T = @inline maketag (tagstyle, f, X)
310
- return @noinline JacobianConfig (f,y,x,c,T)
311
- else
312
- T = maketag (tagstyle, f, X)
313
- return JacobianConfig (f,y,x,c,T)
314
- end
274
+ c:: Chunk{N} = Chunk (x)) where {F,Y,X,N}
275
+ T = maketag (f, X)
276
+ return JacobianConfig (f,y,x,c,T)
315
277
end
316
278
317
279
function JacobianConfig (f:: F ,
@@ -339,7 +301,7 @@ struct HessianConfig{T,V,N,DG,DJ} <: AbstractConfig{N}
339
301
end
340
302
341
303
"""
342
- ForwardDiff.HessianConfig(f, x::AbstractArray, chunk::Chunk = Chunk(x); tagstyle::Union{Symbol,Nothing} = :default )
304
+ ForwardDiff.HessianConfig(f, x::AbstractArray, chunk::Chunk = Chunk(x))
343
305
344
306
Return a `HessianConfig` instance based on the type of `f` and type/shape of the input
345
307
vector `x`.
@@ -361,16 +323,9 @@ This constructor does not store/modify `x`.
361
323
"""
362
324
@inline function HessianConfig (f:: F ,
363
325
x:: AbstractArray{V} ,
364
- chunk:: Chunk = Chunk (x);
365
- tagstyle:: Union{Symbol,Nothing} = :default ) where {F,V}
366
- # @inline ensures that, e.g., HessianConfig(...; tagstyle = :small) will be well-inferred
367
- @static if VERSION ≥ v " 1.8"
368
- T = @inline maketag (tagstyle, f, V)
369
- return @noinline HessianConfig (f, x, chunk, T)
370
- else
371
- T = maketag (tagstyle, f, V)
372
- return HessianConfig (f, x, chunk, T)
373
- end
326
+ chunk:: Chunk = Chunk (x)) where {F,V}
327
+ T = maketag (f, V)
328
+ return HessianConfig (f, x, chunk, T)
374
329
end
375
330
376
331
function HessianConfig (f:: F ,
@@ -383,7 +338,7 @@ function HessianConfig(f::F,
383
338
end
384
339
385
340
"""
386
- ForwardDiff.HessianConfig(f, result::DiffResult, x::AbstractArray, chunk::Chunk = Chunk(x); tagstyle::Union{Symbol,Nothing} = :default )
341
+ ForwardDiff.HessianConfig(f, result::DiffResult, x::AbstractArray, chunk::Chunk = Chunk(x))
387
342
388
343
Return a `HessianConfig` instance based on the type of `f`, types/storage in `result`, and
389
344
type/shape of the input vector `x`.
@@ -403,16 +358,9 @@ This constructor does not store/modify `x`.
403
358
@inline function HessianConfig (f:: F ,
404
359
result:: DiffResult ,
405
360
x:: AbstractArray{V} ,
406
- chunk:: Chunk = Chunk (x);
407
- tagstyle:: Union{Symbol,Nothing} = :default ) where {F,V}
408
- # @inline ensures that, e.g., HessianConfig(...; tagstyle = :small) will be well-inferred
409
- @static if VERSION ≥ v " 1.8"
410
- T = @inline maketag (tagstyle, f, V)
411
- return @noinline HessianConfig (f, result, x, chunk, T)
412
- else
413
- T = maketag (tagstyle, f, V)
414
- return HessianConfig (f, result, x, chunk, T)
415
- end
361
+ chunk:: Chunk = Chunk (x)) where {F,V}
362
+ T = maketag (f, V)
363
+ return HessianConfig (f, result, x, chunk, T)
416
364
end
417
365
418
366
function HessianConfig (f:: F ,
0 commit comments