Brent's method nonlinear zero finder. More...
#include <mitsuba/core/brent.h>
Classes | |
struct | Result |
Return value of BrentSolver::solve() More... | |
Public Member Functions | |
BrentSolver (size_t maxIterations=100, Float absAccuracy=1e-6f, Float absAccuracyPos=1e-6f, Float relAccuracyPos=1e-6f) | |
Create a new Brent-style solver with the specified accuracy requirements. More... | |
Result | solve (const boost::function< Float(Float)> &func, Float min, Float max) const |
Find a zero in the given interval. More... | |
Result | solve (const boost::function< Float(Float)> &func, Float min, Float max, Float initial) const |
Find a zero in the given interval with an initial guess. More... | |
Result | solve (const boost::function< Float(Float)> &func, Float x0, Float y0, Float x1, Float y1, Float x2, Float y2) const |
Protected Attributes | |
size_t | m_maxIterations |
Float | m_absAccuracy |
Float | m_absAccuracyPos |
Float | m_relAccuracyPos |
Brent's method nonlinear zero finder.
The implementation is transcribed from the Apache Commons Java implementation. The supplied function is required to be continuous, but not necessarily smooth.
|
inline |
Create a new Brent-style solver with the specified accuracy requirements.
maxIterations | Max. number of successive iterations (default: 100) |
absAccuracy | Absolute accuracy requirement – the iterations will stop when |f(x)| < absAccuracy. |
absAccuracyPos | Absolute accuracy requirement of the position – the iterations will stop when |minX-maxX| < absAccuracyPos. |
absAccuracyPos | Absolute accuracy requirement of the position – the iterations will stop when |minX-maxX|/minX < relAccuracyPos. |
Result mitsuba::BrentSolver::solve | ( | const boost::function< Float(Float)> & | func, |
Float | min, | ||
Float | max | ||
) | const |
Find a zero in the given interval.
Requires that the values of the function at the endpoints have opposite signs.
min | the lower bound for the interval. |
max | the upper bound for the interval. |
Result mitsuba::BrentSolver::solve | ( | const boost::function< Float(Float)> & | func, |
Float | min, | ||
Float | max, | ||
Float | initial | ||
) | const |
Find a zero in the given interval with an initial guess.
Requires that the values of the function at the endpoints have opposite signs (note that it is allowed to have endpoints with the same sign if the initial point has opposite sign function-wise).
min | the lower bound for the interval. |
max | the upper bound for the interval. |
initial | the start value to use (must be set to min if no initial point is known) |
Result mitsuba::BrentSolver::solve | ( | const boost::function< Float(Float)> & | func, |
Float | x0, | ||
Float | y0, | ||
Float | x1, | ||
Float | y1, | ||
Float | x2, | ||
Float | y2 | ||
) | const |
Find a zero starting search according to the three provided points.
x0 | old approximation for the root |
y0 | function value at the approximation for the root |
x1 | last calculated approximation for the root |
y1 | function value at the last calculated approximation for the root |
x2 | bracket point (must be set to x0 if no bracket point is known, this will force starting with linear interpolation) |
y2 | function value at the bracket point. |
|
protected |
|
protected |
|
protected |
|
protected |