From 858acfcc64e0e0cb41f30693bfefe6e90ea658aa Mon Sep 17 00:00:00 2001 From: Thomas Capricelli Date: Tue, 25 Aug 2009 17:11:14 +0200 Subject: [PATCH] remove the boring, old-school nprint option, we'll have a dedicated method for 'one iteration' anyway. --- unsupported/Eigen/src/NonLinear/hybrd.h | 17 ++--------------- unsupported/Eigen/src/NonLinear/hybrj.h | 17 ++--------------- unsupported/Eigen/src/NonLinear/lmder.h | 18 ++---------------- unsupported/Eigen/src/NonLinear/lmdif.h | 18 ++---------------- unsupported/Eigen/src/NonLinear/lmstr.h | 18 ++---------------- 5 files changed, 10 insertions(+), 78 deletions(-) diff --git a/unsupported/Eigen/src/NonLinear/hybrd.h b/unsupported/Eigen/src/NonLinear/hybrd.h index 73212fd0a..d7e913414 100644 --- a/unsupported/Eigen/src/NonLinear/hybrd.h +++ b/unsupported/Eigen/src/NonLinear/hybrd.h @@ -20,8 +20,7 @@ public: const int maxfev = 2000, const Scalar factor = Scalar(100.), const Scalar xtol = ei_sqrt(epsilon()), - const Scalar epsfcn = Scalar(0.), - const int nprint=0 + const Scalar epsfcn = Scalar(0.) ); Matrix< Scalar, Dynamic, 1 > fvec; @@ -76,8 +75,7 @@ int HybridNonLinearSolverNumericalDiff::solve( const int maxfev, const Scalar factor, const Scalar xtol, - const Scalar epsfcn, - const int nprint + const Scalar epsfcn ) { const int n = x.size(); @@ -225,15 +223,6 @@ int HybridNonLinearSolverNumericalDiff::solve( /* beginning of the inner loop. */ 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. */ @@ -380,8 +369,6 @@ algo_end: /* termination, either normal or user imposed. */ if (iflag < 0) info = iflag; - if (nprint > 0) - iflag = functor.debug(x, fvec); return info; } diff --git a/unsupported/Eigen/src/NonLinear/hybrj.h b/unsupported/Eigen/src/NonLinear/hybrj.h index 5236abe3f..0545cfe79 100644 --- a/unsupported/Eigen/src/NonLinear/hybrj.h +++ b/unsupported/Eigen/src/NonLinear/hybrj.h @@ -17,8 +17,7 @@ public: const int mode=1, const int maxfev = 1000, const Scalar factor = Scalar(100.), - const Scalar xtol = ei_sqrt(epsilon()), - const int nprint=0 + const Scalar xtol = ei_sqrt(epsilon()) ); Matrix< Scalar, Dynamic, 1 > fvec; @@ -71,8 +70,7 @@ int HybridNonLinearSolver::solve( const int mode, const int maxfev, const Scalar factor, - const Scalar xtol, - const int nprint + const Scalar xtol ) { const int n = x.size(); @@ -211,15 +209,6 @@ int HybridNonLinearSolver::solve( /* beginning of the inner loop. */ 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. */ @@ -365,8 +354,6 @@ algo_end: /* termination, either normal or user imposed. */ if (iflag < 0) info = iflag; - if (nprint > 0) - iflag = functor.debug(x, fvec, fjac); return info; } diff --git a/unsupported/Eigen/src/NonLinear/lmder.h b/unsupported/Eigen/src/NonLinear/lmder.h index ef063aaa3..38147f7ae 100644 --- a/unsupported/Eigen/src/NonLinear/lmder.h +++ b/unsupported/Eigen/src/NonLinear/lmder.h @@ -21,8 +21,7 @@ public: const int maxfev = 400, const Scalar ftol = ei_sqrt(epsilon()), const Scalar xtol = ei_sqrt(epsilon()), - const Scalar gtol = Scalar(0.), - const int nprint=0 + const Scalar gtol = Scalar(0.) ); Matrix< Scalar, Dynamic, 1 > fvec; @@ -77,8 +76,7 @@ int LevenbergMarquardt::minimize( const int maxfev, const Scalar ftol, const Scalar xtol, - const Scalar gtol, - const int nprint + const Scalar gtol ) { const int n = x.size(); @@ -143,16 +141,6 @@ int LevenbergMarquardt::minimize( if (iflag < 0) 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. */ ei_qrfac(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. */ if (iflag < 0) info = iflag; - if (nprint > 0) - iflag = functor.debug(x, fvec, fjac); return info; } diff --git a/unsupported/Eigen/src/NonLinear/lmdif.h b/unsupported/Eigen/src/NonLinear/lmdif.h index 3dd3b53cf..34d535add 100644 --- a/unsupported/Eigen/src/NonLinear/lmdif.h +++ b/unsupported/Eigen/src/NonLinear/lmdif.h @@ -21,8 +21,7 @@ public: const Scalar ftol = ei_sqrt(epsilon()), const Scalar xtol = ei_sqrt(epsilon()), const Scalar gtol = Scalar(0.), - const Scalar epsfcn = Scalar(0.), - const int nprint=0 + const Scalar epsfcn = Scalar(0.) ); Matrix< Scalar, Dynamic, 1 > fvec; @@ -76,8 +75,7 @@ int LevenbergMarquardtNumericalDiff::minimize( const Scalar ftol, const Scalar xtol, const Scalar gtol, - const Scalar epsfcn, - const int nprint + const Scalar epsfcn ) { const int n = x.size(); @@ -140,16 +138,6 @@ int LevenbergMarquardtNumericalDiff::minimize( if (iflag < 0) 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. */ ei_qrfac(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. */ if (iflag < 0) info = iflag; - if (nprint > 0) - iflag = functor.debug(x, fvec); return info; } diff --git a/unsupported/Eigen/src/NonLinear/lmstr.h b/unsupported/Eigen/src/NonLinear/lmstr.h index 3c55bb65c..a02224e32 100644 --- a/unsupported/Eigen/src/NonLinear/lmstr.h +++ b/unsupported/Eigen/src/NonLinear/lmstr.h @@ -21,8 +21,7 @@ public: const int maxfev = 400, const Scalar ftol = ei_sqrt(epsilon()), const Scalar xtol = ei_sqrt(epsilon()), - const Scalar gtol = Scalar(0.), - const int nprint=0 + const Scalar gtol = Scalar(0.) ); Matrix< Scalar, Dynamic, 1 > fvec; @@ -76,8 +75,7 @@ int LevenbergMarquardtOptimumStorage::minimize( const int maxfev, const Scalar ftol, const Scalar xtol, - const Scalar gtol, - const int nprint + const Scalar gtol ) { const int n = x.size(); @@ -135,16 +133,6 @@ int LevenbergMarquardtOptimumStorage::minimize( 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 */ /* calculated one row at a time, while simultaneously */ /* forming (q transpose)*fvec and storing the first */ @@ -355,8 +343,6 @@ algo_end: /* termination, either normal or user imposed. */ if (iflag < 0) info = iflag; - if (nprint > 0) - iflag = functor.debug(x, fvec, wa3); return info; }