fitting.h Source File

LibRPA: fitting.h Source File
LibRPA
fitting.h
Go to the documentation of this file.
1 
5 #pragma once
6 #include <functional>
7 #include <vector>
8 
9 namespace LIBRPA
10 {
11 
12 namespace utils
13 {
14 
17 {
19  int d_maxiter;
20  double d_init_lambda;
21  double d_up_factor;
22  double d_down_factor;
24  double d_target_derr;
25 
26  int d_final_it;
27  double d_final_err;
28  double d_final_derr;
29 
30  // default constructor
32  // destructor
33  ~LevMarqFitting() {};
34  // copy & move constructor
35  LevMarqFitting(const LevMarqFitting& s) = delete;
36  LevMarqFitting(LevMarqFitting&& s) = delete;
37  // copy & move assignment operator
38  LevMarqFitting& operator=(const LevMarqFitting& s) = delete;
39  LevMarqFitting& operator=(LevMarqFitting&& s) = delete;
40 
42 
49  void fit(std::vector<double> &pars, const std::vector<double> &xs,
50  const std::vector<double> &ys,
51  const std::function<double(double, const std::vector<double> &)> &func,
52  const std::function<void(std::vector<double> &, double, const std::vector<double> &)> &grad);
53 
55  std::vector<double> fit_eval(std::vector<double> &pars, const std::vector<double> &xs,
56  const std::vector<double> &ys,
57  const std::function<double(double, const std::vector<double> &)> &func,
58  const std::function<void(std::vector<double> &, double, const std::vector<double> &)> &grad,
59  const std::vector<double> &xs_eval);
60 };
61 
62 } /* end of namespace utils */
63 
64 } /* end of namespace LIBRPA */
65 
Definition: analycont.cpp:14
Non-linear fitting using the Levenberg-Marquardt algorithm.
Definition: fitting.h:17
std::vector< double > fit_eval(std::vector< double > &pars, const std::vector< double > &xs, const std::vector< double > &ys, const std::function< double(double, const std::vector< double > &)> &func, const std::function< void(std::vector< double > &, double, const std::vector< double > &)> &grad, const std::vector< double > &xs_eval)
perform the fitting and evaluate the functin on a set of abscissa points
Definition: fitting.cpp:206
void fit(std::vector< double > &pars, const std::vector< double > &xs, const std::vector< double > &ys, const std::function< double(double, const std::vector< double > &)> &func, const std::function< void(std::vector< double > &, double, const std::vector< double > &)> &grad)
perform the fitting
Definition: fitting.cpp:104
int d_maxiter
Maximal number of iterations.
Definition: fitting.h:19
double d_target_derr
Target difference betwee errors of adjacent parameters estimate.
Definition: fitting.h:24