JuliaDiff/FiniteDiff.jl
Fast non-allocating calculations of gradients, Jacobians, and Hessians with sparsity support
What it solves
When you need derivatives, gradients, Jacobians, or Hessians but don't have analytical formulas, this package calculates them numerically. It is built for speed and memory efficiency, especially for array-based computations and sparse structures.
How it works
The library uses finite differencing to approximate derivatives. It provides two modes: direct function calls for quick one-off calculations, and cache-based versions that avoid allocations when you recompute derivatives many times. It supports both mutable arrays (with non-allocating forms) and static arrays (non-mutating). For sparse Jacobians, it uses coloring vectors to compute multiple directional derivatives in a single function call, reducing the number of evaluations. The package is designed to work where feasible on GPUs.
Who it's for
Julia developers working on scientific computing, optimization, machine learning, or any field that needs numerical derivatives. It is particularly useful for those who need fast, allocation-light computations on arrays and sparse Jacobians.
Highlights
- Fully non-allocating mutable forms for fast array support
- Fully non-mutating forms for static array support
- Coloring vectors for efficient calculation of sparse Jacobians
- GPU-compatible, to the extent possible with finite differencing
Related
- Project
- Project
- Project
- Project