Skip to content

Commit ffdac57

Browse files
Merge pull request #143 from DanielVandH/patch-1
Explicitly mention Setfield.jl
2 parents 9091780 + 3dca666 commit ffdac57

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,9 @@ FiniteDiff.GradientCache(
391391
Note that here `fx` is a cached function call of `f`. If you provide `fx`, then
392392
`fx` will be used in the forward differencing method to skip a function call.
393393
It is on you to make sure that you update `cache.fx` every time before
394-
calling `FiniteDiff.finite_difference_gradient!`. A good use of this is if you have a
395-
cache array for the output of `fx` already being used, you can make it alias
394+
calling `FiniteDiff.finite_difference_gradient!`. If `fx` is an immutable, e.g. a scalar or
395+
a `StaticArray`, `cache.fx` should be updated using `@set` from [Setfield.jl](https://github.com/jw3126/Setfield.jl).
396+
A good use of this is if you have a cache array for the output of `fx` already being used, you can make it alias
396397
into the differencing algorithm here.
397398

398399
## Jacobians

0 commit comments

Comments
 (0)