ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
ROOT::Math::RootFinder Class Reference

User Class to find the Root of one dimensional functions.

The GSL Methods are implemented in MathMore and they are loaded automatically via the plug-in manager

The possible types of Root-finding algorithms are:

This class does not cupport copying

Definition at line 88 of file RootFinder.h.

Public Types

enum  EType {
  kBRENT, kGSL_BISECTION, kGSL_FALSE_POS, kGSL_BRENT,
  kGSL_NEWTON, kGSL_SECANT, kGSL_STEFFENSON
}
 

Public Member Functions

 RootFinder (RootFinder::EType type=RootFinder::kBRENT)
 Construct a Root-Finder algorithm. More...
 
virtual ~RootFinder ()
 
bool SetMethod (RootFinder::EType type=RootFinder::kBRENT)
 
bool SetFunction (const IGenFunction &f, double xlow, double xup)
 Provide to the solver the function and the initial search interval [xlow, xup] for algorithms not using derivatives (bracketing algorithms) The templated function f must be of a type implementing the operator() method, double operator() ( double x ) Returns non zero if interval is not valid (i.e. More...
 
bool SetFunction (const IGradFunction &f, double xstart)
 Provide to the solver the function and an initial estimate of the root, for algorithms using derivatives. More...
 
template<class Function , class Derivative >
bool Solve (Function &f, Derivative &d, double start, int maxIter=100, double absTol=1E-8, double relTol=1E-10)
 
template<class Function >
bool Solve (Function &f, double min, double max, int maxIter=100, double absTol=1E-8, double relTol=1E-10)
 
bool Solve (int maxIter=100, double absTol=1E-8, double relTol=1E-10)
 Compute the roots iterating until the estimate of the Root is within the required tolerance returning the iteration Status. More...
 
int Iterations () const
 Return the number of iteration performed to find the Root. More...
 
int Iterate ()
 Perform a single iteration and return the Status. More...
 
double Root () const
 Return the current and latest estimate of the Root. More...
 
int Status () const
 Return the status of the last estimate of the Root = 0 OK, not zero failure. More...
 
const char * Name () const
 Return the current and latest estimate of the lower value of the Root-finding interval (for bracketing algorithms) More...
 

Private Member Functions

 RootFinder (const RootFinder &)
 
RootFinderoperator= (const RootFinder &rhs)
 

Private Attributes

IRootFinderMethodfSolver
 

#include <Math/RootFinder.h>

Member Enumeration Documentation

Enumerator
kBRENT 
kGSL_BISECTION 
kGSL_FALSE_POS 
kGSL_BRENT 
kGSL_NEWTON 
kGSL_SECANT 
kGSL_STEFFENSON 

Definition at line 92 of file RootFinder.h.

Constructor & Destructor Documentation

ROOT::Math::RootFinder::RootFinder ( RootFinder::EType  type = RootFinder::kBRENT)

Construct a Root-Finder algorithm.

Definition at line 39 of file RootFinder.cxx.

ROOT::Math::RootFinder::~RootFinder ( )
virtual

Definition at line 141 of file RootFinder.cxx.

ROOT::Math::RootFinder::RootFinder ( const RootFinder )
inlineprivate

Definition at line 105 of file RootFinder.h.

Member Function Documentation

int ROOT::Math::RootFinder::Iterate ( )
inline

Perform a single iteration and return the Status.

Definition at line 168 of file RootFinder.h.

int ROOT::Math::RootFinder::Iterations ( ) const
inline

Return the number of iteration performed to find the Root.

Definition at line 161 of file RootFinder.h.

const char* ROOT::Math::RootFinder::Name ( ) const
inline

Return the current and latest estimate of the lower value of the Root-finding interval (for bracketing algorithms)

Return the current and latest estimate of the upper value of the Root-finding interval (for bracketing algorithms) Get Name of the Root-finding solver algorithm

Definition at line 205 of file RootFinder.h.

Referenced by RooStats::BayesianCalculator::ComputeIntervalFromCdf().

RootFinder& ROOT::Math::RootFinder::operator= ( const RootFinder rhs)
inlineprivate

Definition at line 106 of file RootFinder.h.

double ROOT::Math::RootFinder::Root ( ) const
inline

Return the current and latest estimate of the Root.

Definition at line 175 of file RootFinder.h.

Referenced by RooStats::BayesianCalculator::ComputeIntervalFromCdf(), and runTest().

bool ROOT::Math::RootFinder::SetFunction ( const IGenFunction f,
double  xlow,
double  xup 
)
inline

Provide to the solver the function and the initial search interval [xlow, xup] for algorithms not using derivatives (bracketing algorithms) The templated function f must be of a type implementing the operator() method, double operator() ( double x ) Returns non zero if interval is not valid (i.e.

does not contains a root)

Definition at line 124 of file RootFinder.h.

Referenced by runTest(), and testGSLRootFinder().

bool ROOT::Math::RootFinder::SetFunction ( const IGradFunction f,
double  xstart 
)
inline

Provide to the solver the function and an initial estimate of the root, for algorithms using derivatives.

The templated function f must be of a type implementing the operator() and the Gradient() methods. double operator() ( double x ) Returns non zero if starting point is not valid

Definition at line 138 of file RootFinder.h.

bool ROOT::Math::RootFinder::SetMethod ( RootFinder::EType  type = RootFinder::kBRENT)

Definition at line 46 of file RootFinder.cxx.

Referenced by RootFinder().

template<class Function , class Derivative >
bool ROOT::Math::RootFinder::Solve ( Function f,
Derivative &  d,
double  start,
int  maxIter = 100,
double  absTol = 1E-8,
double  relTol = 1E-10 
)

Definition at line 233 of file RootFinder.h.

Referenced by RooStats::BayesianCalculator::ComputeIntervalFromCdf(), and runTest().

template<class Function >
bool ROOT::Math::RootFinder::Solve ( Function f,
double  min,
double  max,
int  maxIter = 100,
double  absTol = 1E-8,
double  relTol = 1E-10 
)

Definition at line 244 of file RootFinder.h.

bool ROOT::Math::RootFinder::Solve ( int  maxIter = 100,
double  absTol = 1E-8,
double  relTol = 1E-10 
)
inline

Compute the roots iterating until the estimate of the Root is within the required tolerance returning the iteration Status.

Definition at line 154 of file RootFinder.h.

int ROOT::Math::RootFinder::Status ( ) const
inline

Return the status of the last estimate of the Root = 0 OK, not zero failure.

Definition at line 183 of file RootFinder.h.

Member Data Documentation

IRootFinderMethod* ROOT::Math::RootFinder::fSolver
private

Definition at line 215 of file RootFinder.h.

Referenced by Iterate(), Iterations(), Name(), Root(), SetFunction(), SetMethod(), Solve(), Status(), and ~RootFinder().

Collaboration diagram for ROOT::Math::RootFinder:
[legend]

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