template<typename Functor_, NumericalDiffMode mode = Forward>
class Eigen::NumericalDiff< Functor_, mode >
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.
template<typename Functor_ , NumericalDiffMode mode = Forward>
return the number of evaluation of functor
77 Functor::operator()(
x, val1);
88 for (
int j = 0;
j <
n; ++
j) {
96 Functor::operator()(
x, val2);
99 jac.col(
j) = (val2 - val1) / h;
103 Functor::operator()(
x, val2);
106 Functor::operator()(
x, val1);
109 jac.col(
j) = (val2 - val1) / (2 * h);
AnnoyingScalar abs(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:135
AnnoyingScalar sqrt(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:134
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
#define eigen_assert(x)
Definition: Macros.h:910
SCALAR Scalar
Definition: bench_gemm.cpp:45
Functor::InputType InputType
Definition: NumericalDiff.h:39
Functor::ValueType ValueType
Definition: NumericalDiff.h:40
#define max(a, b)
Definition: datatypes.h:23
double eps
Definition: crbond_bessel.cc:24
@ Central
Definition: NumericalDiff.h:21
@ Forward
Definition: NumericalDiff.h:21
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:83
double epsilon
Definition: osc_ring_sarah_asymptotics.h:43
list x
Definition: plotDoE.py:28
int values() const
Definition: NonLinearOptimization.cpp:110
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2
References abs(), Eigen::Central, eigen_assert, CRBond_Bessel::eps, Eigen::NumericalDiff< Functor_, mode >::epsfcn, Eigen::Forward, j, max, n, sqrt(), Functor< Scalar_, NX, NY >::values(), and plotDoE::x.
Referenced by test_central(), and test_forward().