gsl_min.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. #ifndef __GSL_MIN_H__
  20. #define __GSL_MIN_H__
  21. #include <stdlib.h>
  22. #include "gsl_types.h"
  23. #include "gsl_math.h"
  24. #undef __BEGIN_DECLS
  25. #undef __END_DECLS
  26. #ifdef __cplusplus
  27. # define __BEGIN_DECLS extern "C" {
  28. # define __END_DECLS }
  29. #else
  30. # define __BEGIN_DECLS /* empty */
  31. # define __END_DECLS /* empty */
  32. #endif
  33. __BEGIN_DECLS
  34. typedef struct
  35. {
  36. const char *name;
  37. size_t size;
  38. 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);
  39. 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);
  40. }
  41. gsl_min_fminimizer_type;
  42. typedef struct
  43. {
  44. const gsl_min_fminimizer_type * type;
  45. gsl_function * function ;
  46. double x_minimum ;
  47. double x_lower ;
  48. double x_upper ;
  49. double f_minimum, f_lower, f_upper;
  50. void *state;
  51. }
  52. gsl_min_fminimizer;
  53. gsl_min_fminimizer *
  54. gsl_min_fminimizer_alloc (const gsl_min_fminimizer_type * T) ;
  55. void gsl_min_fminimizer_free (gsl_min_fminimizer * s);
  56. int gsl_min_fminimizer_set (gsl_min_fminimizer * s,
  57. gsl_function * f, double x_minimum,
  58. double x_lower, double x_upper);
  59. int gsl_min_fminimizer_set_with_values (gsl_min_fminimizer * s,
  60. gsl_function * f,
  61. double x_minimum, double f_minimum,
  62. double x_lower, double f_lower,
  63. double x_upper, double f_upper);
  64. int gsl_min_fminimizer_iterate (gsl_min_fminimizer * s);
  65. const char * gsl_min_fminimizer_name (const gsl_min_fminimizer * s);
  66. double gsl_min_fminimizer_x_minimum (const gsl_min_fminimizer * s);
  67. double gsl_min_fminimizer_x_lower (const gsl_min_fminimizer * s);
  68. double gsl_min_fminimizer_x_upper (const gsl_min_fminimizer * s);
  69. double gsl_min_fminimizer_f_minimum (const gsl_min_fminimizer * s);
  70. double gsl_min_fminimizer_f_lower (const gsl_min_fminimizer * s);
  71. double gsl_min_fminimizer_f_upper (const gsl_min_fminimizer * s);
  72. /* Deprecated, use x_minimum instead */
  73. double gsl_min_fminimizer_minimum (const gsl_min_fminimizer * s);
  74. int
  75. gsl_min_test_interval (double x_lower, double x_upper, double epsabs, double epsrel);
  76. GSL_VAR const gsl_min_fminimizer_type * gsl_min_fminimizer_goldensection;
  77. GSL_VAR const gsl_min_fminimizer_type * gsl_min_fminimizer_brent;
  78. typedef
  79. int (*gsl_min_bracketing_function)(gsl_function *f,
  80. double *x_minimum,double * f_minimum,
  81. double *x_lower, double * f_lower,
  82. double *x_upper, double * f_upper,
  83. size_t eval_max);
  84. int
  85. gsl_min_find_bracket(gsl_function *f,double *x_minimum,double * f_minimum,
  86. double *x_lower, double * f_lower,
  87. double *x_upper, double * f_upper,
  88. size_t eval_max);
  89. __END_DECLS
  90. #endif /* __GSL_MIN_H__ */