Logo ROOT   6.13/01
Reference Guide
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
ROOT::Math::GSLMultiRootFinder Class Reference

Class for Multidimensional root finding algorithms bassed on GSL.

This class is used to solve a non-linear system of equations:

f1(x1,....xn) = 0 f2(x1,....xn) = 0 .................. fn(x1,....xn) = 0

See the GSL online manual for information on the GSL MultiRoot finding algorithms

The available GSL algorithms require the derivatives of the supplied functions or not (they are computed internally by GSL). In the first case the user needs to provide a list of multidimensional functions implementing the gradient interface (ROOT::Math::IMultiGradFunction) while in the second case it is enough to supply a list of functions impelmenting the ROOT::Math::IMultiGenFunction interface. The available algorithms requiring derivatives (see also the GSL documentation ) are the followings:

The algorithms without derivatives (see also the GSL documentation ) are the followings:

Definition at line 95 of file GSLMultiRootFinder.h.

Public Types

enum  EDerivType { kHybridSJ, kHybridJ, kNewton, kGNewton }
 enumeration specifying the types of GSL multi root finders requiring the derivatives More...
 
enum  EType { kHybridS, kHybrid, kDNewton, kBroyden }
 enumeration specifying the types of GSL multi root finders which do not require the derivatives More...
 

Public Member Functions

 GSLMultiRootFinder (EType type)
 create a multi-root finder based on an algorithm not requiring function derivative More...
 
 GSLMultiRootFinder (EDerivType type)
 create a multi-root finder based on an algorithm requiring function derivative More...
 
 GSLMultiRootFinder (const char *name=0)
 
virtual ~GSLMultiRootFinder ()
 destructor More...
 
int AddFunction (const ROOT::Math::IMultiGenFunction &func)
 
template<class Function >
int AddFunction (Function &f, int ndim)
 same method as before but using any function implementing the operator(), so can be wrapped in a IMultiGenFunction interface More...
 
void Clear ()
 clear list of functions More...
 
unsigned int Dim () const
 return the number of sunctions set in the class. More...
 
const double * Dx () const
 return the last step size More...
 
const double * FVal () const
 return the function values f(X) solving the system i.e. More...
 
int Iterations () const
 Return number of iterations. More...
 
const char * Name () const
 Return the algorithm name used for solving Note the name is available only after having called solved Otherwise an empyty string is returned. More...
 
int PrintLevel () const
 return the print level More...
 
void PrintState (std::ostream &os=std::cout)
 print iteration state More...
 
template<class FuncIterator >
bool SetFunctionList (FuncIterator begin, FuncIterator end)
 
void SetPrintLevel (int level)
 
void SetType (EType type)
 set the type for an algorithm without derivatives More...
 
void SetType (EDerivType type)
 set the type of algorithm using derivatives More...
 
void SetType (const char *name)
 set the type using a string More...
 
bool Solve (const double *x, int maxIter=0, double absTol=0, double relTol=0)
 Find the root starting from the point X; Use the number of iteration and tolerance if given otherwise use default parameter values which can be defined by the static method SetDefault... More...
 
int Status () const
 Return the status of last root finding. More...
 
const double * X () const
 return the root X values solving the system More...
 

Static Public Member Functions

static void SetDefaultMaxIterations (int maxiter)
 set maximum number of iterations More...
 
static void SetDefaultTolerance (double abstol, double reltol=0)
 set tolerance (absolute and relative) relative tolerance is only use to verify the convergence do it is a minor parameter More...
 

Protected Member Functions

void ClearFunctions ()
 
std::pair< bool, int > GetType (const char *name)
 

Private Member Functions

 GSLMultiRootFinder (const GSLMultiRootFinder &)
 
GSLMultiRootFinderoperator= (const GSLMultiRootFinder &)
 

Private Attributes

std::vector< ROOT::Math::IMultiGenFunction * > fFunctions
 
int fIter
 
int fPrintLevel
 
GSLMultiRootBaseSolverfSolver
 
int fStatus
 
int fType
 
bool fUseDerivAlgo
 

#include <Math/GSLMultiRootFinder.h>

Member Enumeration Documentation

◆ EDerivType

enumeration specifying the types of GSL multi root finders requiring the derivatives

Enumerator
kHybridSJ 
kHybridJ 
kNewton 
kGNewton 

Definition at line 104 of file GSLMultiRootFinder.h.

◆ EType

enumeration specifying the types of GSL multi root finders which do not require the derivatives

Enumerator
kHybridS 
kHybrid 
kDNewton 
kBroyden 

Definition at line 115 of file GSLMultiRootFinder.h.

Constructor & Destructor Documentation

◆ GSLMultiRootFinder() [1/4]

ROOT::Math::GSLMultiRootFinder::GSLMultiRootFinder ( EType  type)

create a multi-root finder based on an algorithm not requiring function derivative

Definition at line 67 of file GSLMultiRootFinder.cxx.

◆ GSLMultiRootFinder() [2/4]

ROOT::Math::GSLMultiRootFinder::GSLMultiRootFinder ( EDerivType  type)

create a multi-root finder based on an algorithm requiring function derivative

Definition at line 76 of file GSLMultiRootFinder.cxx.

◆ GSLMultiRootFinder() [3/4]

ROOT::Math::GSLMultiRootFinder::GSLMultiRootFinder ( const char *  name = 0)

Definition at line 85 of file GSLMultiRootFinder.cxx.

◆ ~GSLMultiRootFinder()

ROOT::Math::GSLMultiRootFinder::~GSLMultiRootFinder ( )
virtual

destructor

Definition at line 95 of file GSLMultiRootFinder.cxx.

◆ GSLMultiRootFinder() [4/4]

ROOT::Math::GSLMultiRootFinder::GSLMultiRootFinder ( const GSLMultiRootFinder )
private

Definition at line 102 of file GSLMultiRootFinder.cxx.

Member Function Documentation

◆ AddFunction() [1/2]

int ROOT::Math::GSLMultiRootFinder::AddFunction ( const ROOT::Math::IMultiGenFunction func)

Definition at line 122 of file GSLMultiRootFinder.cxx.

◆ AddFunction() [2/2]

template<class Function >
int ROOT::Math::GSLMultiRootFinder::AddFunction ( Function &  f,
int  ndim 
)
inline

same method as before but using any function implementing the operator(), so can be wrapped in a IMultiGenFunction interface

Definition at line 192 of file GSLMultiRootFinder.h.

◆ Clear()

void ROOT::Math::GSLMultiRootFinder::Clear ( )

clear list of functions

Definition at line 139 of file GSLMultiRootFinder.cxx.

◆ ClearFunctions()

void ROOT::Math::GSLMultiRootFinder::ClearFunctions ( )
protected

Definition at line 130 of file GSLMultiRootFinder.cxx.

◆ Dim()

unsigned int ROOT::Math::GSLMultiRootFinder::Dim ( ) const
inline

return the number of sunctions set in the class.

The number must be equal to the dimension of the functions

Definition at line 202 of file GSLMultiRootFinder.h.

◆ Dx()

const double * ROOT::Math::GSLMultiRootFinder::Dx ( ) const

return the last step size

Definition at line 151 of file GSLMultiRootFinder.cxx.

◆ FVal()

const double * ROOT::Math::GSLMultiRootFinder::FVal ( ) const

return the function values f(X) solving the system i.e.

they must be close to zero at the solution

Definition at line 155 of file GSLMultiRootFinder.cxx.

◆ GetType()

std::pair< bool, int > ROOT::Math::GSLMultiRootFinder::GetType ( const char *  name)
protected

Definition at line 219 of file GSLMultiRootFinder.cxx.

◆ Iterations()

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

Return number of iterations.

Definition at line 227 of file GSLMultiRootFinder.h.

◆ Name()

const char * ROOT::Math::GSLMultiRootFinder::Name ( ) const

Return the algorithm name used for solving Note the name is available only after having called solved Otherwise an empyty string is returned.

Definition at line 159 of file GSLMultiRootFinder.cxx.

◆ operator=()

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

Definition at line 106 of file GSLMultiRootFinder.cxx.

◆ PrintLevel()

int ROOT::Math::GSLMultiRootFinder::PrintLevel ( ) const
inline

return the print level

Definition at line 248 of file GSLMultiRootFinder.h.

◆ PrintState()

void ROOT::Math::GSLMultiRootFinder::PrintState ( std::ostream &  os = std::cout)

print iteration state

Definition at line 333 of file GSLMultiRootFinder.cxx.

◆ SetDefaultMaxIterations()

void ROOT::Math::GSLMultiRootFinder::SetDefaultMaxIterations ( int  maxiter)
static

set maximum number of iterations

Definition at line 62 of file GSLMultiRootFinder.cxx.

◆ SetDefaultTolerance()

void ROOT::Math::GSLMultiRootFinder::SetDefaultTolerance ( double  abstol,
double  reltol = 0 
)
static

set tolerance (absolute and relative) relative tolerance is only use to verify the convergence do it is a minor parameter

Definition at line 57 of file GSLMultiRootFinder.cxx.

◆ SetFunctionList()

template<class FuncIterator >
bool ROOT::Math::GSLMultiRootFinder::SetFunctionList ( FuncIterator  begin,
FuncIterator  end 
)
inline

Definition at line 171 of file GSLMultiRootFinder.h.

◆ SetPrintLevel()

void ROOT::Math::GSLMultiRootFinder::SetPrintLevel ( int  level)
inline

Definition at line 245 of file GSLMultiRootFinder.h.

◆ SetType() [1/3]

void ROOT::Math::GSLMultiRootFinder::SetType ( EType  type)
inline

set the type for an algorithm without derivatives

Definition at line 149 of file GSLMultiRootFinder.h.

◆ SetType() [2/3]

void ROOT::Math::GSLMultiRootFinder::SetType ( EDerivType  type)
inline

set the type of algorithm using derivatives

Definition at line 154 of file GSLMultiRootFinder.h.

◆ SetType() [3/3]

void ROOT::Math::GSLMultiRootFinder::SetType ( const char *  name)

set the type using a string

Definition at line 114 of file GSLMultiRootFinder.cxx.

◆ Solve()

bool ROOT::Math::GSLMultiRootFinder::Solve ( const double *  x,
int  maxIter = 0,
double  absTol = 0,
double  relTol = 0 
)

Find the root starting from the point X; Use the number of iteration and tolerance if given otherwise use default parameter values which can be defined by the static method SetDefault...

Definition at line 236 of file GSLMultiRootFinder.cxx.

◆ Status()

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

Return the status of last root finding.

Definition at line 232 of file GSLMultiRootFinder.h.

◆ X()

const double * ROOT::Math::GSLMultiRootFinder::X ( ) const

return the root X values solving the system

Definition at line 147 of file GSLMultiRootFinder.cxx.

Member Data Documentation

◆ fFunctions

std::vector<ROOT::Math::IMultiGenFunction *> ROOT::Math::GSLMultiRootFinder::fFunctions
private

Definition at line 286 of file GSLMultiRootFinder.h.

◆ fIter

int ROOT::Math::GSLMultiRootFinder::fIter
private

Definition at line 275 of file GSLMultiRootFinder.h.

◆ fPrintLevel

int ROOT::Math::GSLMultiRootFinder::fPrintLevel
private

Definition at line 277 of file GSLMultiRootFinder.h.

◆ fSolver

GSLMultiRootBaseSolver* ROOT::Math::GSLMultiRootFinder::fSolver
private

Definition at line 285 of file GSLMultiRootFinder.h.

◆ fStatus

int ROOT::Math::GSLMultiRootFinder::fStatus
private

Definition at line 276 of file GSLMultiRootFinder.h.

◆ fType

int ROOT::Math::GSLMultiRootFinder::fType
private

Definition at line 282 of file GSLMultiRootFinder.h.

◆ fUseDerivAlgo

bool ROOT::Math::GSLMultiRootFinder::fUseDerivAlgo
private

Definition at line 283 of file GSLMultiRootFinder.h.

Libraries for ROOT::Math::GSLMultiRootFinder:
[legend]

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