27#ifndef ROOT_Math_GSLMultiMinimizer
28#define ROOT_Math_GSLMultiMinimizer
30#include "gsl/gsl_vector.h"
31#include "gsl/gsl_multimin.h"
32#include "gsl/gsl_version.h"
69 fType = gsl_multimin_fdfminimizer_conjugate_fr;
72 fType = gsl_multimin_fdfminimizer_conjugate_pr;
75 fType = gsl_multimin_fdfminimizer_vector_bfgs;
78#if (GSL_MAJOR_VERSION > 1) || ((GSL_MAJOR_VERSION == 1) && (GSL_MINOR_VERSION >= 9))
80 fType = gsl_multimin_fdfminimizer_vector_bfgs2;
82 MATH_INFO_MSG(
"GSLMultiMinimizer",
"minimizer BFSG2 does not exist with this GSL version , use BFGS");
83 fType = gsl_multimin_fdfminimizer_vector_bfgs;
87 fType = gsl_multimin_fdfminimizer_steepest_descent;
90 fType = gsl_multimin_fdfminimizer_conjugate_fr;
102 if (
fVec != 0) gsl_vector_free(
fVec);
117 if (
this == &rhs)
return *
this;
131 unsigned int ndim = func.
NDim();
134 if (
fVec != 0) gsl_vector_free(
fVec);
135 fVec = gsl_vector_alloc( ndim );
136 std::copy(
x,
x+ndim,
fVec->data);
149 return std::string(gsl_multimin_fdfminimizer_name(
fMinimizer) );
154 return gsl_multimin_fdfminimizer_iterate(
fMinimizer);
160 gsl_vector *
x = gsl_multimin_fdfminimizer_x(
fMinimizer);
167 return gsl_multimin_fdfminimizer_minimum(
fMinimizer);
173 gsl_vector *
g = gsl_multimin_fdfminimizer_gradient(
fMinimizer);
180 return gsl_multimin_fdfminimizer_restart(
fMinimizer);
186 gsl_vector *
g = gsl_multimin_fdfminimizer_gradient(
fMinimizer);
187 return gsl_multimin_test_gradient(
g, absTol);
192 if (
fVec == 0 )
return -1;
193 unsigned int n =
fVec->size;
194 if (
n == 0 )
return -1;
196 return gsl_multimin_test_gradient(
fVec, absTol);
204 const gsl_multimin_fdfminimizer_type *
fType;
#define MATH_INFO_MSG(loc, str)
Pre-processor macro to report messages which can be configured to use ROOT error or simply an std::io...
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Wrapper for a multi-dimensional function with derivatives used in GSL multidim minimization algorithm...
gsl_multimin_function_fdf * GetFunc()
void SetFunction(const FuncType &f)
Fill gsl function structure from a C++ Function class.
GSLMultiMinimizer class , for minimizing multi-dimensional function using derivatives.
GSLMultiMinimizer & operator=(const GSLMultiMinimizer &rhs)
Assignment operator.
GSLMultiMinDerivFunctionWrapper fFunc
int Set(const ROOT::Math::IMultiGradFunction &func, const double *x, double stepSize, double tol)
set the function to be minimize the initial minimizer parameters, step size and tolerance in the line...
const gsl_multimin_fdfminimizer_type * fType
gsl_multimin_fdfminimizer * fMinimizer
double Minimum() const
function value at the minimum
double * Gradient() const
gradient value at the minimum
int Restart()
restart minimization from current point
int TestGradient(const double *g, double absTol) const
test gradient (require a vector gradient)
GSLMultiMinimizer(ROOT::Math::EGSLMinimizerType type)
Default constructor.
GSLMultiMinimizer(const GSLMultiMinimizer &)
Copy constructor.
double * X() const
x values at the minimum
~GSLMultiMinimizer()
Destructor.
void CreateMinimizer(unsigned int n)
create the minimizer from the type and size
int TestGradient(double absTol) const
test gradient (ask from minimizer gradient vector)
Interface (abstract class) for multi-dimensional functions providing a gradient calculation.
virtual unsigned int NDim() const=0
Retrieve the dimension of the function.
EGSLMinimizerType
enumeration specifying the types of GSL minimizers
Namespace for new Math classes and functions.
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.