00001 #ifndef ROOT_Math_BrentMethods 00002 #define ROOT_Math_BrentMethods 00003 00004 #ifndef ROOT_Math_IFunctionfwd 00005 #include "Math/IFunctionfwd.h" 00006 #endif 00007 00008 00009 namespace ROOT { 00010 namespace Math { 00011 00012 namespace BrentMethods { 00013 00014 /** 00015 Grid search implementation, used to bracket the minimum and later 00016 use Brent's method with the bracketed interval 00017 The step of the search is set to (xmax-xmin)/fNpx 00018 type: 0-returns MinimumX 00019 1-returns Minimum 00020 2-returns MaximumX 00021 3-returns Maximum 00022 4-returns X corresponding to fy 00023 00024 */ 00025 00026 double MinimStep(const IGenFunction* f, int type, double &xmin, double &xmax, double fy, int npx = 100, bool useLog = false); 00027 00028 /** 00029 Finds a minimum of a function, if the function is unimodal between xmin and xmax 00030 This method uses a combination of golden section search and parabolic interpolation 00031 Details about convergence and properties of this algorithm can be 00032 found in the book by R.P.Brent "Algorithms for Minimization Without Derivatives" 00033 or in the "Numerical Recipes", chapter 10.2 00034 convergence is reached using tolerance = 2 *( epsrel * abs(x) + epsabs) 00035 00036 type: 0-returns MinimumX 00037 1-returns Minimum 00038 2-returns MaximumX 00039 3-returns Maximum 00040 4-returns X corresponding to fy 00041 00042 if ok=true the method has converged. 00043 Maxiter returns the actual number of iteration performed 00044 00045 */ 00046 00047 double MinimBrent(const IGenFunction* f, int type, double &xmin, double &xmax, double xmiddle, double fy, bool &ok, int &niter, double epsabs = 1.E-8, double epsrel = 1.E-10, int maxiter = 100 ); 00048 00049 00050 } // end namespace BrentMethods 00051 } // end namespace Math 00052 } // ned namespace ROOT 00053 00054 #endif