00001 // This is core/vnl/algo/vnl_brent.h 00002 #ifndef vnl_brent_h_ 00003 #define vnl_brent_h_ 00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE 00005 #pragma interface 00006 #endif 00007 //: 00008 // \file 00009 // \author awf@robots.ox.ac.uk 00010 // \date 07 Dec 00 00011 // 00012 // \verbatim 00013 // Modifications 00014 // 31 May 2001 Ian Scott (Manchester). Added some documentation 00015 // 31 May 2001 Ian Scott (Manchester). Added minimize_given_bounds_and_1st_f 00016 // \endverbatim 00017 00018 #include <vnl/vnl_cost_function.h> 00019 #include <vnl/algo/vnl_brent_minimizer.h> 00020 00021 //: Brent 1D minimizer (deprecated) 00022 // 00023 // Please use vnl_brent_minimizer instead. 00024 // 00025 // This routine used to contain copyrighted code, and is deprecated. 00026 // It is now simply a wrapper around vnl_brent_minimizer. 00027 class vnl_brent : public vnl_brent_minimizer 00028 { 00029 public: 00030 vnl_brent(vnl_cost_function* functor); 00031 ~vnl_brent(); 00032 00033 //: Find a minimum of f(x) near to ax. 00034 double minimize(double ax); 00035 00036 //: Find the minimum value of f(x) within a<= x <= c. 00037 // The minimum value is the return value, and *xmin the relevant value of x. 00038 // You need to provide a bracket for the minimum 00039 // Also returns fa = f(a), etc. 00040 double minimize_given_bounds(double ax, double bx, double cx, 00041 double tol, 00042 double *xmin); 00043 00044 //: Save time over minimize_given_bounds() if you know f(b) 00045 // This function avoids a single computation of f, if you already know 00046 // it. 00047 double minimize_given_bounds_and_1st_f(double ax, double bx, double fb, 00048 double cx, double tol, double *xmin); 00049 00050 //: Given distinct points ax, and bx, find a bracket for the minimum. 00051 // Return a bracket ax > bx > cx, f(b) < f(a), f(b) < f(c) for minimum. 00052 // Also returns fa = f(a), etc. 00053 // 00054 // You should probably use vnl_bracket_minimum instead of this function. 00055 void bracket_minimum(double *ax, double *bx, double *cx, 00056 double *fa, double *fb, double *fc); 00057 00058 //: Given distinct points ax, and bx, find a bracket for the minimum. 00059 // Return a bracket ax > bx > cx, f(b) < f(a), f(b) < f(c) for minimum. 00060 // 00061 // You should probably use vnl_bracket_minimum instead of this function. 00062 void bracket_minimum(double *ax, double *bx, double *cx); 00063 }; 00064 00065 #endif // vnl_brent_h_