File: LMfit.h

package info (click to toggle)
fityk 1.3.1-6
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 3,784 kB
  • sloc: cpp: 34,396; ansic: 4,673; python: 971; makefile: 366; sh: 117; java: 31; ruby: 27; perl: 25; xml: 16
file content (39 lines) | stat: -rw-r--r-- 1,103 bytes parent folder | download | duplicates (3)
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
// This file is part of fityk program. Copyright 2001-2013 Marcin Wojdyr
// Licence: GNU General Public License ver. 2+

/// Simple implementation of the Levenberg-Marquardt method,
/// uses Jordan elimination with partial pivoting.

#ifndef FITYK_LMFIT_H_
#define FITYK_LMFIT_H_
#include <vector>
#include "fityk.h"
#include "fit.h"

namespace fityk {

class LMfit : public Fit
{
public:
    LMfit(Full* F, const char* name) : Fit(F, name) {}
    virtual double run_method(std::vector<realt>* best_a);

    // the same methods that were used for all methods up to ver. 1.2.1
    // (just for backward compatibility)
    virtual std::vector<double>
        get_covariance_matrix(const std::vector<Data*>& datas);
    virtual std::vector<double>
        get_standard_errors(const std::vector<Data*>& datas);

private:
    std::vector<realt> alpha_; // matrix
    std::vector<realt> beta_;  // and vector

    // working arrays in do_iteration()
    std::vector<realt> temp_alpha_, temp_beta_;

    void prepare_next_parameters(double lambda, const std::vector<realt> &a);
};

} // namespace fityk
#endif