ROOT  6.06/09
Reference Guide
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
ROOT::Math::BrentMinimizer1D Class Reference

User class for performing function minimization.

It will use the Brent Method for function minimization in a given interval. First, a grid search is used to bracket the minimum value with the a step size = (xmax-xmin)/npx. The step size can be controlled via the SetNpx() function. A default value of npx = 100 is used. The default value con be changed using the static method SetDefaultNpx. If the function is unimodal or if its extrema are far apart, setting the fNpx to a small value speeds the algorithm up many times. Then, Brent's method is applied on the bracketed interval. If the Brent method fails to converge the bracketing is repeted on the latest best estimate of the interval. The procedure is repeted with a maximum value (default =10) which can be set for all BrentRootFinder classes with the method SetDefaultNSearch

This class is implemented from TF1::GetMinimum.

To use the class, three steps have to be taken:

  1. Create the class.
  2. Set a function within an interval to look for the minimum.
  3. Call the Minimize function with the error parameters.

If another minimization is to be performed, repeat the last two steps.

Definition at line 77 of file BrentMinimizer1D.h.

Public Member Functions

 BrentMinimizer1D ()
 Default Constructor. More...
 
virtual ~BrentMinimizer1D ()
 Default Destructor. More...
 
virtual double XMinimum () const
 Return current estimate of the position of the minimum. More...
 
virtual double XLower () const
 Return current lower bound of the minimization interval. More...
 
virtual double XUpper () const
 Return current upper bound of the minimization interval. More...
 
virtual double FValMinimum () const
 Return function value at current estimate of the minimum. More...
 
virtual double FValLower () const
 Return function value at current lower bound of the minimization interval. More...
 
virtual double FValUpper () const
 Return function value at current upper bound of the minimization interval. More...
 
virtual bool Minimize (int maxIter, double absTol=1.E-8, double relTol=1.E-10)
 Find minimum position iterating until convergence specified by the absolute and relative tolerance or the maximum number of iteration is reached. More...
 
virtual int Iterations () const
 Return number of iteration used to find minimum. More...
 
virtual const char * Name () const
 Return name of minimization algorithm ("BrentMinimizer1D") More...
 
void SetFunction (const ROOT::Math::IGenFunction &f, double xlow, double xup)
 Sets function to be minimized. More...
 
void SetNpx (int npx)
 Set the number of point used to bracket root using a grid. More...
 
void SetLogScan (bool on)
 Set a log grid scan (default is equidistant bins) will work only if xlow > 0. More...
 
int Status () const
 Returns status of last estimate. More...
 

Static Public Member Functions

static void SetDefaultNpx (int npx)
 set number of default Npx used at construction time (when SetNpx is not called) Default value is 100 More...
 
static void SetDefaultNSearch (int n)
 set number of times the bracketing search in combination with is done to find a good interval Default value is 10 More...
 

Private Attributes

const IGenFunctionfFunction
 
bool fLogScan
 
int fNIter
 
int fNpx
 
int fStatus
 
double fXMin
 
double fXMax
 
double fXMinimum
 

Additional Inherited Members

- Private Member Functions inherited from ROOT::Math::IMinimizer1D
 IMinimizer1D ()
 
virtual ~IMinimizer1D ()
 

#include <Math/BrentMinimizer1D.h>

+ Inheritance diagram for ROOT::Math::BrentMinimizer1D:
+ Collaboration diagram for ROOT::Math::BrentMinimizer1D:

Constructor & Destructor Documentation

ROOT::Math::BrentMinimizer1D::BrentMinimizer1D ( )

Default Constructor.

Definition at line 45 of file BrentMinimizer1D.cxx.

virtual ROOT::Math::BrentMinimizer1D::~BrentMinimizer1D ( )
inlinevirtual

Default Destructor.

Definition at line 85 of file BrentMinimizer1D.h.

Member Function Documentation

double ROOT::Math::BrentMinimizer1D::FValLower ( ) const
virtual

Return function value at current lower bound of the minimization interval.

Implements ROOT::Math::IMinimizer1D.

Definition at line 82 of file BrentMinimizer1D.cxx.

double ROOT::Math::BrentMinimizer1D::FValMinimum ( ) const
virtual

Return function value at current estimate of the minimum.

Implements ROOT::Math::IMinimizer1D.

Definition at line 79 of file BrentMinimizer1D.cxx.

Referenced by TEfficiency::BetaShortestInterval(), TF1::GetMaximum(), TF1::GetMinimum(), and RooStats::BayesianCalculator::GetPosteriorFunction().

double ROOT::Math::BrentMinimizer1D::FValUpper ( ) const
virtual

Return function value at current upper bound of the minimization interval.

Implements ROOT::Math::IMinimizer1D.

Definition at line 85 of file BrentMinimizer1D.cxx.

virtual int ROOT::Math::BrentMinimizer1D::Iterations ( ) const
inlinevirtual

Return number of iteration used to find minimum.

Implements ROOT::Math::IMinimizer1D.

Definition at line 117 of file BrentMinimizer1D.h.

bool ROOT::Math::BrentMinimizer1D::Minimize ( int  maxIter,
double  absTol = 1.E-8,
double  relTol = 1.E-10 
)
virtual

Find minimum position iterating until convergence specified by the absolute and relative tolerance or the maximum number of iteration is reached.

Return true if iterations converged successfully @param maxIter maximum number of iterations. @param absTol desired absolute error in the minimum position (default 1.E-8) @param absTol desired relative error in the minimum position (default = 1.E-10)

Implements ROOT::Math::IMinimizer1D.

Definition at line 88 of file BrentMinimizer1D.cxx.

Referenced by TEfficiency::BetaShortestInterval(), TF1::GetMaximum(), TF1::GetMaximumX(), TF1::GetMinimum(), TF1::GetMinimumX(), and RooStats::BayesianCalculator::GetPosteriorFunction().

const char * ROOT::Math::BrentMinimizer1D::Name ( ) const
virtual

Return name of minimization algorithm ("BrentMinimizer1D")

Implements ROOT::Math::IMinimizer1D.

Definition at line 136 of file BrentMinimizer1D.cxx.

void ROOT::Math::BrentMinimizer1D::SetDefaultNpx ( int  npx)
static

set number of default Npx used at construction time (when SetNpx is not called) Default value is 100

Definition at line 55 of file BrentMinimizer1D.cxx.

void ROOT::Math::BrentMinimizer1D::SetDefaultNSearch ( int  n)
static

set number of times the bracketing search in combination with is done to find a good interval Default value is 10

Definition at line 57 of file BrentMinimizer1D.cxx.

void ROOT::Math::BrentMinimizer1D::SetFunction ( const ROOT::Math::IGenFunction f,
double  xlow,
double  xup 
)

Sets function to be minimized.

@param f Function to be minimized. @param xlow Lower bound of the search interval. @param xup Upper bound of the search interval.

Definition at line 60 of file BrentMinimizer1D.cxx.

Referenced by TEfficiency::BetaShortestInterval(), TF1::GetMaximum(), TF1::GetMaximumX(), TF1::GetMinimum(), TF1::GetMinimumX(), and RooStats::BayesianCalculator::GetPosteriorFunction().

void ROOT::Math::BrentMinimizer1D::SetLogScan ( bool  on)
inline

Set a log grid scan (default is equidistant bins) will work only if xlow > 0.

Definition at line 137 of file BrentMinimizer1D.h.

Referenced by TF1::GetMaximum(), TF1::GetMaximumX(), TF1::GetMinimum(), and TF1::GetMinimumX().

void ROOT::Math::BrentMinimizer1D::SetNpx ( int  npx)
inline

Set the number of point used to bracket root using a grid.

Definition at line 131 of file BrentMinimizer1D.h.

Referenced by TEfficiency::BetaShortestInterval(), TF1::GetMaximum(), TF1::GetMaximumX(), TF1::GetMinimum(), and TF1::GetMinimumX().

int ROOT::Math::BrentMinimizer1D::Status ( ) const
inlinevirtual

Returns status of last estimate.

If = 0 is OK

Implements ROOT::Math::IMinimizer1D.

Definition at line 141 of file BrentMinimizer1D.h.

virtual double ROOT::Math::BrentMinimizer1D::XLower ( ) const
inlinevirtual

Return current lower bound of the minimization interval.

Implements ROOT::Math::IMinimizer1D.

Definition at line 93 of file BrentMinimizer1D.h.

virtual double ROOT::Math::BrentMinimizer1D::XMinimum ( ) const
inlinevirtual

Return current estimate of the position of the minimum.

Implements ROOT::Math::IMinimizer1D.

Definition at line 90 of file BrentMinimizer1D.h.

Referenced by TEfficiency::BetaShortestInterval(), TF1::GetMaximumX(), and TF1::GetMinimumX().

virtual double ROOT::Math::BrentMinimizer1D::XUpper ( ) const
inlinevirtual

Return current upper bound of the minimization interval.

Implements ROOT::Math::IMinimizer1D.

Definition at line 96 of file BrentMinimizer1D.h.

Member Data Documentation

const IGenFunction* ROOT::Math::BrentMinimizer1D::fFunction
private

Definition at line 157 of file BrentMinimizer1D.h.

Referenced by FValLower(), FValMinimum(), FValUpper(), Minimize(), and SetFunction().

bool ROOT::Math::BrentMinimizer1D::fLogScan
private

Definition at line 158 of file BrentMinimizer1D.h.

Referenced by Minimize(), and SetLogScan().

int ROOT::Math::BrentMinimizer1D::fNIter
private

Definition at line 159 of file BrentMinimizer1D.h.

Referenced by Iterations(), and Minimize().

int ROOT::Math::BrentMinimizer1D::fNpx
private

Definition at line 160 of file BrentMinimizer1D.h.

Referenced by BrentMinimizer1D(), Minimize(), and SetNpx().

int ROOT::Math::BrentMinimizer1D::fStatus
private

Definition at line 161 of file BrentMinimizer1D.h.

Referenced by Minimize(), SetFunction(), and Status().

double ROOT::Math::BrentMinimizer1D::fXMax
private

Definition at line 163 of file BrentMinimizer1D.h.

Referenced by FValUpper(), Minimize(), SetFunction(), and XUpper().

double ROOT::Math::BrentMinimizer1D::fXMin
private

Definition at line 162 of file BrentMinimizer1D.h.

Referenced by FValLower(), Minimize(), SetFunction(), and XLower().

double ROOT::Math::BrentMinimizer1D::fXMinimum
private

Definition at line 164 of file BrentMinimizer1D.h.

Referenced by FValMinimum(), Minimize(), and XMinimum().


The documentation for this class was generated from the following files: