summaryrefslogtreecommitdiff
path: root/lib/Numeric/GSL/gsl-aux.c
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2009-06-08 07:53:34 +0000
committerAlberto Ruiz <aruiz@um.es>2009-06-08 07:53:34 +0000
commit34de6154086224a0e9f774bd8a2ab804d78e8a10 (patch)
tree788b49f8889a166db2fb61365afedf7ac2c29bf6 /lib/Numeric/GSL/gsl-aux.c
parent7697c6dc27fd0d9601728af576e8d7b9d1c800ee (diff)
included all GSL minimization methods
Diffstat (limited to 'lib/Numeric/GSL/gsl-aux.c')
-rw-r--r--lib/Numeric/GSL/gsl-aux.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/Numeric/GSL/gsl-aux.c b/lib/Numeric/GSL/gsl-aux.c
index c6b052f..2ecfb51 100644
--- a/lib/Numeric/GSL/gsl-aux.c
+++ b/lib/Numeric/GSL/gsl-aux.c
@@ -369,7 +369,7 @@ double only_f_aux_min(const gsl_vector*x, void *pars) {
369} 369}
370 370
371// this version returns info about intermediate steps 371// this version returns info about intermediate steps
372int minimize(double f(int, double*), double tolsize, int maxit, 372int minimize(int method, double f(int, double*), double tolsize, int maxit,
373 KRVEC(xi), KRVEC(sz), RMAT(sol)) { 373 KRVEC(xi), KRVEC(sz), RMAT(sol)) {
374 REQUIRES(xin==szn && solr == maxit && solc == 3+xin,BAD_SIZE); 374 REQUIRES(xin==szn && solr == maxit && solc == 3+xin,BAD_SIZE);
375 DEBUGMSG("minimizeList (nmsimplex)"); 375 DEBUGMSG("minimizeList (nmsimplex)");
@@ -388,7 +388,11 @@ int minimize(double f(int, double*), double tolsize, int maxit,
388 // Starting point 388 // Starting point
389 KDVVIEW(xi); 389 KDVVIEW(xi);
390 // Minimizer nmsimplex, without derivatives 390 // Minimizer nmsimplex, without derivatives
391 T = gsl_multimin_fminimizer_nmsimplex; 391 switch(method) {
392 case 0 : {T = gsl_multimin_fminimizer_nmsimplex; break; }
393 case 1 : {T = gsl_multimin_fminimizer_nmsimplex2; break; }
394 default: ERROR(BAD_CODE);
395 }
392 s = gsl_multimin_fminimizer_alloc (T, my_func.n); 396 s = gsl_multimin_fminimizer_alloc (T, my_func.n);
393 gsl_multimin_fminimizer_set (s, &my_func, V(xi), V(sz)); 397 gsl_multimin_fminimizer_set (s, &my_func, V(xi), V(sz));
394 do { 398 do {
@@ -458,9 +462,9 @@ void fdf_aux_min(const gsl_vector * x, void * pars, double * f, gsl_vector * g)
458} 462}
459 463
460 464
461int minimizeWithDeriv(int method, double f(int, double*), void df(int, double*, double*), 465int minimizeD(int method, double f(int, double*), void df(int, double*, double*),
462 double initstep, double minimpar, double tolgrad, int maxit, 466 double initstep, double minimpar, double tolgrad, int maxit,
463 KRVEC(xi), RMAT(sol)) { 467 KRVEC(xi), RMAT(sol)) {
464 REQUIRES(solr == maxit && solc == 2+xin,BAD_SIZE); 468 REQUIRES(solr == maxit && solc == 2+xin,BAD_SIZE);
465 DEBUGMSG("minimizeWithDeriv (conjugate_fr)"); 469 DEBUGMSG("minimizeWithDeriv (conjugate_fr)");
466 gsl_multimin_function_fdf my_func; 470 gsl_multimin_function_fdf my_func;
@@ -482,7 +486,10 @@ int minimizeWithDeriv(int method, double f(int, double*), void df(int, double*,
482 // conjugate gradient fr 486 // conjugate gradient fr
483 switch(method) { 487 switch(method) {
484 case 0 : {T = gsl_multimin_fdfminimizer_conjugate_fr; break; } 488 case 0 : {T = gsl_multimin_fdfminimizer_conjugate_fr; break; }
485 case 1 : {T = gsl_multimin_fdfminimizer_vector_bfgs2; break; } 489 case 1 : {T = gsl_multimin_fdfminimizer_conjugate_pr; break; }
490 case 2 : {T = gsl_multimin_fdfminimizer_vector_bfgs; break; }
491 case 3 : {T = gsl_multimin_fdfminimizer_vector_bfgs2; break; }
492 case 4 : {T = gsl_multimin_fdfminimizer_steepest_descent; break; }
486 default: ERROR(BAD_CODE); 493 default: ERROR(BAD_CODE);
487 } 494 }
488 s = gsl_multimin_fdfminimizer_alloc (T, my_func.n); 495 s = gsl_multimin_fdfminimizer_alloc (T, my_func.n);