Modern Fortran Numerical Differentiation Library
Clone or download

Brief description

NumDiff provides a modern Fortran interface for computing the Jacobian (derivative) matrix of m nonlinear functions which depend on n variables. The Jacobian matrix is required for various applications, including numerical optimization. The library also provides for computing the sparsity of this matrix, and returning the Jacobian in sparse or dense form.


This is currently an experimental work in progress and is not production ready. The goal is a comprehensive library that contains a full suite of computationally efficient implementations of algorithms for sparsity determination and numerical differentiation.

To Do:

  • Computing the nonlinear sparsity pattern
    • Specified by the user
    • Assume all elements true
    • Three random points within variable bounds
  • Various order finite different gradient methods
    • 2-point (backward, forward)
    • 3-point (backward, central, forward)
    • 4-point (backward 1, backward 2, forward 1, forward 2)
    • 5-point (backward 1, backward 2, central, forward 1, forward 2)
    • 6-point (backward 1, backward 2, backward 3, forward 1, forward 2, forward 3)
  • Perturbations should respect variable bounds
  • Neville's process
  • Ability to use different methods for different columns
  • Jacobian partitioning to compute multiple columns at the same time
  • Estimate the optimal perturbation step size
  • Computing the linear sparsity pattern (constant elements of Jacobian)
  • Add other gradient methods?
  • Also compute Hessian matrix?
  • OpenMP or Coarrays for parallelization
  • Testing for computational efficiency
  • General code cleanup


The NumDiff source code and related files and documentation are distributed under a permissive free software license (BSD-style).