GCBM
lmmin.h
Go to the documentation of this file.
1 #ifndef MOJA_MODULES_CBM_LMMIN_H_
2 #define MOJA_MODULES_CBM_LMMIN_H_
3 
4 #include "moja/modules/cbm/_modules.cbm_exports.h"
5 
6 namespace moja {
7  namespace modules {
8  namespace cbm {
9 
10  /* Collection of control parameters. */
11  typedef struct {
12  double ftol; /* relative error desired in the sum of squares. */
13  double xtol; /* relative error between last two approximations. */
14  double gtol; /* orthogonality desired between fvec and its derivs. */
15  double epsilon; /* step used to calculate the jacobian. */
16  double stepbound; /* initial bound to steps in the outer loop. */
17  double fnorm; /* norm of the residue vector fvec. */
18  int maxcall; /* maximum number of iterations. */
19  int nfev; /* actual number of iterations. */
20  int info; /* status of minimization. */
22 
23 
24  class CBM_API LmMin {
25  public:
26  /* Type of user-supplied subroutine that calculates fvec. */
27  typedef void (lm_evaluate_ftype)(double *par, int m_dat, double *fvec, void *data, int *info);
28 
29  /* Default implementation therof, provided by lm_eval.c. */
30  void lm_evaluate_default(double *par, int m_dat, double *fvec, void *data, int *info);
31 
32  /* Type of user-supplied subroutine that informs about fit progress. */
33  typedef void (lm_print_ftype)(int n_par, double *par, int m_dat, double *fvec, void *data, int iflag, int iter, int nfev);
34 
35  /* Default implementation therof, provided by lm_eval.c. */
36  void lm_print_default(int n_par, double *par, int m_dat, double *fvec, void *data, int iflag, int iter, int nfev);
37 
38  /* Initialize control parameters with default values. */
39  void lm_initialize_control(lm_control_type * control);
40 
41  /* Refined calculation of Eucledian norm, typically used in printout routine. */
42  double lm_enorm(int, double *);
43 
44  /* The actual minimization. */
45  void lm_minimize(int m_dat, int n_par, double *par, lm_evaluate_ftype * evaluate, lm_print_ftype * printout, void *data, lm_control_type * control);
46 
47  void lm_lmdif(int m, int n, double *x, double *fvec, double ftol, double xtol, double gtol, int maxfev, double epsfcn,
48  double *diag, int mode, double factor, int *info, int *nfev, double *fjac, int *ipvt, double *qtf, double *wa1,
49  double *wa2, double *wa3, double *wa4, lm_evaluate_ftype * evaluate, lm_print_ftype * printout, void *data);
50 
51  void lm_qrfac(int m, int n, double *a, int pivot, int *ipvt, double *rdiag, double *acnorm, double *wa);
52 
53  void lm_qrsolv(int n, double *r, int ldr, int *ipvt, double *diag, double *qtb, double *x, double *sdiag, double *wa);
54 
55  void lm_lmpar(int n, double *r, int ldr, int *ipvt, double *diag, double *qtb, double delta, double *par, double *x,
56  double *sdiag, double *wa1, double *wa2);
57  private:
58  };
59  }
60  }
61 }
62 #endif
moja::modules::cbm
Definition: ageclasshelper.cpp:12
moja::modules::cbm::lm_control_type::xtol
double xtol
Definition: lmmin.h:13
moja::modules::cbm::lm_control_type::stepbound
double stepbound
Definition: lmmin.h:16
moja::modules::cbm::lm_control_type
Definition: lmmin.h:11
moja::modules::cbm::lm_control_type::maxcall
int maxcall
Definition: lmmin.h:18
moja::modules::cbm::lm_control_type::info
int info
Definition: lmmin.h:20
moja::modules::cbm::lm_control_type::gtol
double gtol
Definition: lmmin.h:14
moja::modules::cbm::lm_control_type::ftol
double ftol
Definition: lmmin.h:12
moja::modules::cbm::lm_control_type::epsilon
double epsilon
Definition: lmmin.h:15
moja
Definition: ageclasshelper.cpp:10
moja::modules::cbm::lm_control_type::fnorm
double fnorm
Definition: lmmin.h:17
moja::modules::cbm::lm_control_type::nfev
int nfev
Definition: lmmin.h:19
moja::modules::cbm::LmMin
Definition: lmmin.h:24