Find a local minimum of a 1-dimensional function using "Brent's method" – bisection and inverse quadratic interpolation.
More...
#include <Minimize.h>
|
| | Minimize (Real tol=Real_::zeroTol, int levelMax=30, int bracketMax=30) |
| |
| tuple< Real, Real > | calc (const Func &func, Real min, Real max, Real init) |
| | Find the minimum of a function within bounds [min,max] using init as an initial guess. More...
|
| |
template<class Real>
class honey::Minimize< Real >
Find a local minimum of a 1-dimensional function using "Brent's method" – bisection and inverse quadratic interpolation.
- Parameters
-
| tol | find minimum to within tolerance |
| levelMax | max number of bisection steps when looking for a bracketed minimum |
| bracketMax | max number of bisection steps when looking for the minimum within a bracket |
Find the minimum of a function within bounds [min,max] using init as an initial guess.
On each subinterval [a,b], the values f0 = f(a), f1 = f((a+b)/2), and f2 = f(b) are examined.
If (f0,f1,f2) is monotonic, then [a,b] is subdivided and processed on [a,(a+b)/2] and [(a+b)/2,b]. The max recursion depth is 'levelMax'.
If (f0,f1,f2) is not monotonic, then two cases arise:
- If f1 = min(f0,f1,f2), then (f0,f1,f2) brackets a minimum. The minimum within the bracket is found using a form of bisection called "parabolic interpolation" with max depth 'bracketMax'.
- If f1 = max(f0,f1,f2), then (f0,f1,f2) brackets a maximum. The minimum search continues recursively as in the monotonic case.
- Parameters
-
| func | |
| min | minimum lower bound |
| max | minimum upper bound |
| init | initial guess of minimum |
- Return values
-
| argMin | the function arg that results in the minimum |
| valMin | the minimum |
The documentation for this class was generated from the following files: