33 #include "tnt_array1d.h"    34 #include "tnt_array1d_utils.h"    35 #include "tnt_array2d.h"    36 #include "tnt_array2d_utils.h"    38 #include <gsl/gsl_vector.h>    39 #include <gsl/gsl_matrix.h>    40 #include <gsl/gsl_blas.h>    41 #include <gsl/gsl_multifit_nlin.h>    63       NonLinearLSQ() : _fitParms(), _uncert(), _nIters(0), _maxIters(50),
    64                        _status(0), _userTerminated(false), _userMessage() {}
    69       virtual int nSize() 
const = 0;
    70       virtual int nParms() 
const = 0;
    91       virtual double absErr()
 const { 
return (1.0
E-4); }
    92       virtual double relErr()
 const { 
return (1.0
E-4); }
    96       inline int status()
 const { 
return (_status); }
    98       inline bool success()
 const { 
return (_status == GSL_SUCCESS); }
   103         return (std::string(gsl_strerror(_status)));
   107         return (std::string(gsl_strerror(
status)));
   112                                  const NLVector &uncerts, 
double cplxconj,
   125       void Terminate(
const std::string &message = 
"");
   126       void Abort(
const std::string &reason = 
"");
   137       bool        _userTerminated;
   138       std::string _userMessage;
   140       struct _nlsqPointer {
   143       static int f(
const gsl_vector *x, 
void *params, gsl_vector *fx);
   144       static int df(
const gsl_vector *x, 
void *params, gsl_matrix *J);
   145       static int fdf(
const gsl_vector *x, 
void *params, gsl_vector *fx, 
   148       NLVector gslToNlsq(
const gsl_vector *v) 
const;
   149       NLMatrix gslToNlsq(
const gsl_matrix *m) 
const;
   150       gsl_vector *NlsqTogsl(
const NLVector &v, gsl_vector *gv = 0) 
const;
   151       gsl_matrix *NlsqTogsl(
const NLMatrix &m, gsl_matrix *gm = 0) 
const;
   152       NLVector getUncertainty(
const gsl_matrix *m) 
const;
 virtual ~NonLinearLSQ()
Destructor. 
Definition: NonLinearLSQ.h:67
 
void Abort(const std::string &reason="")
Definition: NonLinearLSQ.cpp:106
 
std::string statusstr(int status) const
Return error message given status condition. 
Definition: NonLinearLSQ.h:106
 
bool doContinue() const
Definition: NonLinearLSQ.h:128
 
void Terminate(const std::string &message="")
Definition: NonLinearLSQ.cpp:99
 
virtual int nParms() const =0
 
int maxIters() const
Maximum number iterations for valid solution. 
Definition: NonLinearLSQ.h:85
 
int nIterations() const
Return number of iterations from last fit processing. 
Definition: NonLinearLSQ.h:122
 
virtual NLVector f_x(const NLVector &x)=0
 
NonLinearLSQ Computes a fit using a Levenberg-Marquardt algorithm. 
Definition: NonLinearLSQ.h:57
 
std::string statusstr() const
Return error message pertaining to last fit procesing. 
Definition: NonLinearLSQ.h:102
 
NLVector uncert() const
Return uncertainties from last fit processing. 
Definition: NonLinearLSQ.h:120
 
TNT::Array1D< double > NLVector
Definition: NonLinearLSQ.h:59
 
NonLinearLSQ()
Definition: NonLinearLSQ.h:63
 
virtual double relErr() const
Definition: NonLinearLSQ.h:92
 
virtual int nSize() const =0
 
virtual NLMatrix df_x(const NLVector &x)=0
 
int status() const
Return status of last fit processing. 
Definition: NonLinearLSQ.h:96
 
bool success(int status) const
Check status for success of the given condition. 
Definition: NonLinearLSQ.h:100
 
const double E
Sets some basic constants for use in ISIS programming. 
Definition: Constants.h:55
 
TNT::Array2D< double > NLMatrix
Definition: NonLinearLSQ.h:60
 
virtual double absErr() const
Definition: NonLinearLSQ.h:91
 
Namespace for ISIS/Bullet specific routines. 
Definition: Apollo.h:31
 
bool success() const
Determine success from last fit processing. 
Definition: NonLinearLSQ.h:98
 
virtual NLVector guess()=0
 
int curvefit()
Definition: NonLinearLSQ.cpp:43
 
NLVector coefs() const
Return coefficients from last fit processing. 
Definition: NonLinearLSQ.h:118
 
virtual int checkIteration(const int Iter, const NLVector &fitcoefs, const NLVector &uncerts, double cplxconj, int Istatus)
Default interation test simply returns input status. 
Definition: NonLinearLSQ.h:111
 
void setMaxIters(int m)
Sets the maximum number of iterations. 
Definition: NonLinearLSQ.h:77