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);
119 unsigned int ndim = func.
NDim();
122 if (
fVec != 0) gsl_vector_free(
fVec);
123 fVec = gsl_vector_alloc( ndim );
124 std::copy(
x,
x+ndim,
fVec->data);
137 return std::string(gsl_multimin_fdfminimizer_name(
fMinimizer) );
142 return gsl_multimin_fdfminimizer_iterate(
fMinimizer);
148 gsl_vector *
x = gsl_multimin_fdfminimizer_x(
fMinimizer);
155 return gsl_multimin_fdfminimizer_minimum(
fMinimizer);
161 gsl_vector *
g = gsl_multimin_fdfminimizer_gradient(
fMinimizer);
168 return gsl_multimin_fdfminimizer_restart(
fMinimizer);
174 gsl_vector *
g = gsl_multimin_fdfminimizer_gradient(
fMinimizer);
175 return gsl_multimin_test_gradient(
g, absTol);
180 if (
fVec == 0 )
return -1;
181 unsigned int n =
fVec->size;
182 if (
n == 0 )
return -1;
184 return gsl_multimin_test_gradient(
fVec, absTol);
192 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.
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...
GSLMultiMinimizer & operator=(const GSLMultiMinimizer &rhs)=delete
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
GSLMultiMinimizer(const GSLMultiMinimizer &)=delete
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(GSLMultiMinimizer &&)=delete
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.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...