Class mmin_fix_params (o2scl)¶
-
template<class
func_t
= multi_funct, classvec_t
= boost::numeric::ublas::vector<double>>
classo2scl
::
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
-
mmin_fix_params
()¶ Specify the member function pointer.
-
~mmin_fix_params
()¶
-
int
mmin
(size_t nvar, vec_t &x, double &fmin, func_t &func)¶ Calculate the minimum
min
offunc
w.r.t. the arrayx
of sizenvar
.
-
template<class
bool_vec_t
>
voidset_fix
(size_t n, bool_vec_t &fix)¶
-
template<class
bool_vec_t
>
intmmin_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 infix
.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.
-
int
set_mmin
(base_mmin_t &min)¶ Change the base minimizer.
Public Members
-
def_mmin_t
def_mmin
¶ The default base minimizer.
Protected Attributes
-
base_mmin_t *
mmp
¶ The minimizer.
-
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.
Private Functions
-
mmin_fix_params
(const mmin_fix_params&)¶
-
mmin_fix_params &
operator=
(const mmin_fix_params&)¶
-
typedef boost::numeric::ublas::vector<double>