| 59 | |
| 60 | |
| 61 | void testChkder() |
| 62 | { |
| 63 | const int m=15, n=3; |
| 64 | VectorXd x(n), fvec(m), xp, fvecp(m), err; |
| 65 | MatrixXd fjac(m,n); |
| 66 | VectorXi ipvt; |
| 67 | |
| 68 | /* the following values should be suitable for */ |
| 69 | /* checking the jacobian matrix. */ |
| 70 | x << 9.2e-1, 1.3e-1, 5.4e-1; |
| 71 | |
| 72 | internal::chkder(x, fvec, fjac, xp, fvecp, 1, err); |
| 73 | fcn_chkder(x, fvec, fjac, 1); |
| 74 | fcn_chkder(x, fvec, fjac, 2); |
| 75 | fcn_chkder(xp, fvecp, fjac, 1); |
| 76 | internal::chkder(x, fvec, fjac, xp, fvecp, 2, err); |
| 77 | |
| 78 | fvecp -= fvec; |
| 79 | |
| 80 | // check those |
| 81 | VectorXd fvec_ref(m), fvecp_ref(m), err_ref(m); |
| 82 | fvec_ref << |
| 83 | -1.181606, -1.429655, -1.606344, |
| 84 | -1.745269, -1.840654, -1.921586, |
| 85 | -1.984141, -2.022537, -2.468977, |
| 86 | -2.827562, -3.473582, -4.437612, |
| 87 | -6.047662, -9.267761, -18.91806; |
| 88 | fvecp_ref << |
| 89 | -7.724666e-09, -3.432406e-09, -2.034843e-10, |
| 90 | 2.313685e-09, 4.331078e-09, 5.984096e-09, |
| 91 | 7.363281e-09, 8.53147e-09, 1.488591e-08, |
| 92 | 2.33585e-08, 3.522012e-08, 5.301255e-08, |
| 93 | 8.26666e-08, 1.419747e-07, 3.19899e-07; |
| 94 | err_ref << |
| 95 | 0.1141397, 0.09943516, 0.09674474, |
| 96 | 0.09980447, 0.1073116, 0.1220445, |
| 97 | 0.1526814, 1, 1, |
| 98 | 1, 1, 1, |
| 99 | 1, 1, 1; |
| 100 | |
| 101 | VERIFY_IS_APPROX(fvec, fvec_ref); |
| 102 | VERIFY_IS_APPROX(fvecp, fvecp_ref); |
| 103 | VERIFY_IS_APPROX(err, err_ref); |
| 104 | } |
| 105 | |
| 106 | // Generic functor |
| 107 | template<typename _Scalar, int NX=Dynamic, int NY=Dynamic> |
no test coverage detected