johnmyleswhite / FiniteDiff.jl

A replacement for the finite-differencing code in Calculus.jl
Other
2 stars 2 forks source link

Action items post-release #3

Open johnmyleswhite opened 7 years ago

johnmyleswhite commented 7 years ago
pkofod commented 7 years ago

Implement AllResults API from ForwardDiff

seems like this is now gone, is it still the way you want to do it, or do you want to follow the DiffBase-style?

ref: docs http://www.juliadiff.org/ForwardDiff.jl/upgrade.html

# old v0.1 style
answer, results = ForwardDiff.hessian(f, x, AllResults)
v = ForwardDiff.value(results)
g = ForwardDiff.gradient(results)
h = ForwardDiff.hessian(results) # == answer

# old v0.2 style
out = HessianResult(x)
ForwardDiff.hessian!(out, f, x)
v = ForwardDiff.value(out)
g = ForwardDiff.gradient(out)
h = ForwardDiff.hessian(out)

# current v0.3 style
using DiffBase
out = DiffBase.HessianResult(x)
ForwardDiff.hessian!(out, f, x)
v = DiffBase.value(out)
g = DiffBase.gradient(out)
h = DiffBase.hessian(out)