File: LMfit.h

package info (click to toggle)
fityk 0.4.4-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,472 kB
  • ctags: 2,617
  • sloc: cpp: 19,705; sh: 5,965; xml: 2,325; yacc: 356; makefile: 183; lex: 178
file content (47 lines) | stat: -rw-r--r-- 936 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// This file is part of fityk program. Copyright (C) Marcin Wojdyr
// $Id: LMfit.h,v 1.1.1.1 2003/06/17 20:07:53 wojdyr Exp $

#ifndef LMfit__h__
#define LMfit__h__
#include "common.h"
#include <vector>
#include <map>
#include <string>
#include "v_fit.h"

/*     this class contains Levenberg-Marquardt method
 */


class LMfit : public v_fit
{
public:
    LMfit ();
    ~LMfit ();
    fp init(); // called before do_iteration()/autoiter()
    int autoiter ();
private:
    fp lambda_starting_value;
    fp lambda_up_factor;
    fp lambda_down_factor;
    fp stop_rel;
    fp shake_before;
    char shake_type;
    std::vector<fp> alpha, alpha_;            // matrices
    std::vector<fp> beta, beta_;   // and vectors
    std::vector<fp> a;    // parameters table
    fp chi2 , chi2_;
    fp lambda;

    int do_iteration();
};

inline void Swap (fp &fp1 ,fp &fp2) 
{
    fp swaptmp = fp1;
    fp1 = fp2;
    fp2 = swaptmp;
}

#endif