mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
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:
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user