JuliaDiff/FiniteDiff.jl

Reuse pre-calculated value

Closed this issue · 1 comments

The evaluations of f here:

https://github.com/JuliaDiffEq/DiffEqDiffTools.jl/blob/2dc3c201ad0b1c568ce204f409ec2806000b32e4/src/jacobians.jl#L119

Could potentially be calculated outside of this function call and be re-used here for forward differences. It could significantly improve performance when using forward differences, as you very often evaluate the system f and the jacobian simultaneously. I know I could grab fx form the cache, but the problem is, that then I have to special case it on my end (if using central differences grab f from fx else, calculate it). For now I'll have to special case it, but I'm curious if you'd be willing to add another input. It could default to nothing and then you could calculate fx only if !(typeof(f_in) == Nothing).

Should be fixed in #44, will close when merged.