Solver1D Class Template Reference
#include <ql/solver1d.hpp>
Inheritance diagram for Solver1D:

Detailed Description
template<class Impl>
class QuantLib::Solver1D< Impl >
Base class for 1-D solvers.
The implementation of this class uses the so-called "Barton-Nackman trick", also known as "the curiously recurring template pattern". Concrete solvers will be declared as:
class Foo : public Solver1D<Foo> { public: ... template <class F> Real solveImpl(const F& f, Real accuracy) const { ... } };
solveImpl, the base class will set its protected data members so that:xMin_andxMax_form a valid bracket;fxMin_andfxMax_contain the values of the function inxMin_andxMax_;root_is a valid initial guess. The implementation ofsolveImplcan safely assume all of the above.
- Todo:
- clean up the interface so that it is clear whether the accuracy is specified for
or
. - add target value (now the target value is 0.0)
- clean up the interface so that it is clear whether the accuracy is specified for
Public Member Functions | |
Modifiers | |
| template<class F> | |
| Real | solve (const F &f, Real accuracy, Real guess, Real step) const |
| template<class F> | |
| Real | solve (const F &f, Real accuracy, Real guess, Real xMin, Real xMax) const |
| void | setMaxEvaluations (Size evaluations) |
| void | setLowerBound (Real lowerBound) |
| sets the lower bound for the function domain | |
| void | setUpperBound (Real upperBound) |
| sets the upper bound for the function domain | |
Protected Attributes | |
| Real | root_ |
| Real | xMin_ |
| Real | xMax_ |
| Real | fxMin_ |
| Real | fxMax_ |
| Size | maxEvaluations_ |
| Size | evaluationNumber_ |
Member Function Documentation
|
||||||||||||||||||||
|
This method returns the zero of the function |
|
||||||||||||||||||||||||
|
This method returns the zero of the function |
|
|
This method sets the maximum number of function evaluations for the bracketing routine. An error is thrown if a bracket is not found after this number of evaluations. |

, determined with the given accuracy (i.e.,
). This method contains a bracketing routine to which an initial guess must be supplied as well as a step used to scan the range of the possible bracketing values.
and
which must bracket the zero (i.e., either
, or
must be true).