1 #ifndef JULIAN_MINIMIZER1D_HPP 2 #define JULIAN_MINIMIZER1D_HPP 5 #include <gsl/gsl_errno.h> 6 #include <gsl/gsl_math.h> 7 #include <gsl/gsl_min.h> 66 double minimizer1d(F f,
double x_lo,
double x_hi,
double guess,
double precision,
int number_of_iterations,
Minimizer1d t) {
68 gsl_function *gsl_f =
static_cast<gsl_function*
>(&pF);
70 const gsl_min_fminimizer_type *T;
71 gsl_min_fminimizer *s;
74 T = gsl_min_fminimizer_goldensection;
77 T = gsl_min_fminimizer_brent;
80 T = gsl_min_fminimizer_quad_golden;
84 s = gsl_min_fminimizer_alloc (T);
85 gsl_min_fminimizer_set (s, gsl_f, guess, x_lo, x_hi);
91 status = gsl_min_fminimizer_iterate (s);
92 status = gsl_min_test_interval (x_lo, x_hi, 0.0, precision);
93 }
while (status == GSL_CONTINUE && iter < number_of_iterations);
95 double ret = gsl_min_fminimizer_x_minimum (s);
96 gsl_min_fminimizer_free (s);
File contains adapter of GSL Function.
Definition: cadHoliday.cpp:3
Class implements adapter for gsl_function.
Definition: GslFunctionAdapter.hpp:25
Brent-Gill-Murray algorithm.
Golden Section minimizer.
Minimizer1d
Types of 1d minimizers algorithms.
Definition: minimizer1d.hpp:42
double minimizer1d(F f, double x_lo, double x_hi, double guess, double precision, int number_of_iterations, Minimizer1d t)
Function finds minimum of provided one-argument function.
Definition: minimizer1d.hpp:66