Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:10:14

0001 #ifndef ROOT_Math_BrentMethods
0002 #define ROOT_Math_BrentMethods
0003 
0004 #include "Math/IFunctionfwd.h"
0005 
0006 
0007 namespace ROOT {
0008 namespace Math {
0009 
0010 namespace BrentMethods {
0011 
0012 /**
0013      Grid search implementation, used to bracket the minimum and later
0014      use Brent's method with the bracketed interval
0015      The step of the search is set to (xmax-xmin)/fNpx
0016      type: 0-returns MinimumX
0017            1-returns Minimum
0018            2-returns MaximumX
0019            3-returns Maximum
0020            4-returns X corresponding to fy
0021 
0022 */
0023 
0024    double MinimStep(const IGenFunction* f, int type, double &xmin, double &xmax, double fy, int npx = 100, bool useLog = false);
0025 
0026    /**
0027       Finds a minimum of a function, if the function is unimodal  between xmin and xmax
0028       This method uses a combination of golden section search and parabolic interpolation
0029       Details about convergence and properties of this algorithm can be
0030       found in the book by R.P.Brent "Algorithms for Minimization Without Derivatives"
0031       or in the "Numerical Recipes", chapter 10.2
0032       convergence is reached using  tolerance = 2 *( epsrel * abs(x) + epsabs)
0033 
0034       type: 0-returns MinimumX
0035             1-returns Minimum
0036             2-returns MaximumX
0037             3-returns Maximum
0038             4-returns X corresponding to fy
0039 
0040       if ok=true the method has converged.
0041       Maxiter returns the actual  number of iteration performed
0042 
0043    */
0044 
0045    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  );
0046 
0047 
0048 } // end namespace BrentMethods
0049 } // end namespace Math
0050 } // end namespace ROOT
0051 
0052 #endif