TR-mbed 1.0
Loading...
Searching...
No Matches
chkder.h
Go to the documentation of this file.
1#define chkder_log10e 0.43429448190325182765
2#define chkder_factor 100.
3
4namespace Eigen {
5
6namespace internal {
7
8template<typename Scalar>
9void chkder(
15 int mode,
17 )
18{
19 using std::sqrt;
20 using std::abs;
21 using std::log;
22
23 typedef DenseIndex Index;
24
28 Scalar temp;
29
30 const Index m = fvec.size(), n = x.size();
31
32 if (mode != 2) {
33 /* mode = 1. */
34 xp.resize(n);
35 for (Index j = 0; j < n; ++j) {
36 temp = eps * abs(x[j]);
37 if (temp == 0.)
38 temp = eps;
39 xp[j] = x[j] + temp;
40 }
41 }
42 else {
43 /* mode = 2. */
44 err.setZero(m);
45 for (Index j = 0; j < n; ++j) {
46 temp = abs(x[j]);
47 if (temp == 0.)
48 temp = 1.;
49 err += temp * fjac.col(j);
50 }
51 for (Index i = 0; i < m; ++i) {
52 temp = 1.;
53 if (fvec[i] != 0. && fvecp[i] != 0. && abs(fvecp[i] - fvec[i]) >= epsf * abs(fvec[i]))
54 temp = eps * abs((fvecp[i] - fvec[i]) / eps - err[i]) / (abs(fvec[i]) + abs(fvecp[i]));
55 err[i] = 1.;
56 if (temp > NumTraits<Scalar>::epsilon() && temp < eps)
57 err[i] = (chkder_log10e * log(temp) - epslog) / epslog;
58 if (temp >= eps)
59 err[i] = 0.;
60 }
61 }
62}
63
64} // end namespace internal
65
66} // end namespace Eigen
Matrix3f m
Definition AngleAxis_mimic_euler.cpp:1
EIGEN_DEVICE_FUNC const LogReturnType log() const
Definition ArrayCwiseUnaryOps.h:128
int n
Definition BiCGSTAB_simple.cpp:1
int i
Definition BiCGSTAB_step_by_step.cpp:9
SCALAR Scalar
Definition bench_gemm.cpp:46
#define chkder_log10e
Definition chkder.h:1
#define chkder_factor
Definition chkder.h:2
#define abs(x)
Definition datatypes.h:17
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
Definition gnuplot_common_settings.hh:12
void chkder(const Matrix< Scalar, Dynamic, 1 > &x, const Matrix< Scalar, Dynamic, 1 > &fvec, const Matrix< Scalar, Dynamic, Dynamic > &fjac, Matrix< Scalar, Dynamic, 1 > &xp, const Matrix< Scalar, Dynamic, 1 > &fvecp, int mode, Matrix< Scalar, Dynamic, 1 > &err)
Definition chkder.h:9
Namespace containing all symbols from the Eigen library.
Definition bench_norm.cpp:85
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:74
EIGEN_DEFAULT_DENSE_INDEX_TYPE DenseIndex
Definition Meta.h:66
Definition BandTriangularSolver.h:13
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition NumTraits.h:233
Definition ForwardDeclarations.h:17
std::ptrdiff_t j
Definition tut_arithmetic_redux_minmax.cpp:2