diff options
Diffstat (limited to 'lib/Numeric/GSL/gsl-aux.c')
-rw-r--r-- | lib/Numeric/GSL/gsl-aux.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Numeric/GSL/gsl-aux.c b/lib/Numeric/GSL/gsl-aux.c index 2ecfb51..9261f0c 100644 --- a/lib/Numeric/GSL/gsl-aux.c +++ b/lib/Numeric/GSL/gsl-aux.c | |||
@@ -423,7 +423,7 @@ int minimize(int method, double f(int, double*), double tolsize, int maxit, | |||
423 | 423 | ||
424 | // working with the gradient | 424 | // working with the gradient |
425 | 425 | ||
426 | typedef struct {double (*f)(int, double*); void (*df)(int, double*, double*);} Tfdf; | 426 | typedef struct {double (*f)(int, double*); int (*df)(int, double*, int, double*);} Tfdf; |
427 | 427 | ||
428 | double f_aux_min(const gsl_vector*x, void *pars) { | 428 | double f_aux_min(const gsl_vector*x, void *pars) { |
429 | Tfdf * fdf = ((Tfdf*) pars); | 429 | Tfdf * fdf = ((Tfdf*) pars); |
@@ -441,13 +441,13 @@ double f_aux_min(const gsl_vector*x, void *pars) { | |||
441 | void df_aux_min(const gsl_vector * x, void * pars, gsl_vector * g) { | 441 | void df_aux_min(const gsl_vector * x, void * pars, gsl_vector * g) { |
442 | Tfdf * fdf = ((Tfdf*) pars); | 442 | Tfdf * fdf = ((Tfdf*) pars); |
443 | double* p = (double*)calloc(x->size,sizeof(double)); | 443 | double* p = (double*)calloc(x->size,sizeof(double)); |
444 | double* q = (double*)calloc(x->size,sizeof(double)); | 444 | double* q = (double*)calloc(g->size,sizeof(double)); |
445 | int k; | 445 | int k; |
446 | for(k=0;k<x->size;k++) { | 446 | for(k=0;k<x->size;k++) { |
447 | p[k] = gsl_vector_get(x,k); | 447 | p[k] = gsl_vector_get(x,k); |
448 | } | 448 | } |
449 | 449 | ||
450 | fdf->df(x->size,p,q); | 450 | fdf->df(x->size,p,g->size,q); |
451 | 451 | ||
452 | for(k=0;k<x->size;k++) { | 452 | for(k=0;k<x->size;k++) { |
453 | gsl_vector_set(g,k,q[k]); | 453 | gsl_vector_set(g,k,q[k]); |
@@ -462,7 +462,7 @@ void fdf_aux_min(const gsl_vector * x, void * pars, double * f, gsl_vector * g) | |||
462 | } | 462 | } |
463 | 463 | ||
464 | 464 | ||
465 | int minimizeD(int method, double f(int, double*), void df(int, double*, double*), | 465 | int minimizeD(int method, double f(int, double*), int df(int, double*, int, double*), |
466 | double initstep, double minimpar, double tolgrad, int maxit, | 466 | double initstep, double minimpar, double tolgrad, int maxit, |
467 | KRVEC(xi), RMAT(sol)) { | 467 | KRVEC(xi), RMAT(sol)) { |
468 | REQUIRES(solr == maxit && solc == 2+xin,BAD_SIZE); | 468 | REQUIRES(solr == maxit && solc == 2+xin,BAD_SIZE); |