Class mmin_fix_params (o2scl)

O2scl : Class List

template<class func_t = multi_funct, class vec_t = boost::numeric::ublas::vector<double>>
class mmin_fix_params : public o2scl::mmin_base<multi_funct, multi_funct, boost::numeric::ublas::vector<double>>

Multidimensional minimizer fixing some parameters and varying others.

This class allows one to min a function after having fixed some of the parameters. The parameters which should be fixed are specified through a bool vector. This class performs the extra bookkeeping associated with reordering the parameters and performs the minimization with a separate minimizer object. This class is most useful for minimization problems which do not use information about the gradient.

The number of trials used in the minimizer can be specified in the data member of the parent class mmin_base::ntrial associated with the o2scl::mmin_fix_params object. Similarly for the verbosity parameter in mmin_base::verbose, the absolute tolerance in mmin_base::tol_abs, and the relative tolerance in mmin_base::tol_abs. These values are copied to the minimizer used by mmin_fix_params::mmin() during each call. After the minimizer is called, the value of mmin_base::ntrial associated with the mmin_fix_params object is filled with the last number of trials required for the last minimization.

See an example for the usage of this class in Minimizer fixing variables example.

Public Types

typedef boost::numeric::ublas::vector<double> ubvector
typedef mmin_base<mmin_fix_params<func_t, vec_t>, mmin_fix_params<func_t, vec_t>, vec_t> base_mmin_t

The generic minimizer type.

typedef mmin_simp2<mmin_fix_params<func_t, vec_t>, vec_t> def_mmin_t

The default minimizer type.

Public Functions

inline mmin_fix_params()

Specify the member function pointer.

inline virtual ~mmin_fix_params()
inline virtual int mmin(size_t nvar, vec_t &x, double &fmin, func_t &func)

Calculate the minimum min of func w.r.t. the array x of size nvar.

template<class bool_vec_t>
inline void set_fix(size_t n, bool_vec_t &fix)
template<class bool_vec_t>
inline int mmin_fix(size_t nvar, ubvector &x, double &fmin, bool_vec_t &fix, multi_funct &func)

Calculate the minimum of func while fixing some parameters as specified in fix.

If all of entries fix[0], fix[1], ... fix[nvar-1] are true, then this function assumes all of the parameters are fixed and that there is no minimization to be performed. In this case, it will return 0 for success without calling the error handler.

inline int set_mmin(base_mmin_t &min)

Change the base minimizer.

inline virtual double operator()(size_t nv, const vec_t &x)

The new function to send to the minimizer.

Public Members

def_mmin_t def_mmin

The default base minimizer.

Protected Attributes

base_mmin_t *mmp

The minimizer.

func_t *funcp

The user-specified function.

size_t unv

The user-specified number of variables.

size_t nv_new

The new number of variables.

std::vector<bool> fixp

Specify which parameters to fix.

vec_t *xp

The user-specified initial vector.

Private Functions

mmin_fix_params(const mmin_fix_params&)
mmin_fix_params &operator=(const mmin_fix_params&)