31 #ifndef ROOT_Math_RootFinder
32 #define ROOT_Math_RootFinder
35 #ifndef ROOT_Math_IFunctionfwd
39 #ifndef ROOT_Math_IRootFinderMethod
108 if (
this == &rhs)
return *
this;
142 template<
class Function,
class Derivative>
144 int maxIter = 100,
double absTol = 1
E-8,
double relTol = 1
E-10);
146 template<
class Function>
148 int maxIter = 100,
double absTol = 1
E-8,
double relTol = 1
E-10);
154 bool Solve(
int maxIter = 100,
double absTol = 1
E-8,
double relTol = 1
E-10) {
224 #ifndef ROOT_Math_WrappedFunction
228 #ifndef ROOT_Math_Functor
232 template<
class Function,
class Derivative>
234 int maxIter,
double absTol,
double relTol)
239 if (!ret)
return false;
240 return Solve(maxIter, absTol, relTol);
243 template<
class Function>
245 int maxIter,
double absTol,
double relTol)
247 if (!fSolver)
return false;
249 bool ret = fSolver->SetFunction(wf, min, max);
250 if (!ret)
return false;
251 return Solve(maxIter, absTol, relTol);
User Class to find the Root of one dimensional functions.
static Vc_ALWAYS_INLINE int_v min(const int_v &x, const int_v &y)
Interface (abstract class) for generic functions objects of one-dimension Provides a method to evalua...
Namespace for new ROOT classes and functions.
GradFunctor1D class for one-dimensional gradient functions.
virtual double Root() const =0
Returns the previously calculated root.
double Root() const
Return the current and latest estimate of the Root.
Interface (abstract class) for one-dimensional functions providing a gradient calculation.
Template class to wrap any C++ callable object which takes one argument i.e.
Interface for finding function roots of one-dimensional functions.
int Iterate()
Perform a single iteration and return the Status.
virtual int Iterations() const
Return number of iterations used to find the root Must be implemented by derived classes.
RootFinder(RootFinder::EType type=RootFinder::kBRENT)
Construct a Root-Finder algorithm.
RootFinder(const RootFinder &)
int Status() const
Return the status of the last estimate of the Root = 0 OK, not zero failure.
RootFinder & operator=(const RootFinder &rhs)
const char * Name() const
Return the current and latest estimate of the lower value of the Root-finding interval (for bracketin...
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 usi...
virtual bool SetFunction(const ROOT::Math::IGradFunction &, double)
Sets the function for algorithms using derivatives.
virtual bool Solve(int maxIter=100, double absTol=1E-8, double relTol=1E-10)=0
Stimates the root for the function.
IRootFinderMethod * fSolver
int Iterations() const
Return the number of iteration performed to find the Root.
static Vc_ALWAYS_INLINE int_v max(const int_v &x, const int_v &y)
Namespace for new Math classes and functions.
virtual const char * Name() const =0
Return name of root finder algorithm.
virtual int Status() const =0
Returns the status of the previous estimate.
bool SetFunction(const IGradFunction &f, double xstart)
Provide to the solver the function and an initial estimate of the root, for algorithms using derivati...
virtual int Iterate()
This method is implemented only by the GSLRootFinder and GSLRootFinderDeriv classes and will return a...
bool Solve(Function &f, Derivative &d, double start, 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...