32 FitModel(
const std::string& i_regname,
const size_t& i_nParam,
const size_t& i_min_nb_pts)
35 virtual void setData(
const std::vector<double>& in_X,
const std::vector<double>& in_Y) = 0;
36 void setGuess(
const std::vector<double>& lambda_in);
39 virtual bool fit() = 0;
40 virtual double f(
const double& x)
const = 0;
53 std::vector<double>
X;
54 std::vector<double>
Y;
76 FitLeastSquare(
const std::string& i_regname,
const size_t& i_nParam,
const size_t& i_min_nb_pts) :
FitModel(i_regname, i_nParam, i_min_nb_pts) {}
77 void setData(
const std::vector<double>& in_X,
const std::vector<double>& in_Y);
79 virtual double f(
const double& x)
const = 0;
86 void initDLambda(
Matrix& dLambda)
const;
87 double getDelta(
const double& var)
const;
88 double DDer(
const double& x,
const size_t& index);
91 static const double lambda_init;
92 static const double delta_init_abs;
93 static const double delta_init_rel;
94 static const double eps_conv;
95 static const unsigned int max_iter;
#define AT
Definition: IOExceptions.h:28
A class to perform non-linear least square fitting. It works on a time serie and uses matrix arithmet...
Definition: libfit1DCore.h:74
FitLeastSquare(const std::string &i_regname, const size_t &i_nParam, const size_t &i_min_nb_pts)
Definition: libfit1DCore.h:76
bool fit()
Definition: libfit1DCore.cc:135
virtual double f(const double &x) const =0
void setData(const std::vector< double > &in_X, const std::vector< double > &in_Y)
Definition: libfit1DCore.cc:119
virtual void setDefaultGuess()
Definition: libfit1DCore.cc:128
Definition: libfit1DCore.h:30
std::vector< double > Lambda
Definition: libfit1DCore.h:52
FitModel & operator=(const FitModel &source)
Definition: libfit1DCore.cc:51
bool fit_ready
Definition: libfit1DCore.h:61
bool isReady() const
Definition: libfit1DCore.h:47
std::string getInfo() const
Definition: libfit1DCore.h:44
virtual bool checkInputs()
Definition: libfit1DCore.cc:63
std::vector< double > getParams() const
Definition: libfit1DCore.cc:30
void setGuess(const std::vector< double > &lambda_in)
Definition: libfit1DCore.cc:37
std::string getName() const
Definition: libfit1DCore.h:43
virtual void setData(const std::vector< double > &in_X, const std::vector< double > &in_Y)=0
virtual double f(const double &x) const =0
size_t nPts
Definition: libfit1DCore.h:58
virtual void setDegree(const size_t &)
Definition: libfit1DCore.h:38
void setInfo(const std::string &info)
Definition: libfit1DCore.h:45
double operator()(const double &x) const
Definition: libfit1DCore.h:41
virtual void setLapseRate(const double &)
Definition: libfit1DCore.h:37
size_t nParam
Definition: libfit1DCore.h:59
virtual ~FitModel()
Definition: libfit1DCore.h:34
std::string toString() const
Definition: libfit1DCore.cc:85
size_t min_nb_pts
Definition: libfit1DCore.h:60
std::vector< double > Y
Definition: libfit1DCore.h:54
std::string infoString
Definition: libfit1DCore.h:55
const std::string regname
Definition: libfit1DCore.h:57
FitModel(const std::string &i_regname, const size_t &i_nParam, const size_t &i_min_nb_pts)
Definition: libfit1DCore.h:32
std::vector< double > X
Definition: libfit1DCore.h:53
thrown when encountered an unexpected function's argument (e.g. bad index, bad or missing parameter n...
Definition: IOExceptions.h:130
This class implements the basic operations on matrices. Elements are access in matrix notation: that ...
Definition: Matrix.h:42