Class mmin_base (o2scl)¶
-
template<class
func_t
= multi_funct, classdfunc_t
= func_t, classvec_t
= boost::numeric::ublas::vector<double>>
classo2scl
::
mmin_base
¶ Multidimensional minimization [abstract base].
The template parameters: The template parameter
func_t
specifies the function to min and should be a class containing a definitionwherefunc_t::operator()(size_t nv, const vec_t &x, double &f);
f
is the value of the function atx
, wherex
is a array-like class definingoperator
[] of sizenv
. The parameterdfunc_t
(if used) should provide the gradient withwherefunc_t::operator()(size_t nv, vec_t &x, vec_t &g);
g
is the gradient of the function atx
.Verbose I/O is sent through
std::cout
andstd::cin
by default, but this can be modified using set_verbose_stream(). Note that this function stores pointers to the user-specified output streams, and these pointers are not copied in child copy constructors.Public Functions
-
mmin_base
()¶
-
~mmin_base
()¶
-
int
set_verbose_stream
(std::ostream &out, std::istream &in)¶ Set streams for verbose I/O.
Note that this function stores pointers to the user-specified output streams, and these pointers are not copied in child copy constructors.
-
int
mmin
(size_t nvar, vec_t &x, double &fmin, func_t &func) = 0¶ Calculate the minimum
min
offunc
w.r.t. the arrayx
of sizenvar
.
-
int
mmin_de
(size_t nvar, vec_t &x, double &fmin, func_t &func, dfunc_t &dfunc)¶ Calculate the minimum
min
offunc
w.r.t. the arrayx
of sizenvar
with gradientdfunc
.
-
template<class
vec2_t
>
intprint_iter
(size_t nv, vec2_t &x, double y, int iter, double value, double limit, std::string comment)¶ Print out iteration information.
Depending on the value of the variable verbose, this prints out the iteration information. If verbose=0, then no information is printed, while if verbose>1, then after each iteration, the present values of x and y are output to std::cout along with the iteration number. If verbose>=2 then each iteration waits for a character.
-
const char *
type
()¶ Return string denoting type (“mmin_base”)
Public Members
-
int
verbose
¶ Output control.
-
int
ntrial
¶ Maximum number of iterations.
-
double
tol_rel
¶ Function value tolerance.
-
double
tol_abs
¶ The independent variable tolerance.
-
int
last_ntrial
¶ The number of iterations for in the most recent minimization.
-
bool
err_nonconv
¶ If true, call the error handler if the routine does not “converge”.
-