1#define chkder_log10e 0.43429448190325182765
2#define chkder_factor 100.
5#include "./InternalHeaderCheck.h"
11template <
typename Scalar>
12void chkder(
const Matrix<Scalar, Dynamic, 1> &x,
const Matrix<Scalar, Dynamic, 1> &fvec,
13 const Matrix<Scalar, Dynamic, Dynamic> &fjac, Matrix<Scalar, Dynamic, 1> &xp,
14 const Matrix<Scalar, Dynamic, 1> &fvecp,
int mode, Matrix<Scalar, Dynamic, 1> &err) {
19 typedef DenseIndex Index;
21 const Scalar eps = sqrt(NumTraits<Scalar>::epsilon());
22 const Scalar epsf = chkder_factor * NumTraits<Scalar>::epsilon();
23 const Scalar epslog = chkder_log10e * log(eps);
26 const Index m = fvec.size(), n = x.size();
31 for (Index j = 0; j < n; ++j) {
32 temp = eps * abs(x[j]);
33 if (temp == 0.) temp = eps;
39 for (Index j = 0; j < n; ++j) {
41 if (temp == 0.) temp = 1.;
42 err += temp * fjac.col(j);
44 for (Index i = 0; i < m; ++i) {
46 if (fvec[i] != 0. && fvecp[i] != 0. && abs(fvecp[i] - fvec[i]) >= epsf * abs(fvec[i]))
47 temp = eps * abs((fvecp[i] - fvec[i]) / eps - err[i]) / (abs(fvec[i]) + abs(fvecp[i]));
49 if (temp > NumTraits<Scalar>::epsilon() && temp < eps) err[i] = (chkder_log10e * log(temp) - epslog) / epslog;
50 if (temp >= eps) err[i] = 0.;
Namespace containing all symbols from the Eigen library.