Fast and easy derivatives of scalar functions with forward-mode automatic differentiation.
Compared to the scalar differentiation offered by the very popular ForwardDiff.jl package, FastForwardDiff adds:
- Efficient single-pass value and derivatives with the
value_and_derivative
andvalue_and_derivatives
functions. Faster and easier than ForwardDiff's equivalent (i.e., the DiffResults API) ✅ - Unitful.jl support. Correctly handles units in the inputs and outputs of functions ✅
Internally, it relies on the proven dual-number implementation from ForwardDiff.
julia> using FastForwardDiff
julia> f(x) = x^2 + 2x + 1
julia> derivative(f, 3)
8
julia> value_and_derivative(f, 3)
(16, 8)