24#ifndef quantlib_solver1d_finitedifferencenewtonsafe_h
25#define quantlib_solver1d_finitedifferencenewtonsafe_h
42 Real xAccuracy)
const {
64 Real frootold = froot;
68 if ((((
root_-xh)*dfroot-froot)*
69 ((
root_-xl)*dfroot-froot) > 0.0)
70 || (std::fabs(2.0*froot) > std::fabs(dxold*dfroot))) {
87 if (std::fabs(dx) < xAccuracy)
92 dfroot = (frootold-froot)/(rootold-
root_);
100 QL_FAIL(
"maximum number of function evaluations ("
safe Newton 1-D solver with finite difference derivatives
Real solveImpl(const F &f, Real xAccuracy) const
Base class for 1-D solvers.
#define QL_FAIL(message)
throw an error (possibly with file and line information)
bool close(const Quantity &m1, const Quantity &m2, Size n)
Abstract 1-D solver class.