@@ -244,7 +244,7 @@ forwarddiff_color_jacobian!(J::AbstractMatrix{<:Number},
244244` dx ` is a pre-allocated output vector which is used to declare the output size,
245245and thus allows for specifying a non-square Jacobian.
246246
247- Also, it is possible retrieve the function value via ` value(jac_cache) ` or
247+ Also, it is possible retrieve the function value via ` value(jac_cache) ` or
248248` value!(result, jac_cache) `
249249
250250
@@ -276,7 +276,7 @@ H = numauto_color_hessian(f, x, colorvec, sparsity)
276276numauto_color_hessian! (H, f, x, colorvec, sparsity)
277277```
278278
279- To avoid unnecessary allocations every time the Hessian is computed,
279+ To avoid unnecessary allocations every time the Hessian is computed,
280280construct a ` ForwardColorHesCache ` beforehand:
281281
282282``` julia
@@ -286,7 +286,7 @@ numauto_color_hessian!(H, f, x, hescache)
286286
287287By default, these methods use a mix of numerical and automatic differentiation,
288288namely by taking finite differences of gradients calculated via ForwardDiff.jl.
289- Alternatively, if you have your own custom gradient function ` g! ` , you can specify
289+ Alternatively, if you have your own custom gradient function ` g! ` , you can specify
290290it as an argument to ` ForwardColorHesCache ` :
291291
292292``` julia
@@ -295,7 +295,6 @@ hescache = ForwardColorHesCache(f, x, colorvec, sparsity, g!)
295295Note that any user-defined gradient needs to have the signature ` g!(G, x) ` ,
296296i.e. updating the gradient ` G ` in place.
297297
298-
299298### Jacobian-Vector and Hessian-Vector Products
300299
301300Matrix-free implementations of Jacobian-Vector and Hessian-Vector products is
@@ -316,7 +315,8 @@ auto_jacvec(f, x, v)
316315
317316# If compute_f0 is false, then `f(cache1,x)` will be computed
318317num_jacvec! (dy,f,x,v,cache1 = similar (v),
319- cache2 = similar (v);
318+ cache2 = similar (v),
319+ cache3 = similar (v);
320320 compute_f0 = true )
321321num_jacvec (f,x,v,f0= nothing )
322322```
@@ -327,14 +327,16 @@ For Hessians, the following are provided:
327327num_hesvec! (dy,f,x,v,
328328 cache1 = similar (v),
329329 cache2 = similar (v),
330- cache3 = similar (v))
330+ cache3 = similar (v),
331+ cache4 = similar (v))
331332
332333num_hesvec (f,x,v)
333334
334335numauto_hesvec! (dy,f,x,v,
335336 cache = ForwardDiff. GradientConfig (f,v),
336337 cache1 = similar (v),
337- cache2 = similar (v))
338+ cache2 = similar (v),
339+ cache3 = similar (v))
338340
339341numauto_hesvec (f,x,v)
340342
@@ -352,6 +354,7 @@ respectively:
352354
353355``` julia
354356num_hesvecgrad! (dy,g,x,v,
357+ cache1 = similar (v),
355358 cache2 = similar (v),
356359 cache3 = similar (v))
357360
@@ -378,7 +381,8 @@ using Zygote # Required
378381
379382numback_hesvec! (dy,f,x,v,
380383 cache1 = similar (v),
381- cache2 = similar (v))
384+ cache2 = similar (v),
385+ cache3 = similar (v))
382386
383387numback_hesvec (f,x,v)
384388
@@ -390,7 +394,7 @@ autoback_hesvec!(dy,f,x,v,
390394autoback_hesvec (f,x,v)
391395```
392396
393- #### J* v and H* v Operators
397+ #### ` J*v ` and ` H*v ` Operators
394398
395399The following produce matrix-free operators which are used for calculating
396400Jacobian-vector and Hessian-vector products where the differentiation takes
0 commit comments