diff --git a/nonlin.h b/nonlin.h index 6f6edcc3ce30116c0bb2e4667adbfed262c60621..193f7d2dd244e5c80230309634331af873e594bc 100644 --- a/nonlin.h +++ b/nonlin.h @@ -14,7 +14,8 @@ namespace MISCMATHS { enum NLMethod {NL_VM, // Variable-Metric (see NRinC) NL_CG, // Conjugate-Gradient (see NRinC) NL_SCG, // Scaled Conjugate-Gradient (See Moller 1993). - NL_LM}; // Levenberg-Marquardt (see NRinC) + NL_LM, // Levenberg-Marquardt (see NRinC) + NL_GD}; // Gradient Descent enum LMType {LM_L, LM_LM}; // Levenberg or Levenberg-Marquardt @@ -144,6 +145,8 @@ public: double InitialCF() const {if (logcf) return(cf[0]); else {throw NonlinException("InitialCF: Cost-function not logged"); return(cf[0]);}} const std::vector<double> CFHistory() const {if (logcf) return(cf); else {throw NonlinException("CFHistory: Cost-function not logged"); return(cf);}} NonlinOut Status() const {return(status);} + bool Success() const { switch(status) { case NL_UNDEFINED: case NL_MAXITER: case NL_LM_MAXITER: return(false); break; default: return(true); } }; + std::string TextStatus() const; // Routines to set values of steering parameters void SetMethod(NLMethod pmtd) {mtd = pmtd;}