Class mmin_gsl_base (o2scl)¶
-
template<class
func_t
= multi_funct, classvec_t
= boost::numeric::ublas::vector<double>, classdfunc_t
= grad_funct, classauto_grad_t
= gradient<multi_funct, boost::numeric::ublas::vector<double>>, classdef_auto_grad_t
= gradient_gsl<multi_funct, boost::numeric::ublas::vector<double>>>
classo2scl
::
mmin_gsl_base
: public o2scl::mmin_base<multi_funct, grad_funct, boost::numeric::ublas::vector<double>>¶ Base minimization routines for mmin_conf and mmin_conp.
This class is used by the mmin_conf and mmin_conp minimizers to perform the line minimization along a specified direction. It is not intended for a casual end-user.
Default template arguments
func_t
- multi_functvec_t
- boost::numeric::ublas::vector <double >dfunc_t
- mm_functauto_grad_t
- gradient < func_t >def_auto_grad_t
- gradient_gsl <func_t >
Public Functions
-
mmin_gsl_base
()¶
-
int
base_set
(func_t &ufunc, auto_grad_t &u_def_grad)¶ Set the function.
-
int
base_allocate
(size_t nn)¶ Allocate memory.
-
int
base_free
()¶ Clear allocated memory.
Public Members
-
double
deriv_h
¶ Stepsize for finite-differencing ( default \( 10^{-4} \) )
-
int
nmaxiter
¶ Maximum iterations for line minimization (default 10)
-
def_auto_grad_t
def_grad
¶ Default automatic object.
Protected Types
-
typedef boost::numeric::ublas::vector<double>
ubvector
¶
-
typedef boost::numeric::ublas::matrix<double>
ubmatrix
¶
Protected Functions
-
void
take_step
(const vec_t &x, const vec_t &px, double stepx, double lambda, vec_t &x1x, vec_t &dx)¶ Take a step.
-
void
intermediate_point
(const vec_t &x, const vec_t &px, double lambda, double pg, double stepa, double stepc, double fa, double fc, vec_t &x1x, vec_t &dx, vec_t &gradient, double *stepx, double *f)¶ Line minimization.
Do a line minimisation in the region (xa,fa) (xc,fc) to find an intermediate (xb,fb) satisifying fa > fb < fc. Choose an initial xb based on parabolic interpolation.
-
void
min
(const vec_t &x, const vec_t &xp, double lambda, double stepa, double stepb, double stepc, double fa, double fb, double fc, double xtol, vec_t &x1x, vec_t &dx1x, vec_t &x2x, vec_t &dx2x, vec_t &gradient, double *xstep, double *f, double *gnorm_u)¶ Perform the minimization.
Starting at (x0, f0) move along the direction p to find a minimum f(x0 - lambda * p), returning the new point x1 = x0-lambda*p, f1=f(x1) and g1 = grad(f) at x1.