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