27 #ifndef CHECK_DERIVATIVES_H
28 #define CHECK_DERIVATIVES_H
97 template<
typename Der1,
typename Der2,
typename fnType,
typename ErrorStream>
108 eigen_assert(point.rows() == (int)xdims);
109 eigen_assert(point.cols() == (int)1);
110 eigen_assert(derivatives.rows() == (int)valdims);
122 for (i = 0; i < xdims; ++i) {
131 dvalFromDer = delta * derivatives.
matrix().col(i);
133 double thediff = (dval1 - dvalFromDer).norm();
135 if (thediff/delta > tol ) {
144 <<
"Error in derivative check: Derivative wrong in direction\n"
145 <<
"dir = " << dir.transpose() <<
" [basis vector #"<<i<<
"]\n"
146 <<
"\tpoint = \t" << point.
transpose() <<
"\n"
147 <<
"\tval0 = \t" << val0.transpose() <<
"\n"
148 <<
"\tdval1 = \t" << dval1.transpose() <<
"\n"
149 <<
"\tdvalFromDer = \t"<<dvalFromDer.transpose() <<
"\n"
150 <<
"\tderivative in this direction =\n\t\t\t\t" << derivatives.
transpose().block(i,0,1,valdims) <<
"\n"
151 <<
"--> difference in p2-points: \t" << thediff <<
"\n"
152 <<
"--> difference in derivatives: \t" << thediff/delta <<
"\n\n";
Base namespace for the Tomographer project.
Matrix< double, Dynamic, 1 > VectorXd
Eigen::Transpose< Derived > transpose()
MatrixWrapper< Derived > matrix()