remove the boring, old-school nprint option, we'll have a dedicated

method for 'one iteration' anyway.
This commit is contained in:
Thomas Capricelli 2009-08-25 17:11:14 +02:00
parent 613a464320
commit 858acfcc64
5 changed files with 10 additions and 78 deletions

View File

@ -20,8 +20,7 @@ public:
const int maxfev = 2000, const int maxfev = 2000,
const Scalar factor = Scalar(100.), const Scalar factor = Scalar(100.),
const Scalar xtol = ei_sqrt(epsilon<Scalar>()), const Scalar xtol = ei_sqrt(epsilon<Scalar>()),
const Scalar epsfcn = Scalar(0.), const Scalar epsfcn = Scalar(0.)
const int nprint=0
); );
Matrix< Scalar, Dynamic, 1 > fvec; Matrix< Scalar, Dynamic, 1 > fvec;
@ -76,8 +75,7 @@ int HybridNonLinearSolverNumericalDiff<FunctorType,Scalar>::solve(
const int maxfev, const int maxfev,
const Scalar factor, const Scalar factor,
const Scalar xtol, const Scalar xtol,
const Scalar epsfcn, const Scalar epsfcn
const int nprint
) )
{ {
const int n = x.size(); const int n = x.size();
@ -225,15 +223,6 @@ int HybridNonLinearSolverNumericalDiff<FunctorType,Scalar>::solve(
/* beginning of the inner loop. */ /* beginning of the inner loop. */
while (true) { while (true) {
/* if requested, call functor.f to enable printing of iterates. */
if (nprint > 0) {
iflag = 0;
if ((iter - 1) % nprint == 0)
iflag = functor.debug(x, fvec);
if (iflag < 0)
goto algo_end;
}
/* determine the direction p. */ /* determine the direction p. */
@ -380,8 +369,6 @@ algo_end:
/* termination, either normal or user imposed. */ /* termination, either normal or user imposed. */
if (iflag < 0) if (iflag < 0)
info = iflag; info = iflag;
if (nprint > 0)
iflag = functor.debug(x, fvec);
return info; return info;
} }

View File

@ -17,8 +17,7 @@ public:
const int mode=1, const int mode=1,
const int maxfev = 1000, const int maxfev = 1000,
const Scalar factor = Scalar(100.), const Scalar factor = Scalar(100.),
const Scalar xtol = ei_sqrt(epsilon<Scalar>()), const Scalar xtol = ei_sqrt(epsilon<Scalar>())
const int nprint=0
); );
Matrix< Scalar, Dynamic, 1 > fvec; Matrix< Scalar, Dynamic, 1 > fvec;
@ -71,8 +70,7 @@ int HybridNonLinearSolver<FunctorType,Scalar>::solve(
const int mode, const int mode,
const int maxfev, const int maxfev,
const Scalar factor, const Scalar factor,
const Scalar xtol, const Scalar xtol
const int nprint
) )
{ {
const int n = x.size(); const int n = x.size();
@ -211,15 +209,6 @@ int HybridNonLinearSolver<FunctorType,Scalar>::solve(
/* beginning of the inner loop. */ /* beginning of the inner loop. */
while (true) { while (true) {
/* if requested, call functor.f to enable printing of iterates. */
if (nprint > 0) {
iflag = 0;
if ((iter - 1) % nprint == 0)
iflag = functor.debug(x, fvec, fjac);
if (iflag < 0)
goto algo_end;
}
/* determine the direction p. */ /* determine the direction p. */
@ -365,8 +354,6 @@ algo_end:
/* termination, either normal or user imposed. */ /* termination, either normal or user imposed. */
if (iflag < 0) if (iflag < 0)
info = iflag; info = iflag;
if (nprint > 0)
iflag = functor.debug(x, fvec, fjac);
return info; return info;
} }

View File

@ -21,8 +21,7 @@ public:
const int maxfev = 400, const int maxfev = 400,
const Scalar ftol = ei_sqrt(epsilon<Scalar>()), const Scalar ftol = ei_sqrt(epsilon<Scalar>()),
const Scalar xtol = ei_sqrt(epsilon<Scalar>()), const Scalar xtol = ei_sqrt(epsilon<Scalar>()),
const Scalar gtol = Scalar(0.), const Scalar gtol = Scalar(0.)
const int nprint=0
); );
Matrix< Scalar, Dynamic, 1 > fvec; Matrix< Scalar, Dynamic, 1 > fvec;
@ -77,8 +76,7 @@ int LevenbergMarquardt<FunctorType,Scalar>::minimize(
const int maxfev, const int maxfev,
const Scalar ftol, const Scalar ftol,
const Scalar xtol, const Scalar xtol,
const Scalar gtol, const Scalar gtol
const int nprint
) )
{ {
const int n = x.size(); const int n = x.size();
@ -143,16 +141,6 @@ int LevenbergMarquardt<FunctorType,Scalar>::minimize(
if (iflag < 0) if (iflag < 0)
break; break;
/* if requested, call functor.f to enable printing of iterates. */
if (nprint > 0) {
iflag = 0;
if ((iter - 1) % nprint == 0)
iflag = functor.debug(x, fvec, fjac);
if (iflag < 0)
break;
}
/* compute the qr factorization of the jacobian. */ /* compute the qr factorization of the jacobian. */
ei_qrfac<Scalar>(m, n, fjac.data(), fjac.rows(), true, ipvt.data(), n, wa1.data(), wa2.data()); ei_qrfac<Scalar>(m, n, fjac.data(), fjac.rows(), true, ipvt.data(), n, wa1.data(), wa2.data());
@ -340,7 +328,5 @@ algo_end:
/* termination, either normal or user imposed. */ /* termination, either normal or user imposed. */
if (iflag < 0) if (iflag < 0)
info = iflag; info = iflag;
if (nprint > 0)
iflag = functor.debug(x, fvec, fjac);
return info; return info;
} }

View File

@ -21,8 +21,7 @@ public:
const Scalar ftol = ei_sqrt(epsilon<Scalar>()), const Scalar ftol = ei_sqrt(epsilon<Scalar>()),
const Scalar xtol = ei_sqrt(epsilon<Scalar>()), const Scalar xtol = ei_sqrt(epsilon<Scalar>()),
const Scalar gtol = Scalar(0.), const Scalar gtol = Scalar(0.),
const Scalar epsfcn = Scalar(0.), const Scalar epsfcn = Scalar(0.)
const int nprint=0
); );
Matrix< Scalar, Dynamic, 1 > fvec; Matrix< Scalar, Dynamic, 1 > fvec;
@ -76,8 +75,7 @@ int LevenbergMarquardtNumericalDiff<FunctorType,Scalar>::minimize(
const Scalar ftol, const Scalar ftol,
const Scalar xtol, const Scalar xtol,
const Scalar gtol, const Scalar gtol,
const Scalar epsfcn, const Scalar epsfcn
const int nprint
) )
{ {
const int n = x.size(); const int n = x.size();
@ -140,16 +138,6 @@ int LevenbergMarquardtNumericalDiff<FunctorType,Scalar>::minimize(
if (iflag < 0) if (iflag < 0)
break; break;
/* if requested, call functor.f to enable printing of iterates. */
if (nprint > 0) {
iflag = 0;
if ((iter - 1) % nprint == 0)
iflag = functor.debug(x, fvec);
if (iflag < 0)
break;
}
/* compute the qr factorization of the jacobian. */ /* compute the qr factorization of the jacobian. */
ei_qrfac<Scalar>(m, n, fjac.data(), fjac.rows(), true, ipvt.data(), n, wa1.data(), wa2.data()); ei_qrfac<Scalar>(m, n, fjac.data(), fjac.rows(), true, ipvt.data(), n, wa1.data(), wa2.data());
@ -337,8 +325,6 @@ algo_end:
/* termination, either normal or user imposed. */ /* termination, either normal or user imposed. */
if (iflag < 0) if (iflag < 0)
info = iflag; info = iflag;
if (nprint > 0)
iflag = functor.debug(x, fvec);
return info; return info;
} }

View File

@ -21,8 +21,7 @@ public:
const int maxfev = 400, const int maxfev = 400,
const Scalar ftol = ei_sqrt(epsilon<Scalar>()), const Scalar ftol = ei_sqrt(epsilon<Scalar>()),
const Scalar xtol = ei_sqrt(epsilon<Scalar>()), const Scalar xtol = ei_sqrt(epsilon<Scalar>()),
const Scalar gtol = Scalar(0.), const Scalar gtol = Scalar(0.)
const int nprint=0
); );
Matrix< Scalar, Dynamic, 1 > fvec; Matrix< Scalar, Dynamic, 1 > fvec;
@ -76,8 +75,7 @@ int LevenbergMarquardtOptimumStorage<FunctorType,Scalar>::minimize(
const int maxfev, const int maxfev,
const Scalar ftol, const Scalar ftol,
const Scalar xtol, const Scalar xtol,
const Scalar gtol, const Scalar gtol
const int nprint
) )
{ {
const int n = x.size(); const int n = x.size();
@ -135,16 +133,6 @@ int LevenbergMarquardtOptimumStorage<FunctorType,Scalar>::minimize(
while (true) { while (true) {
/* if requested, call functor.f to enable printing of iterates. */
if (nprint > 0) {
iflag = 0;
if ((iter - 1) % nprint == 0)
iflag = functor.debug(x, fvec, wa3);
if (iflag < 0)
break;
}
/* compute the qr factorization of the jacobian matrix */ /* compute the qr factorization of the jacobian matrix */
/* calculated one row at a time, while simultaneously */ /* calculated one row at a time, while simultaneously */
/* forming (q transpose)*fvec and storing the first */ /* forming (q transpose)*fvec and storing the first */
@ -355,8 +343,6 @@ algo_end:
/* termination, either normal or user imposed. */ /* termination, either normal or user imposed. */
if (iflag < 0) if (iflag < 0)
info = iflag; info = iflag;
if (nprint > 0)
iflag = functor.debug(x, fvec, wa3);
return info; return info;
} }