3 #ifndef MYGSL_MULTIMIN_H 4 #define MYGSL_MULTIMIN_H 1 13 #include <gsl/gsl_multimin.h> 14 #include <gsl/gsl_vector.h> 102 const std::string & name_);
105 const std::string & name_ ,
109 const std::string & name_ ,
114 bool fixed_ =
false);
177 size_t _free_dimension_;
178 size_t _auto_dimension_;
180 void _update_free_dimension_ ();
182 void _update_auto_dimension_ ();
184 void _update_dimensions_ ();
234 virtual int _eval_f (
double & f_) = 0;
236 virtual int _eval_df (
double * gradient_) = 0;
244 virtual int eval_f (
const double * x_ ,
double & f_);
246 virtual int eval_df (
const double * x_ ,
double * gradient_);
248 virtual int eval_fdf (
const double * x_ ,
253 size_t dimension_)
const;
262 void dump (std::ostream & out_)
const;
272 static double multimin_f (
const gsl_vector * v_ ,
void * params_);
274 static void multimin_df (
const gsl_vector * v_ ,
void * params_ ,
275 gsl_vector * gradient_);
277 static void multimin_fdf (
const gsl_vector * v_ ,
void * params_ ,
278 double * f_ , gsl_vector * gradient_);
298 virtual void action (
int status_ ,
309 action (status_,iter_,x_,dim_,f_);
316 virtual void action (
int status_ ,
329 const gsl_multimin_fdfminimizer_type * _algo_fdf_;
330 const gsl_multimin_fminimizer_type * _algo_f_;
331 gsl_multimin_fdfminimizer * _fdfmin_;
332 gsl_multimin_fminimizer * _fmin_;
333 gsl_multimin_function _f_;
334 gsl_multimin_function_fdf _fdf_;
339 double _fdf_step_size_;
351 void _init_algorithm_ (
const std::string & name_);
353 void _set_mode_ (
int mode_);
371 void init (
const std::string & name_ ,
398 #endif // MYGSL_MULTIMIN_H Definition: multimin.h:132
void _at_step_hook(int status_, size_t iter_, double *x_, size_t dim_, double f_)
bool is_auto() const
Definition: multimin.h:71
static default_step_action _default_step_action_
Definition: multimin.h:323
Definition: multimin.h:145
static param_entry make_param_entry_auto(const std::string &name_)
Definition: multimin.h:30
virtual int eval_fdf(const double *x_, double &f_, double *gradient_)
virtual int _eval_df(double *gradient_)=0
double get_param_value(int i_) const
std::string get_name() const
void devel_dump_x() const
void print_params2(std::ostream &) const
void dump(std::ostream &out_) const
mode_type
Definition: multimin.h:282
static void multimin_fdf(const gsl_vector *v_, void *params_, double *f_, gsl_vector *gradient_)
bool operator()(const param_entry &pe_)
Definition: multimin.h:138
Definition: multimin.h:284
double get_dist_to_max() const
int minimize(double epsabs_)
bool is_param_auto(int i_) const
static void print_types(std::ostream &)
void set_param_value(int i_, double val_)
type_t
Definition: multimin.h:35
double get_dist_to_limit() const
virtual void from_double_star(const double *pars_, size_t dimension_)
void add_param(const param_entry &pe_)
static const bool DEFAULT_VERBOSE
Definition: multimin.h:270
void set_param_value_no_check(int i_, double val_)
double get_dist_to_min() const
bool is_param_fixed(int i_) const
bool has_max() const
Definition: multimin.h:79
Definition: multimin.h:291
static double multimin_f(const gsl_vector *v_, void *params_)
limit_t
Definition: multimin.h:28
virtual void action(int status_, size_t iter_, double *x_, size_t dim_, double f_)=0
virtual void action(int status_, size_t iter_, double *x_, size_t dim_, double f_)
Definition: multimin.h:33
std::vector< param_entry > _params
Definition: multimin.h:173
Definition: multimin.h:314
param_is_fixed()
Definition: multimin.h:147
static const size_t DEFAULT_MAX_ITER
Definition: multimin.h:269
bool has_no_limit() const
Definition: multimin.h:75
double min
Definition: multimin.h:48
void set_default_step_action()
bool has_limit() const
Definition: multimin.h:73
Definition: multimin.h:32
Definition: multimin.h:25
Definition: multimin.h:285
double get_param_max(int i_) const
bool has_min() const
Definition: multimin.h:77
bool is_param_free(int i_) const
stopping_t
Definition: multimin.h:288
void operator()(int status_, size_t iter_, double *x_, size_t dim_, double f_)
Definition: multimin.h:303
param_is_free()
Definition: multimin.h:134
std::string _name_
Definition: multimin.h:120
bool is_fixed() const
Definition: multimin.h:67
std::string name
Definition: multimin.h:44
void to_double_star(double *pars_, size_t dimension_) const
Definition: multimin.h:31
static bool name_is_valid(const std::string &name_)
void print_params(std::ostream &) const
void set_value(double value_)
size_t get_dimension() const
virtual int auto_values()
Definition: multimin.h:290
Top-level namespace of the Bayeux/mygsl module library.
Definition: base_decay_driver.h:47
bool operator()(const param_entry &pe_)
Definition: multimin.h:164
Definition: multimin.h:266
Definition: multimin.h:39
virtual int _prepare_values()
Definition: multimin.h:37
void init(const std::string &name_, multimin_system &ms_)
Definition: multimin.h:38
Definition: multimin.h:294
virtual int eval_df(const double *x_, double *gradient_)
bool is_lock_params() const
bool _lock_params
Definition: multimin.h:172
const param_entry & get_param(int i_) const
bool operator()(const param_entry &pe_)
Definition: multimin.h:151
const std::string & get_param_name(int i_) const
static param_entry make_param_entry_ranged(const std::string &name_, double value_, double min_, double max_, double step_, bool fixed_=false)
virtual int _eval_f(double &f_)=0
virtual int eval_f(const double *x_, double &f_)
Definition: multimin.h:21
virtual int prepare_values()
size_t get_n_iter() const
Definition: multimin.h:118
param_is_auto()
Definition: multimin.h:160
int limit
Definition: multimin.h:47
double get_param_min(int i_) const
int type
Definition: multimin.h:46
bool operator()(const param_entry &pe_)
Definition: multimin.h:125
virtual int _auto_values()
double max
Definition: multimin.h:49
Definition: multimin.h:158
void set_value_no_check(double value_)
double step
Definition: multimin.h:50
double get_param_step(int i_) const
virtual ~multimin_system()
bool is_free() const
Definition: multimin.h:69
static void multimin_df(const gsl_vector *v_, void *params_, gsl_vector *gradient_)
param_has_name(const std::string &name_)
Definition: multimin.h:121
size_t get_auto_dimension() const
void set_step_action(at_step_action &asd_)
static param_entry make_param_entry_fixed(const std::string &name_, double value_)
double value
Definition: multimin.h:45
size_t get_free_dimension() const