24#ifndef quantlib_solver1d_ridder_h
25#define quantlib_solver1d_ridder_h
27#include <ql/math/solver1d.hpp>
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) {
99 QL_FAIL(
"never get here.");
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.
bool close(const Quantity &m1, const Quantity &m2, Size n)