1 // This is core/vnl/algo/vnl_brent.h
2 #ifndef vnl_brent_h_
3 #define vnl_brent_h_
4 //:
5 // \file
6 // \author awf@robots.ox.ac.uk
7 // \date   07 Dec 00
8 //
9 // \verbatim
10 //  Modifications
11 //   31 May 2001 Ian Scott (Manchester). Added some documentation
12 //   31 May 2001 Ian Scott (Manchester). Added minimize_given_bounds_and_1st_f
13 // \endverbatim
14 
15 #include <vnl/vnl_cost_function.h>
16 #include <vnl/algo/vnl_brent_minimizer.h>
17 #include <vnl/algo/vnl_algo_export.h>
18 
19 //: Brent 1D minimizer (deprecated)
20 //
21 // Please use vnl_brent_minimizer instead.
22 //
23 // This routine used to contain copyrighted code, and is deprecated.
24 // It is now simply a wrapper around vnl_brent_minimizer.
25 class VNL_ALGO_EXPORT vnl_brent : public vnl_brent_minimizer
26 {
27  public:
28   vnl_brent(vnl_cost_function* functor);
29  ~vnl_brent() override;
30 
31   //: Find a minimum of f(x) near to ax.
32   double minimize(double ax);
33 
34   //: Find the minimum value of f(x) within a<= x <= c.
35   // The minimum value is the return value, and *xmin the relevant value of x.
36   // You need to provide a bracket for the minimum
37   // Also returns fa = f(a), etc.
38   double minimize_given_bounds(double ax, double bx, double cx,
39                                double tol,
40                                double *xmin);
41 
42   //: Save time over minimize_given_bounds() if you know f(b)
43   // This function avoids a single computation of f, if you already know
44   // it.
45   double minimize_given_bounds_and_1st_f(double ax, double bx, double fb,
46                                          double cx,  double tol, double *xmin);
47 
48   //: Given distinct points ax, and bx, find a bracket for the minimum.
49   // Return a bracket ax > bx > cx, f(b) < f(a), f(b) < f(c) for minimum.
50   // Also returns fa = f(a), etc.
51   //
52   // You should probably use vnl_bracket_minimum instead of this function.
53   void bracket_minimum(double *ax, double *bx, double *cx,
54                        double *fa, double *fb, double *fc);
55 
56   //: Given distinct points ax, and bx, find a bracket for the minimum.
57   // Return a bracket ax > bx > cx, f(b) < f(a), f(b) < f(c) for minimum.
58   //
59   // You should probably use vnl_bracket_minimum instead of this function.
60   void bracket_minimum(double *ax, double *bx, double *cx);
61 };
62 
63 #endif // vnl_brent_h_
64