From 01622e9855734a35def4f88e2645423c90b8959b Mon Sep 17 00:00:00 2001 From: Thomas Capricelli Date: Wed, 19 Aug 2009 19:56:51 +0200 Subject: use machine precision from eigen instead of the one from cminpack. The test pass though they would not if using a value of 2.220e-16 (the real value for 'double' is 2.22044604926e-16). How sensitive those tests are :) --- unsupported/Eigen/src/NonLinear/lmdif.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'unsupported/Eigen/src/NonLinear/lmdif.h') diff --git a/unsupported/Eigen/src/NonLinear/lmdif.h b/unsupported/Eigen/src/NonLinear/lmdif.h index 894203be6..136451a09 100644 --- a/unsupported/Eigen/src/NonLinear/lmdif.h +++ b/unsupported/Eigen/src/NonLinear/lmdif.h @@ -24,7 +24,7 @@ int lmdif_template(minpack_func_mn fcn, void *p, int m, int n, T *x, T delta; T ratio; T fnorm, gnorm; - T pnorm, xnorm, fnorm1, actred, dirder, epsmch, prered; + T pnorm, xnorm, fnorm1, actred, dirder, prered; int info; /* Parameter adjustments */ @@ -43,10 +43,6 @@ int lmdif_template(minpack_func_mn fcn, void *p, int m, int n, T *x, /* Function Body */ -/* epsmch is the machine precision. */ - - epsmch = dpmpar(1); - info = 0; iflag = 0; *nfev = 0; @@ -384,13 +380,13 @@ L290: if (*nfev >= maxfev) { info = 5; } - if (fabs(actred) <= epsmch && prered <= epsmch && p5 * ratio <= 1.) { + if (fabs(actred) <= epsilon() && prered <= epsilon() && p5 * ratio <= 1.) { info = 6; } - if (delta <= epsmch * xnorm) { + if (delta <= epsilon() * xnorm) { info = 7; } - if (gnorm <= epsmch) { + if (gnorm <= epsilon()) { info = 8; } if (info != 0) { -- cgit v1.2.3