libkpl  4.1
A Library for Graphical Presentation of Data Sets and Functions
lmfit.h
1 /***************************************************************************
2  lmfit.h - description
3  -------------------
4  begin : Sat May 22 1999
5  copyright : (C) 2015 by Werner Stille
6  email : stille@uni-freiburg.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef LMDIF_H
19 #define LMDIF_H
20 
21 #include <QObject>
22 #include <kdemacros.h>
23 
24 class QString;
25 class ArrayItem;
26 class FunItem;
27 
42 class KDE_EXPORT LMFit : public QObject
43 {
44  Q_OBJECT
45 public:
55  LMFit(const QList<const ArrayItem*>* aList, QList<FunItem*>* fList,
56  const bool* bFit, double* par, QObject* parent = 0,
57  const double* sigma = 0);
59  ~LMFit();
66  static double enorm(int n, const double x[]);
73  static double igamc(double a, double x);
85  bool linFit(int n, int nPar, double par[], double resVector[], double fJac[],
86  int iPvt[]);
100  void lmdif(int n, int nPar, double par[], double resVector[], double tol,
101  int itMax, int* info, double fJac[], int iPvt[]);
109  static int minv(double a[], double x[], int n);
114  inline void setSigma(const double* sigma) { m_sigma = sigma; };
119  inline void setUserBreak(bool userBreak = true) { m_userBreak = userBreak; };
121  inline bool userBreak() const { return m_userBreak; };
122 
123 protected:
124  void fcn(int n, int np, const double p[], double fvec[], int* iflag);
125  void fdjac2(int m, int n, double x[], const double fvec[], double fjac[],
126  int ldfjac, int* iflag, double epsfcn, double wa[]);
127  void lmdif(int m, int np, double px[], double fvec[], double ftol,
128  double ptol, double gtol, int maxfev, double epsfcn,
129  double diag[], int mode, double factor, int nprint,
130  int* info, int* nfev, double fjac[], int ldfjac,
131  int ipvt[], double qtf[], double wa1[], double wa2[],
132  double wa3[], double wa4[]);
133  bool m_userBreak;
134  const bool* m_bFit;
135  double* m_par;
136  const double* m_sigma;
137  const QList<const ArrayItem*>* m_aList;
138  QList<FunItem*>* m_fList;
139 
140 signals:
145  void updateMessage(const QString& message);
146 };
147 
148 #endif
Parameter fit class.
Definition: lmfit.h:42
void setUserBreak(bool userBreak=true)
Sets condition to stop calculations.
Definition: lmfit.h:119
Function item class.
Definition: funitem.h:40
void setSigma(const double *sigma)
Sets data error array.
Definition: lmfit.h:114
bool userBreak() const
Returns current break condition for calculations.
Definition: lmfit.h:121
Array item class.
Definition: arrayitem.h:36