Logo ROOT   6.10/09
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 
36 #include "Math/IParamFunctionfwd.h"
37 
38 #include "Math/BasicMinimizer.h"
39 
40 
41 #include <vector>
42 #include <map>
43 #include <string>
44 
45 
46 
47 namespace ROOT {
48 
49 namespace Math {
50 
51 
52  /**
53  enumeration specifying the types of GSL minimizers
54  @ingroup MultiMin
55  */
62  };
63 
64 
65  class GSLMultiMinimizer;
66 
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 
88 public:
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 
105 private:
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 
121 public:
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 
161 protected:
162 
163 private:
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 */
Interface (abstract class) for multi-dimensional functions providing a gradient calculation.
Definition: IFunction.h:330
ROOT::Math::GSLMultiMinimizer * fGSLMultiMin
Definition: GSLMinimizer.h:166
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21
GSLMinimizer class.
Definition: GSLMinimizer.h:86
virtual bool ProvidesError() const
minimizer provides error and error matrix
Definition: GSLMinimizer.h:145
MinimTransformFunction class to perform a transformations on the variables to deal with fixed or limi...
EGSLMinimizerType
enumeration specifying the types of GSL minimizers
Definition: GSLMinimizer.h:56
virtual double Edm() const
return expected distance reached from the minimum
Definition: GSLMinimizer.h:134
Base Minimizer class, which defines the basic funcionality of various minimizer implementations (apar...
virtual bool Minimize()
method to perform the minimization
GSLMinimizer(const GSLMinimizer &)
Copy constructor.
Definition: GSLMinimizer.h:111
virtual void SetFunction(const ROOT::Math::IMultiGenFunction &func)
set the function to minimize
GSLMinimizer(ROOT::Math::EGSLMinimizerType type=ROOT::Math::kConjugateFR)
Default constructor.
Documentation for the abstract class IBaseFunctionMultiDim.
Definition: IFunction.h:62
virtual ~GSLMinimizer()
Destructor.
virtual void SetFunction(const ROOT::Math::IMultiGenFunction &func)
set the function to minimize
virtual unsigned int NCalls() const
number of function calls to reach the minimum
int type
Definition: TGX11.cxx:120
double func(double *x, double *p)
Definition: stressTF1.cxx:213
GSLMultiMinimizer class , for minimizing multi-dimensional function using derivatives.
GSLMinimizer & operator=(const GSLMinimizer &rhs)
Assignment operator.
Definition: GSLMinimizer.h:116
Namespace for new Math classes and functions.
virtual const double * Errors() const
return errors at the minimum
Definition: GSLMinimizer.h:148
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
virtual const double * MinGradient() const
return pointer to gradient values at the minimum
virtual void SetFunction(const ROOT::Math::IMultiGradFunction &func)
set the function to minimize
Definition: GSLMinimizer.h:127