diff options
author | tlatorre <tlatorre@uchicago.edu> | 2018-08-14 15:08:54 -0500 |
---|---|---|
committer | tlatorre <tlatorre@uchicago.edu> | 2018-08-14 15:08:54 -0500 |
commit | 46928c6b2f9439fb0664cf01e820c568feae8ec1 (patch) | |
tree | e45066e1dd68fd59f35bbdd74f7e861faec27e62 /src | |
parent | 4e1d2393200d1ce6c2e47d124f6cf5c2008b4785 (diff) | |
download | sddm-46928c6b2f9439fb0664cf01e820c568feae8ec1.tar.gz sddm-46928c6b2f9439fb0664cf01e820c568feae8ec1.tar.bz2 sddm-46928c6b2f9439fb0664cf01e820c568feae8ec1.zip |
add lower and upper bounds for the fit parameters
Diffstat (limited to 'src')
-rw-r--r-- | src/fit.c | 22 |
1 files changed, 20 insertions, 2 deletions
@@ -53,8 +53,7 @@ double nll(unsigned int n, const double *x, double *grad, void *params) int fit_event(event *ev, double *fmin) { - double x[7]; - double ss[7]; + double x[7], ss[7], lb[7], ub[7]; int rv; nlopt_opt opt = nlopt_create(NLOPT_LN_SBPLX, 7); @@ -77,6 +76,25 @@ int fit_event(event *ev, double *fmin) ss[5] = 0.1; ss[6] = 1.0; + lb[0] = 1.0; + lb[1] = -1000.0; + lb[2] = -1000.0; + lb[3] = -1000.0; + lb[4] = 0.0; + lb[5] = 0.0; + lb[6] = 0.0; + + ub[0] = 100000.0; + ub[1] = 1000.0; + ub[2] = 1000.0; + ub[3] = 1000.0; + ub[4] = M_PI; + ub[5] = 2*M_PI; + ub[6] = 400.0; + + nlopt_set_lower_bounds(opt, lb); + nlopt_set_upper_bounds(opt, ub); + nlopt_set_initial_step(opt, ss); rv = nlopt_optimize(opt,x,fmin); |