aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/Eigen/src/NonLinear/lmdif.h
diff options
context:
space:
mode:
authorGravatar Thomas Capricelli <orzel@freehackers.org>2009-08-19 19:56:51 +0200
committerGravatar Thomas Capricelli <orzel@freehackers.org>2009-08-19 19:56:51 +0200
commit01622e9855734a35def4f88e2645423c90b8959b (patch)
tree211532c0ebca0b716e4d7d6c9b4f8edebe05519b /unsupported/Eigen/src/NonLinear/lmdif.h
parent3093e92da5f0fea5a7325a573b5c19dd83e71f72 (diff)
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 :)
Diffstat (limited to 'unsupported/Eigen/src/NonLinear/lmdif.h')
-rw-r--r--unsupported/Eigen/src/NonLinear/lmdif.h12
1 files changed, 4 insertions, 8 deletions
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<T>() && prered <= epsilon<T>() && p5 * ratio <= 1.) {
info = 6;
}
- if (delta <= epsmch * xnorm) {
+ if (delta <= epsilon<T>() * xnorm) {
info = 7;
}
- if (gnorm <= epsmch) {
+ if (gnorm <= epsilon<T>()) {
info = 8;
}
if (info != 0) {