libkpl  4.1
A Library for Graphical Presentation of Data Sets and Functions
Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
LMFit Class Reference

Parameter fit class. More...

#include <lmfit.h>

Inheritance diagram for LMFit:
Inheritance graph
[legend]

Signals

void updateMessage (const QString &message)
 Emitted when a message should be displayed. More...
 

Public Member Functions

 LMFit (const QList< const ArrayItem * > *aList, QList< FunItem * > *fList, const bool *bFit, double *par, QObject *parent=0, const double *sigma=0)
 Constructor. More...
 
 ~LMFit ()
 Destructor. More...
 
bool linFit (int n, int nPar, double par[], double resVector[], double fJac[], int iPvt[])
 Performs general linear least square parameter fit. More...
 
void lmdif (int n, int nPar, double par[], double resVector[], double tol, int itMax, int *info, double fJac[], int iPvt[])
 Performs nonlinear Levenberg-Marquardt parameter fit. More...
 
void setSigma (const double *sigma)
 Sets data error array. More...
 
void setUserBreak (bool userBreak=true)
 Sets condition to stop calculations. More...
 
bool userBreak () const
 Returns current break condition for calculations. More...
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
virtual const QMetaObjectmetaObject () const
 
QString objectName () const
 
void setObjectName (const QString &name)
 
bool isWidgetType () const
 
bool signalsBlocked () const
 
bool blockSignals (bool block)
 
QThreadthread () const
 
void moveToThread (QThread *targetThread)
 
int startTimer (int interval)
 
void killTimer (int id)
 
findChild (const QString &name) const
 
QList< T > findChildren (const QString &name) const
 
QList< T > findChildren (const QRegExp &regExp) const
 
QObjectchild (const char *objName, const char *inheritsClass, bool recursiveSearch) const
 
const QObjectList & children () const
 
void setParent (QObject *parent)
 
void installEventFilter (QObject *filterObj)
 
void removeEventFilter (QObject *obj)
 
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
bool disconnect (const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *receiver, const char *method)
 
void dumpObjectTree ()
 
void dumpObjectInfo ()
 
bool setProperty (const char *name, const QVariant &value)
 
QVariant property (const char *name) const
 
QList< QByteArraydynamicPropertyNames () const
 
void destroyed (QObject *obj)
 
QObjectparent () const
 
bool inherits (const char *className) const
 
void deleteLater ()
 
 QObject (QObject *parent, const char *name)
 
void insertChild (QObject *object)
 
void removeChild (QObject *object)
 
bool isA (const char *className) const
 
const char * className () const
 
const char * name () const
 
const char * name (const char *defaultName) const
 
void setName (const char *name)
 

Static Public Member Functions

static double enorm (int n, const double x[])
 Calculates the euclidean norm of x. More...
 
static double igamc (double a, double x)
 Calculates complemented incomplete gamma integral. More...
 
static int minv (double a[], double x[], int n)
 Finds the inverse of a square matrix. More...
 
- Static Public Member Functions inherited from QObject
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 

Protected Member Functions

void fcn (int n, int np, const double p[], double fvec[], int *iflag)
 
void fdjac2 (int m, int n, double x[], const double fvec[], double fjac[], int ldfjac, int *iflag, double epsfcn, double wa[])
 
void lmdif (int m, int np, double px[], double fvec[], double ftol, double ptol, double gtol, int maxfev, double epsfcn, double diag[], int mode, double factor, int nprint, int *info, int *nfev, double fjac[], int ldfjac, int ipvt[], double qtf[], double wa1[], double wa2[], double wa3[], double wa4[])
 
- Protected Member Functions inherited from QObject
QObjectsender () const
 
int senderSignalIndex () const
 
int receivers (const char *signal) const
 
virtual void timerEvent (QTimerEvent *event)
 
virtual void childEvent (QChildEvent *event)
 
virtual void customEvent (QEvent *event)
 
virtual void connectNotify (const char *signal)
 
virtual void disconnectNotify (const char *signal)
 
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
 

Protected Attributes

bool m_userBreak
 
const bool * m_bFit
 
double * m_par
 
const double * m_sigma
 
const QList< const ArrayItem * > * m_aList
 
QList< FunItem * > * m_fList
 

Additional Inherited Members

- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 
- Properties inherited from QObject
 objectName
 

Detailed Description

Parameter fit class.

Provides methods for nonlinear Levenberg-Marquardt parameter fits and general linear least square parameter fits.

The functions lmdif, lmpar, fdjac2, qrsolv, qrfac, and enorm use code from the public domain Fortran version of Argonne National Laboratories MINPACK, C translation by Steve Moshier. Modifications by Werner Stille.

The functions minv, igamc, igam, simq, and mtransp are from the Cephes Math Library Release 2.7, Copyright by Stephen L. Moshier.

The function lgam (original name: gsl_sf_lngamma_impl, Author: G. Jungman) is from the GNU Scientific Library. Modifications by Werner Stille.

Constructor & Destructor Documentation

LMFit::LMFit ( const QList< const ArrayItem * > *  aList,
QList< FunItem * > *  fList,
const bool *  bFit,
double *  par,
QObject parent = 0,
const double *  sigma = 0 
)

Constructor.

Parameters
aListlist of array items.
fListlist of function items.
bFitarray containing true values for parameters to be fitted.
pararray of parameters.
sigmaarray for data errors.
parentpointer to parent widget.
LMFit::~LMFit ( )

Destructor.

Member Function Documentation

static double LMFit::enorm ( int  n,
const double  x[] 
)
static

Calculates the euclidean norm of x.

Parameters
nlength of x.
xinput array.
Returns
euclidean norm of x.
static double LMFit::igamc ( double  a,
double  x 
)
static

Calculates complemented incomplete gamma integral.

Parameters
aargument of gamma function.
xupper boundary of integral.
Returns
complemented incomplete gamma integral.
bool LMFit::linFit ( int  n,
int  nPar,
double  par[],
double  resVector[],
double  fJac[],
int  iPvt[] 
)

Performs general linear least square parameter fit.

Parameters
nnumber of data points.
nParnumber of parameters to be fitted.
pararray of parameters to be fitted.
resVectorarray for weighted residuals.
fJacarray for calculating the Jacobian matrix.
iPvtarray defining a permutation matrix for calculating the Jacobian matrix.
Returns
true in case of termination by user.
void LMFit::lmdif ( int  n,
int  nPar,
double  par[],
double  resVector[],
double  tol,
int  itMax,
int *  info,
double  fJac[],
int  iPvt[] 
)

Performs nonlinear Levenberg-Marquardt parameter fit.

Parameters
nnumber of data points.
nParnumber of parameters to be fitted.
pararray of parameters to be fitted.
resVectorarray for weighted residuals.
toltolerance value for stopping nonlinear fit iterations.
itMaxmaximum number of nonlinear fit iterations.
infoerror code.
fJacarray for calculating the Jacobian matrix.
iPvtarray defining a permutation matrix for calculating the Jacobian matrix.
static int LMFit::minv ( double  a[],
double  x[],
int  n 
)
static

Finds the inverse of a square matrix.

Parameters
ainput matrix.
xoutput matrix.
nnumbers of rows and columns of input matrix.
Returns
0 for success.
void LMFit::setSigma ( const double *  sigma)
inline

Sets data error array.

Parameters
sigmaarray for data errors.
void LMFit::setUserBreak ( bool  userBreak = true)
inline

Sets condition to stop calculations.

Parameters
userBreaktrue to break calculations.
void LMFit::updateMessage ( const QString message)
signal

Emitted when a message should be displayed.

Parameters
messagemessage text
bool LMFit::userBreak ( ) const
inline

Returns current break condition for calculations.


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