Isis 3 Programmer Reference
Isis::NonLinearLSQ Class Referenceabstract

NonLinearLSQ Computes a fit using a Levenberg-Marquardt algorithm. More...

#include <NonLinearLSQ.h>

Inheritance diagram for Isis::NonLinearLSQ:
Inheritance graph
Collaboration diagram for Isis::NonLinearLSQ:
Collaboration graph

Classes

struct  _nlsqPointer
 

Public Types

typedef TNT::Array1D< double > NLVector
 
typedef TNT::Array2D< double > NLMatrix
 

Public Member Functions

virtual ~NonLinearLSQ ()
 Destructor.
 
virtual int nSize () const =0
 
virtual int nParms () const =0
 
void setMaxIters (int m)
 Sets the maximum number of iterations.
 
int maxIters () const
 Maximum number iterations for valid solution.
 
virtual NLVector guess ()=0
 
virtual NLVector f_x (const NLVector &x)=0
 
virtual NLMatrix df_x (const NLVector &x)=0
 
virtual double absErr () const
 
virtual double relErr () const
 
int curvefit ()
 
int status () const
 Return status of last fit processing.
 
bool success () const
 Determine success from last fit processing.
 
bool success (int status) const
 Check status for success of the given condition

 
std::string statusstr () const
 Return error message pertaining to last fit procesing.
 
std::string statusstr (int status) const
 Return error message given status condition.
 
virtual int checkIteration (const int Iter, const NLVector &fitcoefs, const NLVector &uncerts, double cplxconj, int Istatus)
 Default interation test simply returns input status.
 
NLVector coefs () const
 Return coefficients from last fit processing.
 
NLVector uncert () const
 Return uncertainties from last fit processing.
 
int nIterations () const
 Return number of iterations from last fit processing.
 

Protected Member Functions

void Terminate (const std::string &message="")
 
void Abort (const std::string &reason="")
 
bool doContinue () const
 

Private Member Functions

NLVector gslToNlsq (const gsl_vector *v) const
 
NLMatrix gslToNlsq (const gsl_matrix *m) const
 
gsl_vector * NlsqTogsl (const NLVector &v, gsl_vector *gv=0) const
 
gsl_matrix * NlsqTogsl (const NLMatrix &m, gsl_matrix *gm=0) const
 
NLVector getUncertainty (const gsl_matrix *m) const
 

Static Private Member Functions

static int f (const gsl_vector *x, void *params, gsl_vector *fx)
 
static int df (const gsl_vector *x, void *params, gsl_matrix *J)
 
static int fdf (const gsl_vector *x, void *params, gsl_vector *fx, gsl_matrix *J)
 

Private Attributes

NLVector _fitParms
 
NLVector _uncert
 
int _nIters
 
int _maxIters
 
int _status
 
bool _userTerminated
 
std::string _userMessage
 

Detailed Description

NonLinearLSQ Computes a fit using a Levenberg-Marquardt algorithm.

This virtual base class uses the GSL toolkit to apply the Levenberg-Marquardt algorithm to fit data to a non-linear equation using least squares.

Author
2007-11-15 Kris Becker

Definition at line 42 of file NonLinearLSQ.h.

Member Typedef Documentation

◆ NLMatrix

typedef TNT::Array2D<double> Isis::NonLinearLSQ::NLMatrix

Definition at line 45 of file NonLinearLSQ.h.

◆ NLVector

typedef TNT::Array1D<double> Isis::NonLinearLSQ::NLVector

Definition at line 44 of file NonLinearLSQ.h.

Constructor & Destructor Documentation

◆ NonLinearLSQ()

Isis::NonLinearLSQ::NonLinearLSQ ( )
inline

Definition at line 48 of file NonLinearLSQ.h.

◆ ~NonLinearLSQ()

virtual Isis::NonLinearLSQ::~NonLinearLSQ ( )
inlinevirtual

Destructor.

Definition at line 52 of file NonLinearLSQ.h.

Member Function Documentation

◆ Abort()

void Isis::NonLinearLSQ::Abort ( const std::string & reason = "")
protected

Definition at line 91 of file NonLinearLSQ.cpp.

◆ absErr()

virtual double Isis::NonLinearLSQ::absErr ( ) const
inlinevirtual

Reimplemented in Isis::ZeroBufferFit.

Definition at line 76 of file NonLinearLSQ.h.

◆ checkIteration()

virtual int Isis::NonLinearLSQ::checkIteration ( const int Iter,
const NLVector & fitcoefs,
const NLVector & uncerts,
double cplxconj,
int Istatus )
inlinevirtual

Default interation test simply returns input status.

Reimplemented in Isis::ZeroBufferFit.

Definition at line 96 of file NonLinearLSQ.h.

◆ coefs()

NLVector Isis::NonLinearLSQ::coefs ( ) const
inline

Return coefficients from last fit processing.

Definition at line 103 of file NonLinearLSQ.h.

Referenced by Isis::ZeroBufferFit::Solve().

◆ curvefit()

int Isis::NonLinearLSQ::curvefit ( )

Definition at line 28 of file NonLinearLSQ.cpp.

◆ df()

int Isis::NonLinearLSQ::df ( const gsl_vector * x,
void * params,
gsl_matrix * J )
staticprivate

Definition at line 109 of file NonLinearLSQ.cpp.

◆ df_x()

virtual NLMatrix Isis::NonLinearLSQ::df_x ( const NLVector & x)
pure virtual

Implemented in Isis::ZeroBufferFit.

◆ doContinue()

bool Isis::NonLinearLSQ::doContinue ( ) const
inlineprotected

Definition at line 113 of file NonLinearLSQ.h.

◆ f()

int Isis::NonLinearLSQ::f ( const gsl_vector * x,
void * params,
gsl_vector * fx )
staticprivate

Definition at line 99 of file NonLinearLSQ.cpp.

◆ f_x()

virtual NLVector Isis::NonLinearLSQ::f_x ( const NLVector & x)
pure virtual

Implemented in Isis::ZeroBufferFit.

◆ fdf()

int Isis::NonLinearLSQ::fdf ( const gsl_vector * x,
void * params,
gsl_vector * fx,
gsl_matrix * J )
staticprivate

Definition at line 124 of file NonLinearLSQ.cpp.

◆ getUncertainty()

NonLinearLSQ::NLVector Isis::NonLinearLSQ::getUncertainty ( const gsl_matrix * m) const
private

Definition at line 132 of file NonLinearLSQ.cpp.

◆ gslToNlsq() [1/2]

NonLinearLSQ::NLMatrix Isis::NonLinearLSQ::gslToNlsq ( const gsl_matrix * m) const
private

Definition at line 150 of file NonLinearLSQ.cpp.

◆ gslToNlsq() [2/2]

NonLinearLSQ::NLVector Isis::NonLinearLSQ::gslToNlsq ( const gsl_vector * v) const
private

Definition at line 141 of file NonLinearLSQ.cpp.

◆ guess()

virtual NLVector Isis::NonLinearLSQ::guess ( )
pure virtual

Implemented in Isis::ZeroBufferFit.

◆ maxIters()

int Isis::NonLinearLSQ::maxIters ( ) const
inline

Maximum number iterations for valid solution.

Returns
int Maximum resolutions

Definition at line 70 of file NonLinearLSQ.h.

Referenced by Isis::ZeroBufferFit::ZeroBufferFit().

◆ nIterations()

int Isis::NonLinearLSQ::nIterations ( ) const
inline

Return number of iterations from last fit processing.

Definition at line 107 of file NonLinearLSQ.h.

Referenced by Isis::ZeroBufferFit::Solve().

◆ NlsqTogsl() [1/2]

gsl_matrix * Isis::NonLinearLSQ::NlsqTogsl ( const NLMatrix & m,
gsl_matrix * gm = 0 ) const
private

Definition at line 180 of file NonLinearLSQ.cpp.

◆ NlsqTogsl() [2/2]

gsl_vector * Isis::NonLinearLSQ::NlsqTogsl ( const NLVector & v,
gsl_vector * gv = 0 ) const
private

Definition at line 162 of file NonLinearLSQ.cpp.

◆ nParms()

virtual int Isis::NonLinearLSQ::nParms ( ) const
pure virtual

Implemented in Isis::ZeroBufferFit.

◆ nSize()

virtual int Isis::NonLinearLSQ::nSize ( ) const
pure virtual

Implemented in Isis::ZeroBufferFit.

◆ relErr()

virtual double Isis::NonLinearLSQ::relErr ( ) const
inlinevirtual

Reimplemented in Isis::ZeroBufferFit.

Definition at line 77 of file NonLinearLSQ.h.

◆ setMaxIters()

void Isis::NonLinearLSQ::setMaxIters ( int m)
inline

Sets the maximum number of iterations.

Parameters
mUser provides the maximum number iterations

Definition at line 62 of file NonLinearLSQ.h.

Referenced by Isis::ZeroBufferFit::ZeroBufferFit().

◆ status()

int Isis::NonLinearLSQ::status ( ) const
inline

Return status of last fit processing.

Definition at line 81 of file NonLinearLSQ.h.

Referenced by statusstr(), and success().

◆ statusstr() [1/2]

std::string Isis::NonLinearLSQ::statusstr ( ) const
inline

Return error message pertaining to last fit procesing.

Definition at line 87 of file NonLinearLSQ.h.

Referenced by Isis::ZeroBufferFit::Solve().

◆ statusstr() [2/2]

std::string Isis::NonLinearLSQ::statusstr ( int status) const
inline

Return error message given status condition.

Definition at line 91 of file NonLinearLSQ.h.

References status().

◆ success() [1/2]

bool Isis::NonLinearLSQ::success ( ) const
inline

Determine success from last fit processing.

Definition at line 83 of file NonLinearLSQ.h.

Referenced by Isis::ZeroBufferFit::Solve().

◆ success() [2/2]

bool Isis::NonLinearLSQ::success ( int status) const
inline

Check status for success of the given condition

Definition at line 85 of file NonLinearLSQ.h.

References status().

◆ Terminate()

void Isis::NonLinearLSQ::Terminate ( const std::string & message = "")
protected

Definition at line 84 of file NonLinearLSQ.cpp.

◆ uncert()

NLVector Isis::NonLinearLSQ::uncert ( ) const
inline

Return uncertainties from last fit processing.

Definition at line 105 of file NonLinearLSQ.h.

Referenced by Isis::ZeroBufferFit::Solve().

Member Data Documentation

◆ _fitParms

NLVector Isis::NonLinearLSQ::_fitParms
private

Definition at line 117 of file NonLinearLSQ.h.

◆ _maxIters

int Isis::NonLinearLSQ::_maxIters
private

Definition at line 120 of file NonLinearLSQ.h.

◆ _nIters

int Isis::NonLinearLSQ::_nIters
private

Definition at line 119 of file NonLinearLSQ.h.

◆ _status

int Isis::NonLinearLSQ::_status
private

Definition at line 121 of file NonLinearLSQ.h.

◆ _uncert

NLVector Isis::NonLinearLSQ::_uncert
private

Definition at line 118 of file NonLinearLSQ.h.

◆ _userMessage

std::string Isis::NonLinearLSQ::_userMessage
private

Definition at line 123 of file NonLinearLSQ.h.

◆ _userTerminated

bool Isis::NonLinearLSQ::_userTerminated
private

Definition at line 122 of file NonLinearLSQ.h.


The documentation for this class was generated from the following files: