My Project
 All Classes Functions Variables Pages
fitthreat.h
1 #ifndef FITTHREAT_H
2 #define FITTHREAT_H
3 #include <gsl/gsl_vector.h>
4 #include <gsl/gsl_complex.h>
5 #include <gsl/gsl_complex_math.h>
6 #include <gsl/gsl_eigen.h>
7 #include <gsl/gsl_sort_vector.h>
8 #include <gsl/gsl_math.h>
9 #include <gsl/gsl_matrix.h>
10 #include <gsl/gsl_linalg.h>
11 #include <gsl/gsl_blas.h>
12 #include <gsl/gsl_multifit_nlin.h>
13 #include <gsl/gsl_multimin.h>
14 #include <gsl/gsl_multiroots.h>
15 #include <gsl/gsl_errno.h>
16 #include <QProgressDialog>
17 #include <QMessageBox>
18 #include <QThread>
19 #include <QMutex>
20 #include <QTime>
21 #include "array.h"
22 #include "math.h"
23 
24 typedef struct fitcontent{
25  double (*chi2)(void*);
26  double (*runchi2)(void*,int);
27  void* instance;
28  int cpara;
29  int* IsChanged;
30  double* param;
31  int runi;
32 }fitcontent;
33 enum threattyp {fitseriell,fitglobal,errorseriell,errorglobal,notvalid};
34 
35 class CorrelationEle{
36  public:
37  CorrelationEle(int ia, int ib, double vala,
38  double valb, double valab,
39  double xa, double xb);
40  ~CorrelationEle();
41  bool operator<(const CorrelationEle o2)const;
42  int a,b;
43  double va,vb;
44  double correlation;
45 };
46 
47 
48 class fitthreat: public QThread{
49 Q_OBJECT
50 public:
51  void run();
52  void exit();
53  fitthreat(double* para, int* changed, double* errors, int cpara,
54  double (*f)(void*), void* instance, int MaxIter,
55  double conv, bool forceSimplex);
56  fitthreat(double* para, int runi, double* errors, int cpara,
57  double (*f)(void*,int), void* instance, int MaxIter,
58  double conv);
59  fitthreat();
60  ~fitthreat();
61  fitthreat(double* para, int* changed, double *errors, int cpara,
62  double (*chi2)(void*), void* instance, bool correlated);
63  fitthreat(double* para, int runi, double *errors, int cpara,
64  double (*chi2)(void*,int), void* instance);
65 public slots:
66  void stop_calculations();
67 
68 private:
69  void fit_seriell();
70  void fit_global();
71  void fit_global_simplex();
72  void errors_covariant();
73  int correlation_possible(int xi, int yi);
74  void Hesse_to_covariant_errors(gsl_matrix *H, double* errors,
75  double* vals, int cpara);
76  QString correlations(gsl_matrix *H, int cpara, double* vals);
77  double fxx(double* v, double v0, double* ss, double chi0);
78  double fx(double* v, double v0, double* ss, double chi0);
79  double fxy(double* vx, double* vy,
80  double v0x, double v0y,
81  double fxx, double fyy,
82  double ssx, double ssy, double chi0);
83  double* para;
84  int runi;
85  double* errors;
86  int* changed;
87  int cpara;
88  bool correlated;
89  double (*f_global)(void*);
90  double (*f_seriell)(void*,int);
91  double f();
92  double (*chi2)(void*);
93  void* instance;
94  int MaxIter;
95  threattyp fitmodel;
96  int proceed_calc;
97  double conv;
98  bool usesimplex;
99 signals:
100  void refresh_progress(int ID, int citer,double chi2);
101  void finished(int ID);
102  void error_message(QString message);
103 
104 };
105 
106 #endif // FITTHREAT_H
container to be used in GSL minimization functions
Definition: fitthread.h:36
Definition: fitthreat.h:48
container to sort correlation matrix elements using qSort()
Definition: fitthread.h:58
CorrelationEle(int ia, int ib, double vala, double valb, double valab, double xa, double xb)
Definition: fitthread.cpp:1163
parser and handler of user input mbs-files
Definition: fitmodel.h:159