Forward mode computes derivatives in the direction of inputs.

Other Algorithms 1 implementation

Reverse mode computes derivatives from outputs backward. Forward: O(n) per direction, Reverse: O(m) per output. Use forward when n < m, reverse when n > m.

Implementations

CppAD

  • ad_fun.hpp - ADFun class - function object storing recorded AD operations

ADFun stores a recorded sequence of operations and provides methods to evaluate the function and its derivatives.

Key methods:

  • Forward(p, x): p-th order forward mode Taylor coefficient
  • Reverse(q, w): q-th order reverse mode derivative
  • Jacobian(x): Full Jacobian matrix
  • Hessian(x, w): Weighted Hessian matrix
  • SparseJacobian/SparseHessian: Sparse derivative computation