![]() |
Eigen-Contrib
5.0.1-dev+master
|
#include <contrib/Eigen/src/NumericalDiff/NumericalDiff.h>
This class allows you to add a method df() to your functor, which will use numerical differentiation to compute an approximate of the derivative for the functor. Of course, if you have an analytical form for the derivative, you should rather implement df() by yourself.
More information on http://en.wikipedia.org/wiki/Numerical_differentiation
Currently only "Forward" and "Central" scheme are implemented.
Public Member Functions | |
| int | df (const InputType &_x, JacobianType &jac) const |
|
inline |
Computes the Jacobian of the functor at _x into jac and returns the number of functor evaluations.
The step along coordinate j is h = max(|x[j]| * rel_tol, abs_tol) with rel_tol and abs_tol selected by the user. The rel_tol selected by the user must be greater than or equal to epsilon, and abs_tol must be greater than 0, where epsilon is the machine precision NumTraits<Scalar>::epsilon(); the difference quotient divides by the representable step fl(x[j] + h) - x[j] actually applied.
In forward mode, the default rel_tol is sqrt(NumTraits<Scalar>::epsilon()) and the default abs_tol is abs_tol = rel_tol. In central mode, the default rel_tol is cbrt(NumTraits<Scalar>::epsilon()) and the default abs_tol = rel_tol.