24#ifndef quantlib_solver1d_ridder_h
25#define quantlib_solver1d_ridder_h
49 Real fxMid, froot,
s, xMid, nextRoot;
54 Real xAccuracy = xAcc/100.0;
71 nextRoot = xMid + (xMid -
xMin_) *
73 if (std::fabs(nextRoot-
root_) <= xAccuracy) {
83 if (
close(froot, 0.0))
87 if (
sign(fxMid,froot) != fxMid) {
109 QL_FAIL(
"maximum number of function evaluations ("
114 return b >= 0.0 ? std::fabs(a) :
Real(-std::fabs(a));
Real solveImpl(const F &f, Real xAcc) const
Real sign(Real a, Real b) const
Base class for 1-D solvers.
#define QL_FAIL(message)
throw an error (possibly with file and line information)
ext::function< Real(Real)> b
bool close(const Quantity &m1, const Quantity &m2, Size n)
Abstract 1-D solver class.