Logo ROOT  
Reference Guide
GSLMinimizer.h
Go to the documentation of this file.
1// @(#)root/mathmore:$Id$
2// Author: L. Moneta Wed Oct 18 11:48:00 2006
3
4 /**********************************************************************
5 * *
6 * Copyright (c) 2006 LCG ROOT Math Team, CERN/PH-SFT *
7 * *
8 * This library is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU General Public License *
10 * as published by the Free Software Foundation; either version 2 *
11 * of the License, or (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16 * General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU General Public License *
19 * along with this library (see file COPYING); if not, write *
20 * to the Free Software Foundation, Inc., 59 Temple Place, Suite *
21 * 330, Boston, MA 02111-1307 USA, or contact the author. *
22 * *
23 **********************************************************************/
24
25
26// Header file for class GSLMinimizer
27
28#ifndef ROOT_Math_GSLMinimizer
29#define ROOT_Math_GSLMinimizer
30
31#include "Math/Minimizer.h"
32
33
34#include "Math/IFunctionfwd.h"
35
37
38#include "Math/BasicMinimizer.h"
39
40
41#include <vector>
42#include <map>
43#include <string>
44
45
46
47namespace ROOT {
48
49namespace Math {
50
51
52 /**
53 enumeration specifying the types of GSL minimizers
54 @ingroup MultiMin
55 */
62 };
63
64
65 class GSLMultiMinimizer;
66
67 class MinimTransformFunction;
68
69
70//_____________________________________________________________________________________
71/**
72 GSLMinimizer class.
73 Implementation of the ROOT::Math::Minimizer interface using the GSL multi-dimensional
74 minimization algorithms.
75
76 See <A HREF="http://www.gnu.org/software/gsl/manual/html_node/Multidimensional-Minimization.html">GSL doc</A>
77 from more info on the GSL minimization algorithms.
78
79 The class implements the ROOT::Math::Minimizer interface and can be instantiated using the
80 ROOT plugin manager (plugin name is "GSLMultiMin"). The varius minimization algorithms
81 (conjugatefr, conjugatepr, bfgs, etc..) can be passed as enumerations and also as a string.
82 The default algorithm is conjugatefr (Fletcher-Reeves conjugate gradient algorithm).
83
84 @ingroup MultiMin
85*/
87
88public:
89
90 /**
91 Default constructor
92 */
94
95 /**
96 Constructor with a string giving name of algorithm
97 */
98 GSLMinimizer (const char * type );
99
100 /**
101 Destructor
102 */
103 virtual ~GSLMinimizer ();
104
105private:
106 // usually copying is non trivial, so we make this unaccessible
107
108 /**
109 Copy constructor
110 */
112
113 /**
114 Assignment operator
115 */
117 if (this == &rhs) return *this; // time saving self-test
118 return *this;
119 }
120
121public:
122
123 /// set the function to minimize
124 virtual void SetFunction(const ROOT::Math::IMultiGenFunction & func);
125
126 /// set the function to minimize
128
129 /// method to perform the minimization
130 virtual bool Minimize();
131
132
133 /// return expected distance reached from the minimum
134 virtual double Edm() const { return 0; } // not impl. }
135
136
137 /// return pointer to gradient values at the minimum
138 virtual const double * MinGradient() const;
139
140 /// number of function calls to reach the minimum
141 virtual unsigned int NCalls() const;
142
143
144 /// minimizer provides error and error matrix
145 virtual bool ProvidesError() const { return false; }
146
147 /// return errors at the minimum
148 virtual const double * Errors() const {
149 return 0;
150 }
151
152 /** return covariance matrices elements
153 if the variable is fixed the matrix is zero
154 The ordering of the variables is the same as in errors
155 */
156 virtual double CovMatrix(unsigned int , unsigned int ) const { return 0; }
157
158
159
160
161protected:
162
163private:
164
165
167
168 double fLSTolerance; // Line Search Tolerance
169
170};
171
172 } // end namespace Fit
173
174} // end namespace ROOT
175
176
177
178#endif /* ROOT_Math_GSLMinimizer */
int type
Definition: TGX11.cxx:120
Base Minimizer class, which defines the basic funcionality of various minimizer implementations (apar...
virtual void SetFunction(const ROOT::Math::IMultiGenFunction &func)
set the function to minimize
GSLMinimizer class.
Definition: GSLMinimizer.h:86
virtual unsigned int NCalls() const
number of function calls to reach the minimum
virtual const double * MinGradient() const
return pointer to gradient values at the minimum
virtual double Edm() const
return expected distance reached from the minimum
Definition: GSLMinimizer.h:134
ROOT::Math::GSLMultiMinimizer * fGSLMultiMin
Definition: GSLMinimizer.h:166
virtual double CovMatrix(unsigned int, unsigned int) const
return covariance matrices elements if the variable is fixed the matrix is zero The ordering of the v...
Definition: GSLMinimizer.h:156
GSLMinimizer & operator=(const GSLMinimizer &rhs)
Assignment operator.
Definition: GSLMinimizer.h:116
GSLMinimizer(ROOT::Math::EGSLMinimizerType type=ROOT::Math::kConjugateFR)
Default constructor.
virtual bool Minimize()
method to perform the minimization
virtual ~GSLMinimizer()
Destructor.
virtual void SetFunction(const ROOT::Math::IMultiGradFunction &func)
set the function to minimize
Definition: GSLMinimizer.h:127
virtual bool ProvidesError() const
minimizer provides error and error matrix
Definition: GSLMinimizer.h:145
GSLMinimizer(const GSLMinimizer &)
Copy constructor.
Definition: GSLMinimizer.h:111
virtual void SetFunction(const ROOT::Math::IMultiGenFunction &func)
set the function to minimize
virtual const double * Errors() const
return errors at the minimum
Definition: GSLMinimizer.h:148
GSLMultiMinimizer class , for minimizing multi-dimensional function using derivatives.
Documentation for the abstract class IBaseFunctionMultiDim.
Definition: IFunction.h:62
Interface (abstract class) for multi-dimensional functions providing a gradient calculation.
Definition: IFunction.h:327
EGSLMinimizerType
enumeration specifying the types of GSL minimizers
Definition: GSLMinimizer.h:56
@ kSteepestDescent
Definition: GSLMinimizer.h:61
Namespace for new Math classes and functions.
VSD Structures.
Definition: StringConv.hxx:21