39#include "gsl/gsl_roots.h"
40#include "gsl/gsl_errno.h"
73 int status = gsl_root_fdfsolver_set(
fS->Solver(),
fFunction->GetFunc(),
fRoot);
97 MATH_ERROR_MSG(
"GSLRootFinderDeriv::Iterate",
" Function is not valid");
101 MATH_ERROR_MSG(
"GSLRootFinderDeriv::Iterate",
" Estimated point is not valid");
106 int status = gsl_root_fdfsolver_iterate(
fS->Solver());
109 fRoot = gsl_root_fdfsolver_root(
fS->Solver() );
120 return gsl_root_fdfsolver_name(
fS->Solver() );
134 MATH_ERROR_MSG(
"GSLRootFinderDeriv::Solve",
"error returned when performing an iteration");
148 while (status == GSL_CONTINUE && iter < maxIter);
150 if (status == GSL_CONTINUE) {
152 MATH_INFO_MSGVAL(
"GSLRootFinderDeriv::Solve",
"exceeded max iterations, reached tolerance is not sufficient",tol);
#define MATH_INFO_MSGVAL(loc, txt, x)
#define MATH_ERROR_MSG(loc, str)
class to wrap a gsl_function_fdf (with derivatives)
Root-Finder with derivatives implementation class using GSL.
GSLFunctionDerivWrapper * fFunction
const char * Name() const override
Return name of root finder algorithm.
int Iterate() override
iterate (return GSL_SUCCESS in case of successful iteration)
double Root() const override
Returns the previously calculated root.
bool Solve(int maxIter=100, double absTol=1E-8, double relTol=1E-10) override
Find the root (return false if failed).
~GSLRootFinderDeriv() override
bool SetFunction(const IGradFunction &f, double xstart) override
Sets the function for algorithms using derivatives.
void SetSolver(GSLRootFdFSolver *s)
double(* GSLFuncPointer)(double, void *)
void(* GSLFdFPointer)(double, void *, double *, double *)
int TestDelta(double x1, double x0, double epsAbs, double epsRel)