Forward mode computes derivatives in the direction of inputs.
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
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