Logo ROOT   6.08/07
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 #ifndef ROOT_Math_Minimizer
32 #include "Math/Minimizer.h"
33 #endif
34 
35 
36 #ifndef ROOT_Math_IFunctionfwd
37 #include "Math/IFunctionfwd.h"
38 #endif
39 
40 #ifndef ROOT_Math_IParamFunctionfwd
41 #include "Math/IParamFunctionfwd.h"
42 #endif
43 
44 #ifndef ROOT_Math_BasicMinimizer
45 #include "Math/BasicMinimizer.h"
46 #endif
47 
48 
49 #include <vector>
50 #include <map>
51 #include <string>
52 
53 
54 
55 namespace ROOT {
56 
57 namespace Math {
58 
59 
60  /**
61  enumeration specifying the types of GSL minimizers
62  @ingroup MultiMin
63  */
70  };
71 
72 
73  class GSLMultiMinimizer;
74 
76 
77 
78 //_____________________________________________________________________________________
79 /**
80  GSLMinimizer class.
81  Implementation of the ROOT::Math::Minimizer interface using the GSL multi-dimensional
82  minimization algorithms.
83 
84  See <A HREF="http://www.gnu.org/software/gsl/manual/html_node/Multidimensional-Minimization.html">GSL doc</A>
85  from more info on the GSL minimization algorithms.
86 
87  The class implements the ROOT::Math::Minimizer interface and can be instantiated using the
88  ROOT plugin manager (plugin name is "GSLMultiMin"). The varius minimization algorithms
89  (conjugatefr, conjugatepr, bfgs, etc..) can be passed as enumerations and also as a string.
90  The default algorithm is conjugatefr (Fletcher-Reeves conjugate gradient algorithm).
91 
92  @ingroup MultiMin
93 */
95 
96 public:
97 
98  /**
99  Default constructor
100  */
102 
103  /**
104  Constructor with a string giving name of algorithm
105  */
106  GSLMinimizer (const char * type );
107 
108  /**
109  Destructor
110  */
111  virtual ~GSLMinimizer ();
112 
113 private:
114  // usually copying is non trivial, so we make this unaccessible
115 
116  /**
117  Copy constructor
118  */
120 
121  /**
122  Assignment operator
123  */
125  if (this == &rhs) return *this; // time saving self-test
126  return *this;
127  }
128 
129 public:
130 
131  /// set the function to minimize
132  virtual void SetFunction(const ROOT::Math::IMultiGenFunction & func);
133 
134  /// set the function to minimize
136 
137  /// method to perform the minimization
138  virtual bool Minimize();
139 
140 
141  /// return expected distance reached from the minimum
142  virtual double Edm() const { return 0; } // not impl. }
143 
144 
145  /// return pointer to gradient values at the minimum
146  virtual const double * MinGradient() const;
147 
148  /// number of function calls to reach the minimum
149  virtual unsigned int NCalls() const;
150 
151 
152  /// minimizer provides error and error matrix
153  virtual bool ProvidesError() const { return false; }
154 
155  /// return errors at the minimum
156  virtual const double * Errors() const {
157  return 0;
158  }
159 
160  /** return covariance matrices elements
161  if the variable is fixed the matrix is zero
162  The ordering of the variables is the same as in errors
163  */
164  virtual double CovMatrix(unsigned int , unsigned int ) const { return 0; }
165 
166 
167 
168 
169 protected:
170 
171 private:
172 
173 
175 
176  double fLSTolerance; // Line Search Tolerance
177 
178 };
179 
180  } // end namespace Fit
181 
182 } // end namespace ROOT
183 
184 
185 
186 #endif /* ROOT_Math_GSLMinimizer */
Interface (abstract class) for multi-dimensional functions providing a gradient calculation.
Definition: IFunction.h:322
ROOT::Math::GSLMultiMinimizer * fGSLMultiMin
Definition: GSLMinimizer.h:174
This namespace contains pre-defined functions to be used in conjuction with TExecutor::Map and TExecu...
Definition: StringConv.hxx:21
GSLMinimizer class.
Definition: GSLMinimizer.h:94
virtual bool ProvidesError() const
minimizer provides error and error matrix
Definition: GSLMinimizer.h:153
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:64
virtual double Edm() const
return expected distance reached from the minimum
Definition: GSLMinimizer.h:142
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:119
virtual void SetFunction(const ROOT::Math::IMultiGenFunction &func)
set the function to minimize
GSLMinimizer(ROOT::Math::EGSLMinimizerType type=ROOT::Math::kConjugateFR)
Default constructor.
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:124
Namespace for new Math classes and functions.
virtual const double * Errors() const
return errors at the minimum
Definition: GSLMinimizer.h:156
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:164
Documentation for the abstract class IBaseFunctionMultiDim.
Definition: IFunction.h:63
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:135