| 1 | /* min/gsl_min.h |
| 2 | * |
| 3 | * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 3 of the License, or (at |
| 8 | * your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, but |
| 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 18 | */ |
| 19 | |
| 20 | #ifndef __GSL_MIN_H__ |
| 21 | #define __GSL_MIN_H__ |
| 22 | |
| 23 | #include <stdlib.h> |
| 24 | #include "gsl_types.h" |
| 25 | #include "gsl_math.h" |
| 26 | |
| 27 | #undef __BEGIN_DECLS |
| 28 | #undef __END_DECLS |
| 29 | #ifdef __cplusplus |
| 30 | # define __BEGIN_DECLS extern "C" { |
| 31 | # define __END_DECLS } |
| 32 | #else |
| 33 | # define __BEGIN_DECLS /* empty */ |
| 34 | # define __END_DECLS /* empty */ |
| 35 | #endif |
| 36 | |
| 37 | __BEGIN_DECLS |
| 38 | |
| 39 | typedef struct |
| 40 | { |
| 41 | const char *name; |
| 42 | size_t size; |
| 43 | int (*set) (void *state, gsl_function * f, double x_minimum, double f_minimum, double x_lower, double f_lower, double x_upper, double f_upper); |
| 44 | int (*iterate) (void *state, gsl_function * f, double * x_minimum, double * f_minimum, double * x_lower, double * f_lower, double * x_upper, double * f_upper); |
| 45 | } |
| 46 | gsl_min_fminimizer_type; |
| 47 | |
| 48 | typedef struct |
| 49 | { |
| 50 | const gsl_min_fminimizer_type * type; |
| 51 | gsl_function * function ; |
| 52 | double x_minimum ; |
| 53 | double x_lower ; |
| 54 | double x_upper ; |
| 55 | double f_minimum, f_lower, f_upper; |
| 56 | void *state; |
| 57 | } |
| 58 | gsl_min_fminimizer; |
| 59 | |
| 60 | gsl_min_fminimizer * |
| 61 | gsl_min_fminimizer_alloc (const gsl_min_fminimizer_type * T) ; |
| 62 | |
| 63 | void gsl_min_fminimizer_free (gsl_min_fminimizer * s); |
| 64 | |
| 65 | int gsl_min_fminimizer_set (gsl_min_fminimizer * s, |
| 66 | gsl_function * f, double x_minimum, |
| 67 | double x_lower, double x_upper); |
| 68 | |
| 69 | int gsl_min_fminimizer_set_with_values (gsl_min_fminimizer * s, |
| 70 | gsl_function * f, |
| 71 | double x_minimum, double f_minimum, |
| 72 | double x_lower, double f_lower, |
| 73 | double x_upper, double f_upper); |
| 74 | |
| 75 | int gsl_min_fminimizer_iterate (gsl_min_fminimizer * s); |
| 76 | |
| 77 | const char * gsl_min_fminimizer_name (const gsl_min_fminimizer * s); |
| 78 | |
| 79 | double gsl_min_fminimizer_x_minimum (const gsl_min_fminimizer * s); |
| 80 | double gsl_min_fminimizer_x_lower (const gsl_min_fminimizer * s); |
| 81 | double gsl_min_fminimizer_x_upper (const gsl_min_fminimizer * s); |
| 82 | double gsl_min_fminimizer_f_minimum (const gsl_min_fminimizer * s); |
| 83 | double gsl_min_fminimizer_f_lower (const gsl_min_fminimizer * s); |
| 84 | double gsl_min_fminimizer_f_upper (const gsl_min_fminimizer * s); |
| 85 | |
| 86 | /* Deprecated, use x_minimum instead */ |
| 87 | double gsl_min_fminimizer_minimum (const gsl_min_fminimizer * s); |
| 88 | |
| 89 | int |
| 90 | gsl_min_test_interval (double x_lower, double x_upper, double epsabs, double epsrel); |
| 91 | |
| 92 | GSL_VAR const gsl_min_fminimizer_type * gsl_min_fminimizer_goldensection; |
| 93 | GSL_VAR const gsl_min_fminimizer_type * gsl_min_fminimizer_brent; |
| 94 | |
| 95 | typedef |
| 96 | int (*gsl_min_bracketing_function)(gsl_function *f, |
| 97 | double *x_minimum,double * f_minimum, |
| 98 | double *x_lower, double * f_lower, |
| 99 | double *x_upper, double * f_upper, |
| 100 | size_t eval_max); |
| 101 | |
| 102 | int |
| 103 | gsl_min_find_bracket(gsl_function *f,double *x_minimum,double * f_minimum, |
| 104 | double *x_lower, double * f_lower, |
| 105 | double *x_upper, double * f_upper, |
| 106 | size_t eval_max); |
| 107 | |
| 108 | __END_DECLS |
| 109 | |
| 110 | #endif /* __GSL_MIN_H__ */ |