24#ifndef quantlib_solver1d_newton_h
25#define quantlib_solver1d_newton_h
44 Real xAccuracy)
const {
52 Real froot, dfroot, dx;
55 dfroot =
f.derivative(
root_);
57 "Newton requires function's derivative");
69 if (std::fabs(dx) < xAccuracy) {
75 dfroot =
f.derivative(
root_);
79 QL_FAIL(
"maximum number of function evaluations ("
Real solveImpl(const F &f, Real xAccuracy) const
template class providing a null value for a given type.
Base class for 1-D solvers.
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
#define QL_FAIL(message)
throw an error (possibly with file and line information)
Safe (bracketed) Newton 1-D solver.