KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | List of all members
kjb::Gsl_Multimin_f Class Reference

Wrapper for GSL's multidimensional minimizer, without using gradient. More...

#include <gsl_multimin.h>

Inheritance diagram for kjb::Gsl_Multimin_f:
kjb::Generic_multimin< T >

Public Member Functions

 Gsl_Multimin_f (const gsl_multimin_fminimizer_type *type, gsl_multimin_function *f, const gsl_vector *x0, const gsl_vector *step_size, bool verbosity=true)
 ctor builds the minimizer by allocating and setting up params More...
 
 Gsl_Multimin_f (size_t size, const gsl_multimin_fminimizer_type *type=gsl_multimin_fminimizer_nmsimplex2)
 
void initialize (gsl_multimin_function *f, const gsl_vector *x0, const gsl_vector *step_size)
 
size_t dim () const
 
int iterate ()
 Perform one iteration of the minimizer. More...
 
gsl_vectorargmin () const
 query the current best argmin of the minimizer More...
 
virtual double min () const
 query the current best min value of the function to be minimized More...
 
const char * name () const
 access a string describing the algorithm More...
 
int test_size (double epsabs) const
 check the magnitude the minimizer specific characteristic size against the tolerance epsabs. More...
 
void swap (Gsl_Multimin_f &that)
 Swap the contents of this minimizer and another (fast). More...
 
bool verbosity (bool v)
 Alter the verbosity attribute of the object. More...
 

Detailed Description

Wrapper for GSL's multidimensional minimizer, without using gradient.

GSL is the GNU Scientific Library.

This object is not copyable or assignable, but it does have a swap() method.

Constructor & Destructor Documentation

kjb::Gsl_Multimin_f::Gsl_Multimin_f ( const gsl_multimin_fminimizer_type type,
gsl_multimin_function f,
const gsl_vector x0,
const gsl_vector step_size,
bool  verbosity = true 
)
inline

ctor builds the minimizer by allocating and setting up params

Parameters
typeindicates the minimization algorithm you would like to use; supported choices are listed at the link below: http://www.gnu.org/software/gsl/manual/html_node/Multimin-Algorithms-with-Derivatives.html
x0Initial vector location in domain from which search begins.
step_sizeplease see the GSL documentation, or use clarivoyance, to determine what this should be set to; apparently it controls the size of (only) the first step.
tolplease see the GSL documentation for this one too.
verbosityIf true, then a bad iterate() call will emit a message to stderr.
Exceptions
KJB_errorif the input is bad: e.g., x0 equal to NULL or cannot allocate memory.
kjb::Gsl_Multimin_f::Gsl_Multimin_f ( size_t  size,
const gsl_multimin_fminimizer_type type = gsl_multimin_fminimizer_nmsimplex2 
)
inline

Member Function Documentation

gsl_vector* kjb::Gsl_Multimin_f::argmin ( ) const
inline

query the current best argmin of the minimizer

size_t kjb::Gsl_Multimin_f::dim ( ) const
inline
void kjb::Gsl_Multimin_f::initialize ( gsl_multimin_function f,
const gsl_vector x0,
const gsl_vector step_size 
)
inline
int kjb::Gsl_Multimin_f::iterate ( )
inline

Perform one iteration of the minimizer.

Returns
GSL_SUCCESS if successful, or a GSL error code otherwise: http://www.gnu.org/software/gsl/manual/html_node/Error-Codes.html

If you want to throw an exception in the case of a failed iteration, consider using the GSL_ETX macro.

virtual double kjb::Gsl_Multimin_f::min ( ) const
inlinevirtual

query the current best min value of the function to be minimized

Reimplemented in kjb::Generic_multimin< T >.

const char* kjb::Gsl_Multimin_f::name ( ) const
inline

access a string describing the algorithm

void kjb::Gsl_Multimin_f::swap ( Gsl_Multimin_f that)
inline

Swap the contents of this minimizer and another (fast).

This method is useful if, for example, you want to restart the minimizer at a new location; just instantiate a new minimizer object at the new location and swap() it with the old minimizer object.

int kjb::Gsl_Multimin_f::test_size ( double  epsabs) const
inline

check the magnitude the minimizer specific characteristic size against the tolerance epsabs.

Returns
GSL_SUCCESS if the size is smaller than tolerance epsabs, or GSL_CONTINUE otherwise.
bool kjb::Gsl_Multimin_f::verbosity ( bool  v)
inline

Alter the verbosity attribute of the object.

Returns
the previous value of the verbosity attribute. Currently if the object has true-verbosity then you will get an error message if iterate() fails.

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