ROOT » MATH » MATHMORE » ROOT::Math::GSLMultiRootFinder

class ROOT::Math::GSLMultiRootFinder

     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 <A HREF=""> online manual</A> 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
     <A HREF="">documentation</A> )
     are the followings:
         <li><tt>ROOT::Math::GSLMultiRootFinder::kHybridSJ</tt>  with name <it>"HybridSJ"</it>: modified Powell's hybrid
     method as implemented in HYBRJ in MINPACK
         <li><tt>ROOT::Math::GSLMultiRootFinder::kHybridJ</tt>  with name <it>"HybridJ"</it>: unscaled version of the
     previous algorithm</li>
         <li><tt>ROOT::Math::GSLMultiRootFinder::kNewton</tt>  with name <it>"Newton"</it>: Newton method </li>
         <li><tt>ROOT::Math::GSLMultiRootFinder::kGNewton</tt>  with name <it>"GNewton"</it>: modified Newton method </li>
     The algorithms without derivatives (see also the GSL
     <A HREF="">documentation</A> )
     are the followings:
         <li><tt>ROOT::Math::GSLMultiRootFinder::kHybridS</tt>  with name <it>"HybridS"</it>: same as HybridSJ but using
     finate difference approximation for the derivatives</li>
         <li><tt>ROOT::Math::GSLMultiRootFinder::kHybrid</tt>  with name <it>"Hybrid"</it>: unscaled version of the
     previous algorithm</li>
         <li><tt>ROOT::Math::GSLMultiRootFinder::kDNewton</tt>  with name <it>"DNewton"</it>: discrete Newton algorithm </li>
         <li><tt>ROOT::Math::GSLMultiRootFinder::kBroyden</tt>  with name <it>"Broyden"</it>: Broyden algorithm </li>

     @ingroup MultiRoot

Function Members (Methods)

intAddFunction(const ROOT::Math::IMultiGenFunction& func)
unsigned intDim() const
const double*Dx() const
const double*FVal() const
ROOT::Math::GSLMultiRootFinderGSLMultiRootFinder(ROOT::Math::GSLMultiRootFinder::EType type)
ROOT::Math::GSLMultiRootFinderGSLMultiRootFinder(ROOT::Math::GSLMultiRootFinder::EDerivType type)
ROOT::Math::GSLMultiRootFinderGSLMultiRootFinder(const char* name = 0)
intIterations() const
const char*Name() const
intPrintLevel() const
voidPrintState(ostream& os = std::cout)
static voidSetDefaultMaxIterations(int maxiter)
static voidSetDefaultTolerance(double abstol, double reltol = 0)
voidSetPrintLevel(int level)
voidSetType(ROOT::Math::GSLMultiRootFinder::EType type)
voidSetType(ROOT::Math::GSLMultiRootFinder::EDerivType type)
voidSetType(const char* name)
boolSolve(const double* x, int maxIter = 0, double absTol = 0, double relTol = 0)
intStatus() const
const double*X() const
pair<bool,int>GetType(const char* name)

Data Members

static ROOT::Math::GSLMultiRootFinder::ETypekBroyden
static ROOT::Math::GSLMultiRootFinder::ETypekDNewton
static ROOT::Math::GSLMultiRootFinder::EDerivTypekGNewton
static ROOT::Math::GSLMultiRootFinder::ETypekHybrid
static ROOT::Math::GSLMultiRootFinder::EDerivTypekHybridJ
static ROOT::Math::GSLMultiRootFinder::ETypekHybridS
static ROOT::Math::GSLMultiRootFinder::EDerivTypekHybridSJ
static ROOT::Math::GSLMultiRootFinder::EDerivTypekNewton
vector<ROOT::Math::IMultiGenFunction*>fFunctions! transient Vector of the functions
intfItercurrent numer of iterations
intfPrintLevelprint level
intfStatuscurrent status
intfTypetype of algorithm
boolfUseDerivAlgoalgorithm using derivative

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

GSLMultiRootFinder(EType type)
 create a multi-root finder based on an algorithm not requiring function derivative
GSLMultiRootFinder(EDerivType type)
 create a multi-root finder based on an algorithm requiring function derivative
GSLMultiRootFinder(const char* name = 0)
      create a multi-root finder using a string.
      The names are those defined in the GSL manuals
      after having remived the GSL prefix (gsl_multiroot_fsolver).
      Default algorithm  is "hybrids" (without derivative).

virtual ~GSLMultiRootFinder()
GSLMultiRootFinder(const GSLMultiRootFinder &)
 usually copying is non trivial, so we make this unaccessible
void SetType(EType type)
 set the type for an algorithm without derivatives
void SetType(EDerivType type)
 set the type of algorithm using derivatives
void SetType(const char* name)
 set the type using a string
int AddFunction(const ROOT::Math::IMultiGenFunction& func)
      add (set) a single function fi(x1,...xn) which is part of the system of
       specifying the begin and end of the iterator.
       If using a derivative type algorithm the function must implement the
       ROOT::Math::IMultiGradFunction interface
       Return the current number of function in the list and 0 if failed to add the function

unsigned int Dim() const
       return the number of sunctions set in the class.
       The number must be equal to the dimension of the functions

{ return fFunctions.size(); }
void Clear()
 clear list of functions
const double * X() const
 return the root X values solving the system
const double * FVal() const
 return the function values f(X) solving the system
 i.e. they must be close to zero at the solution
const double * Dx() const
 return the last step size
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...

int Iterations() const
 Return number of iterations
int Status() const
 Return the status of last root finding
{ return fStatus; }
const char * Name() const
 Return the algorithm name
void SetPrintLevel(int level)
       set print level
       level = 0  quiet (no messages print)
             = 1  print only the result
             = 3  max debug. Print result at each iteration

{ fPrintLevel = level; }
int PrintLevel() const
 return the print level
{ return fPrintLevel; }
void SetDefaultTolerance(double abstol, double reltol = 0)
-- static methods to set configurations
 set tolerance (absolute and relative)
 relative tolerance is only use to verify the convergence
 do it is a minor parameter
void SetDefaultMaxIterations(int maxiter)
 set maximum number of iterations
void PrintState(ostream& os = std::cout)
 print iteration state
std::pair<bool,int> GetType(const char* name)
 return type given a name
void ClearFunctions()
 clear list of functions