gsl_mmin_wrapper Class Template Reference

Wrapper class for the gsl_mmin_bfgs2 minimizer. More...

#include <gsl_mmin_bfgs2.h>

Inheritance diagram for gsl_mmin_wrapper:

gsl_mmin_wrap_base

Detailed Description

template<class param_t, class func_t, class vec_t = ovector_base, class alloc_vec_t = ovector, class alloc_t = ovector_alloc, class dfunc_t = grad_funct<param_t,ovector_base>, class auto_grad_t = gradient<param_t,func_t,ovector_base>>
class gsl_mmin_wrapper< param_t, func_t, vec_t, alloc_vec_t, alloc_t, dfunc_t, auto_grad_t >

This is a reimplmentation of the internal GSL wrapper for function calls in the BFGS minimizer.

Idea for future:
There's a bit of extra vector copying here which could potentially be avoided.

Definition at line 68 of file gsl_mmin_bfgs2.h.


Public Member Functions

void prepare_wrapper (func_t &ufunc, dfunc_t *udfunc, param_t &upa, gsl_vector *t_x, double f, gsl_vector *t_g, gsl_vector *t_p, auto_grad_t *ag)
 Initialize wrapper.
void update_position (double alpha, vec_t &t_x, double *t_f, vec_t &t_g)
 Update position.
void change_direction ()
 Convert cache values to the new minimizer direction.

Data Fields

alloc_vec_t av_x_alpha
 Temporary storage.
alloc_vec_t av_g_alpha
 Temporary storage.
size_t dim
 Number of minimization dimensions.

Protected Member Functions

void moveto (double alpha)
 Move to a new point, using the cached value if possible.
double slope ()
 Compute the slope.
virtual double wrap_f (double alpha, int params)
 Evaluate the function.
virtual double wrap_df (double alpha, int params)
 Evaluate the derivative.
virtual void wrap_fdf (double alpha, int params, double *f, double *df)
 Evaluate the function and the derivative.

Protected Attributes

func_t * func
 Function.
dfunc_t * dfunc
 Derivative.
auto_grad_t * agrad
 The automatic gradient object.
param_t * pa
 Parameters.
bool grad_given
 True if the gradient was given by the user.
fixed values
gsl_vector * x
gsl_vector * g
gsl_vector * p
cached values, for x(alpha) = x + alpha * p
double f_alpha
double df_alpha
cache keys
double f_cache_key
double df_cache_key
double x_cache_key
double g_cache_key

Member Function Documentation

void change_direction (  )  [inline]

Convert the cache values from the end of the current minimisation to those needed for the start of the next minimisation, alpha=0

Definition at line 289 of file gsl_mmin_bfgs2.h.


The documentation for this class was generated from the following file:

Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.

Project hosting provided by SourceForge.net Logo, O2scl Sourceforge Project Page