1 // This is core/vnl/algo/vnl_bracket_minimum.h
2 #ifndef vnl_bracket_minimum_h_
3 #define vnl_bracket_minimum_h_
4 //:
5 // \file
6 // \brief Function to bracket a minimum
7 // \author Tim Cootes
8 // \date   Feb 2007
9 //
10 // \verbatim
11 //  Modifications
12 // \endverbatim
13 
14 #include <vnl/vnl_cost_function.h>
15 #include <vnl/algo/vnl_algo_export.h>
16 
17 //: Given initial values a and b, find bracket a<b<c s.t. f(a)>f(b)<f(c)
18 //  Final function values at a,b,c stored in fa,fb,fc.
19 //
20 //  The algorithm takes increasingly large steps in a downhill direction
21 //  until it starts going up again.  To speed things up, it also fits
22 //  a parabola to the last three points, which it uses to predict the
23 //  possible minimum directly ( hopefully automatically choosing a
24 //  sensible step size).
25 //
26 //  Note that there's currently nothing
27 //  to stop it if it is supplied with a monotonic function - it will just continue
28 //  forever.
29 void VNL_ALGO_EXPORT vnl_bracket_minimum(vnl_cost_function& f,
30                          double& a, double& b, double& c,
31                          double& fa, double& fb, double& fc);
32 
33 #endif // vnl_bracket_minimum_h_
34