use eigen stableNorm() instead of cminpack 'enorm'. The results are mostly

slightly better in tests (one test needs 15 iterations intead of 16, for
the same result). Some numerical results have improved slightly, too.

If one uses blueNorm() instead, an assert for 'overflow' is raised from
blueNorm()
This commit is contained in:
Thomas Capricelli
2009-08-20 21:04:38 +02:00
parent 6953cad81d
commit 9a876806e1
7 changed files with 59 additions and 42 deletions

View File

@@ -77,7 +77,7 @@ L20:
if (iflag < 0) {
goto L300;
}
fnorm = enorm(n, &fvec[1]);
fnorm = ei_enorm<T>(n, &fvec[1]);
/* determine the number of calls to fcn needed to compute */
/* the jacobian matrix. */
@@ -140,7 +140,7 @@ L50:
wa3[j] = diag[j] * x[j];
/* L60: */
}
xnorm = enorm(n, &wa3[1]);
xnorm = ei_enorm<T>(n, &wa3[1]);
delta = factor * xnorm;
if (delta == 0.) {
delta = factor;
@@ -250,7 +250,7 @@ L190:
wa3[j] = diag[j] * wa1[j];
/* L200: */
}
pnorm = enorm(n, &wa3[1]);
pnorm = ei_enorm<T>(n, &wa3[1]);
/* on the first iteration, adjust the initial step bound. */
@@ -265,7 +265,7 @@ L190:
if (iflag < 0) {
goto L300;
}
fnorm1 = enorm(n, &wa4[1]);
fnorm1 = ei_enorm<T>(n, &wa4[1]);
/* compute the scaled actual reduction. */
@@ -291,7 +291,7 @@ L190:
wa3[i__] = qtf[i__] + sum;
/* L220: */
}
temp = enorm(n, &wa3[1]);
temp = ei_enorm<T>(n, &wa3[1]);
prered = 0.;
if (temp < fnorm) {
/* Computing 2nd power */
@@ -344,7 +344,7 @@ L240:
fvec[j] = wa4[j];
/* L250: */
}
xnorm = enorm(n, &wa2[1]);
xnorm = ei_enorm<T>(n, &wa2[1]);
fnorm = fnorm1;
++iter;
L260:

View File

@@ -78,7 +78,7 @@ L20:
if (iflag < 0) {
goto L300;
}
fnorm = enorm(n, &fvec[1]);
fnorm = ei_enorm<T>(n, &fvec[1]);
/* initialize iteration counter and monitors. */
@@ -133,7 +133,7 @@ L50:
wa3[j] = diag[j] * x[j];
/* L60: */
}
xnorm = enorm(n, &wa3[1]);
xnorm = ei_enorm<T>(n, &wa3[1]);
delta = factor * xnorm;
if (delta == 0.) {
delta = factor;
@@ -243,7 +243,7 @@ L190:
wa3[j] = diag[j] * wa1[j];
/* L200: */
}
pnorm = enorm(n, &wa3[1]);
pnorm = ei_enorm<T>(n, &wa3[1]);
/* on the first iteration, adjust the initial step bound. */
@@ -258,7 +258,7 @@ L190:
if (iflag < 0) {
goto L300;
}
fnorm1 = enorm(n, &wa4[1]);
fnorm1 = ei_enorm<T>(n, &wa4[1]);
/* compute the scaled actual reduction. */
@@ -284,7 +284,7 @@ L190:
wa3[i__] = qtf[i__] + sum;
/* L220: */
}
temp = enorm(n, &wa3[1]);
temp = ei_enorm<T>(n, &wa3[1]);
prered = 0.;
if (temp < fnorm) {
/* Computing 2nd power */
@@ -337,7 +337,7 @@ L240:
fvec[j] = wa4[j];
/* L250: */
}
xnorm = enorm(n, &wa2[1]);
xnorm = ei_enorm<T>(n, &wa2[1]);
fnorm = fnorm1;
++iter;
L260:

View File

@@ -71,7 +71,7 @@ L20:
if (iflag < 0) {
goto L300;
}
fnorm = enorm(m, &fvec[1]);
fnorm = ei_enorm<T>(m, &fvec[1]);
/* initialize levenberg-marquardt parameter and iteration counter. */
@@ -136,7 +136,7 @@ L60:
wa3[j] = diag[j] * x[j];
/* L70: */
}
xnorm = enorm(n, &wa3[1]);
xnorm = ei_enorm<T>(n, &wa3[1]);
delta = factor * xnorm;
if (delta == 0.) {
delta = factor;
@@ -242,7 +242,7 @@ L200:
wa3[j] = diag[j] * wa1[j];
/* L210: */
}
pnorm = enorm(n, &wa3[1]);
pnorm = ei_enorm<T>(n, &wa3[1]);
/* on the first iteration, adjust the initial step bound. */
@@ -257,7 +257,7 @@ L200:
if (iflag < 0) {
goto L300;
}
fnorm1 = enorm(m, &wa4[1]);
fnorm1 = ei_enorm<T>(m, &wa4[1]);
/* compute the scaled actual reduction. */
@@ -283,7 +283,7 @@ L200:
}
/* L230: */
}
temp1 = enorm(n, &wa3[1]) / fnorm;
temp1 = ei_enorm<T>(n, &wa3[1]) / fnorm;
temp2 = sqrt(par) * pnorm / fnorm;
/* Computing 2nd power */
d__1 = temp1;
@@ -351,7 +351,7 @@ L260:
fvec[i__] = wa4[i__];
/* L280: */
}
xnorm = enorm(n, &wa2[1]);
xnorm = ei_enorm<T>(n, &wa2[1]);
fnorm = fnorm1;
++iter;
L290:

View File

@@ -73,7 +73,7 @@ L20:
if (iflag < 0) {
goto L300;
}
fnorm = enorm(m, &fvec[1]);
fnorm = ei_enorm<T>(m, &fvec[1]);
/* initialize levenberg-marquardt parameter and iteration counter. */
@@ -139,7 +139,7 @@ L60:
wa3[j] = diag[j] * x[j];
/* L70: */
}
xnorm = enorm(n, &wa3[1]);
xnorm = ei_enorm<T>(n, &wa3[1]);
delta = factor * xnorm;
if (delta == 0.) {
delta = factor;
@@ -245,7 +245,7 @@ L200:
wa3[j] = diag[j] * wa1[j];
/* L210: */
}
pnorm = enorm(n, &wa3[1]);
pnorm = ei_enorm<T>(n, &wa3[1]);
/* on the first iteration, adjust the initial step bound. */
@@ -260,7 +260,7 @@ L200:
if (iflag < 0) {
goto L300;
}
fnorm1 = enorm(m, &wa4[1]);
fnorm1 = ei_enorm<T>(m, &wa4[1]);
/* compute the scaled actual reduction. */
@@ -286,7 +286,7 @@ L200:
}
/* L230: */
}
temp1 = enorm(n, &wa3[1]) / fnorm;
temp1 = ei_enorm<T>(n, &wa3[1]) / fnorm;
temp2 = sqrt(par) * pnorm / fnorm;
/* Computing 2nd power */
d__1 = temp1;
@@ -354,7 +354,7 @@ L260:
fvec[i__] = wa4[i__];
/* L280: */
}
xnorm = enorm(n, &wa2[1]);
xnorm = ei_enorm<T>(n, &wa2[1]);
fnorm = fnorm1;
++iter;
L290:

View File

@@ -72,7 +72,7 @@ L20:
if (iflag < 0) {
goto L340;
}
fnorm = enorm(m, &fvec[1]);
fnorm = ei_enorm<T>(m, &fvec[1]);
/* initialize levenberg-marquardt parameter and iteration counter. */
@@ -136,7 +136,7 @@ L40:
sing = TRUE_;
}
ipvt[j] = j;
wa2[j] = enorm(j, &fjac[j * fjac_dim1 + 1]);
wa2[j] = ei_enorm<T>(j, &fjac[j * fjac_dim1 + 1]);
/* L80: */
}
if (! sing) {
@@ -194,7 +194,7 @@ L150:
wa3[j] = diag[j] * x[j];
/* L160: */
}
xnorm = enorm(n, &wa3[1]);
xnorm = ei_enorm<T>(n, &wa3[1]);
delta = factor * xnorm;
if (delta == 0.) {
delta = factor;
@@ -269,7 +269,7 @@ L240:
wa3[j] = diag[j] * wa1[j];
/* L250: */
}
pnorm = enorm(n, &wa3[1]);
pnorm = ei_enorm<T>(n, &wa3[1]);
/* on the first iteration, adjust the initial step bound. */
@@ -284,7 +284,7 @@ L240:
if (iflag < 0) {
goto L340;
}
fnorm1 = enorm(m, &wa4[1]);
fnorm1 = ei_enorm<T>(m, &wa4[1]);
/* compute the scaled actual reduction. */
@@ -310,7 +310,7 @@ L240:
}
/* L270: */
}
temp1 = enorm(n, &wa3[1]) / fnorm;
temp1 = ei_enorm<T>(n, &wa3[1]) / fnorm;
temp2 = sqrt(par) * pnorm / fnorm;
/* Computing 2nd power */
d__1 = temp1;
@@ -378,7 +378,7 @@ L300:
fvec[i__] = wa4[i__];
/* L320: */
}
xnorm = enorm(n, &wa2[1]);
xnorm = ei_enorm<T>(n, &wa2[1]);
fnorm = fnorm1;
++iter;
L330: