Logo ROOT  
Reference Guide
ROOT::Math::GSLRootFinderDeriv Class Reference

Base class for GSL Root-Finding algorithms for one dimensional functions which use function derivatives.

For finding the roots users should not use this class directly but instantiate the derived classes, for example ROOT::Math::Roots::Newton for using the Newton algorithm. All the classes defining the alhorithms are defined in the header Math/RootFinderAlgorithm.h They possible types implementing root bracketing algorithms which use function derivatives are:

See also those classes for the documentation. See the GSL online manual for information on the GSL Root-Finding algorithms

Definition at line 74 of file GSLRootFinderDeriv.h.

Public Types

typedef void(* GSLFdFPointer) (double, void *, double *, double *)
 
typedef double(* GSLFuncPointer) (double, void *)
 

Public Member Functions

 GSLRootFinderDeriv ()
 
virtual ~GSLRootFinderDeriv ()
 
int Iterate ()
 iterate (return GSL_SUCCESS in case of successful iteration) More...
 
int Iterations () const
 Return number of iterations. More...
 
const char * Name () const
 Return name of root finder algorithm. More...
 
double Root () const
 Returns the previously calculated root. More...
 
bool SetFunction (const IGradFunction &f, double xstart)
 Sets the function for algorithms using derivatives. More...
 
virtual bool SetFunction (const ROOT::Math::IGenFunction &, double, double)
 Sets the function for the rest of the algorithms. More...
 
virtual bool SetFunction (const ROOT::Math::IGradFunction &, double)
 Sets the function for algorithms using derivatives. More...
 
bool SetFunction (GSLFuncPointer f, GSLFuncPointer df, GSLFdFPointer fdf, void *p, double Root)
 
bool Solve (int maxIter=100, double absTol=1E-8, double relTol=1E-10)
 Find the root (return false if failed) More...
 
int Status () const
 Return the status of last root finding. More...
 
- Public Member Functions inherited from ROOT::Math::IRootFinderMethod
 IRootFinderMethod ()
 Default Constructor. More...
 
virtual ~IRootFinderMethod ()
 Default Destructor. More...
 
virtual int Iterate ()
 This method is implemented only by the GSLRootFinder and GSLRootFinderDeriv classes and will return an error if it's not one of them. More...
 
virtual int Iterations () const
 Return number of iterations used to find the root Must be implemented by derived classes. More...
 
virtual const char * Name () const =0
 Return name of root finder algorithm. More...
 
virtual double Root () const =0
 Returns the previously calculated root. More...
 
virtual bool SetFunction (const ROOT::Math::IGenFunction &, double, double)
 Sets the function for the rest of the algorithms. More...
 
virtual bool SetFunction (const ROOT::Math::IGradFunction &, double)
 Sets the function for algorithms using derivatives. More...
 
virtual bool Solve (int maxIter=100, double absTol=1E-8, double relTol=1E-10)=0
 Stimates the root for the function. More...
 
virtual int Status () const =0
 Returns the status of the previous estimate. More...
 

Protected Member Functions

void FreeSolver ()
 
void SetSolver (GSLRootFdFSolver *s)
 

Private Member Functions

 GSLRootFinderDeriv (const GSLRootFinderDeriv &)
 
GSLRootFinderDerivoperator= (const GSLRootFinderDeriv &)
 

Private Attributes

GSLFunctionDerivWrapperfFunction
 
int fIter
 
double fPrevRoot
 
double fRoot
 
GSLRootFdFSolverfS
 
int fStatus
 
bool fValidPoint
 

#include <Math/GSLRootFinderDeriv.h>

Inheritance diagram for ROOT::Math::GSLRootFinderDeriv:

Member Typedef Documentation

◆ GSLFdFPointer

typedef void(* ROOT::Math::GSLRootFinderDeriv::GSLFdFPointer) (double, void *, double *, double *)

Definition at line 103 of file GSLRootFinderDeriv.h.

◆ GSLFuncPointer

typedef double(* ROOT::Math::GSLRootFinderDeriv::GSLFuncPointer) (double, void *)

Definition at line 102 of file GSLRootFinderDeriv.h.

Constructor & Destructor Documentation

◆ GSLRootFinderDeriv() [1/2]

ROOT::Math::GSLRootFinderDeriv::GSLRootFinderDeriv ( )

Definition at line 48 of file GSLRootFinderDeriv.cxx.

◆ ~GSLRootFinderDeriv()

ROOT::Math::GSLRootFinderDeriv::~GSLRootFinderDeriv ( )
virtual

Definition at line 58 of file GSLRootFinderDeriv.cxx.

◆ GSLRootFinderDeriv() [2/2]

ROOT::Math::GSLRootFinderDeriv::GSLRootFinderDeriv ( const GSLRootFinderDeriv )
private

Definition at line 64 of file GSLRootFinderDeriv.cxx.

Member Function Documentation

◆ FreeSolver()

void ROOT::Math::GSLRootFinderDeriv::FreeSolver ( )
protected

Definition at line 102 of file GSLRootFinderDeriv.cxx.

◆ Iterate()

int ROOT::Math::GSLRootFinderDeriv::Iterate ( )
virtual

iterate (return GSL_SUCCESS in case of successful iteration)

Reimplemented from ROOT::Math::IRootFinderMethod.

Definition at line 107 of file GSLRootFinderDeriv.cxx.

◆ Iterations()

int ROOT::Math::GSLRootFinderDeriv::Iterations ( ) const
inlinevirtual

Return number of iterations.

Reimplemented from ROOT::Math::IRootFinderMethod.

Definition at line 117 of file GSLRootFinderDeriv.h.

◆ Name()

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

Return name of root finder algorithm.

Implements ROOT::Math::IRootFinderMethod.

Definition at line 132 of file GSLRootFinderDeriv.cxx.

◆ operator=()

GSLRootFinderDeriv & ROOT::Math::GSLRootFinderDeriv::operator= ( const GSLRootFinderDeriv rhs)
private

Definition at line 68 of file GSLRootFinderDeriv.cxx.

◆ Root()

double ROOT::Math::GSLRootFinderDeriv::Root ( ) const
virtual

Returns the previously calculated root.

Implements ROOT::Math::IRootFinderMethod.

Definition at line 127 of file GSLRootFinderDeriv.cxx.

◆ SetFunction() [1/4]

bool ROOT::Math::GSLRootFinderDeriv::SetFunction ( const IGradFunction ,
double   
)
inlinevirtual

Sets the function for algorithms using derivatives.


Reimplemented from ROOT::Math::IRootFinderMethod.

Definition at line 96 of file GSLRootFinderDeriv.h.

◆ SetFunction() [2/4]

virtual bool ROOT::Math::IRootFinderMethod::SetFunction ( const ROOT::Math::IGenFunction ,
double  ,
double   
)
inlinevirtual

Sets the function for the rest of the algorithms.

The parameters set the interval where the root has to be calculated.

Reimplemented from ROOT::Math::IRootFinderMethod.

Definition at line 53 of file IRootFinderMethod.h.

◆ SetFunction() [3/4]

virtual bool ROOT::Math::IRootFinderMethod::SetFunction ( const ROOT::Math::IGradFunction ,
double   
)
inlinevirtual

Sets the function for algorithms using derivatives.


Reimplemented from ROOT::Math::IRootFinderMethod.

Definition at line 45 of file IRootFinderMethod.h.

◆ SetFunction() [4/4]

bool ROOT::Math::GSLRootFinderDeriv::SetFunction ( GSLFuncPointer  f,
GSLFuncPointer  df,
GSLFdFPointer  fdf,
void p,
double  Root 
)

Definition at line 79 of file GSLRootFinderDeriv.cxx.

◆ SetSolver()

void ROOT::Math::GSLRootFinderDeriv::SetSolver ( GSLRootFdFSolver s)
protected

Definition at line 97 of file GSLRootFinderDeriv.cxx.

◆ Solve()

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

Find the root (return false if failed)

Implements ROOT::Math::IRootFinderMethod.

Definition at line 137 of file GSLRootFinderDeriv.cxx.

◆ Status()

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

Return the status of last root finding.

Implements ROOT::Math::IRootFinderMethod.

Definition at line 122 of file GSLRootFinderDeriv.h.

Member Data Documentation

◆ fFunction

GSLFunctionDerivWrapper* ROOT::Math::GSLRootFinderDeriv::fFunction
private

Definition at line 134 of file GSLRootFinderDeriv.h.

◆ fIter

int ROOT::Math::GSLRootFinderDeriv::fIter
private

Definition at line 139 of file GSLRootFinderDeriv.h.

◆ fPrevRoot

double ROOT::Math::GSLRootFinderDeriv::fPrevRoot
mutableprivate

Definition at line 138 of file GSLRootFinderDeriv.h.

◆ fRoot

double ROOT::Math::GSLRootFinderDeriv::fRoot
mutableprivate

Definition at line 137 of file GSLRootFinderDeriv.h.

◆ fS

GSLRootFdFSolver* ROOT::Math::GSLRootFinderDeriv::fS
private

Definition at line 135 of file GSLRootFinderDeriv.h.

◆ fStatus

int ROOT::Math::GSLRootFinderDeriv::fStatus
private

Definition at line 140 of file GSLRootFinderDeriv.h.

◆ fValidPoint

bool ROOT::Math::GSLRootFinderDeriv::fValidPoint
private

Definition at line 141 of file GSLRootFinderDeriv.h.

Collaboration diagram for ROOT::Math::GSLRootFinderDeriv:

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