00001 // This is core/vnl/vnl_least_squares_cost_function.h 00002 #ifndef vnl_least_squares_cost_function_h_ 00003 #define vnl_least_squares_cost_function_h_ 00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE 00005 #pragma interface 00006 #endif 00007 //: 00008 // \file 00009 // \brief vnl_least_squares_function -> vnl_cost_function adaptor 00010 // \author Andrew W. Fitzgibbon, Oxford RRG 00011 // \date 20 Aug 99 00012 // 00013 // \verbatim 00014 // Modifications 00015 // 990820 AWF Initial version. 00016 // LSB (Manchester) 23/3/01 Tidied documentation 00017 // \endverbatim 00018 // 00019 //----------------------------------------------------------------------------- 00020 00021 #include <vnl/vnl_cost_function.h> 00022 #include <vnl/vnl_least_squares_function.h> 00023 00024 //: An adaptor that converts a vnl_least_squares_function to a vnl_cost_function 00025 class vnl_least_squares_cost_function : public vnl_cost_function 00026 { 00027 public: 00028 vnl_least_squares_cost_function(vnl_least_squares_function* f); 00029 00030 double f(const vnl_vector<double>& x); 00031 00032 virtual void gradf(const vnl_vector<double>& x, vnl_vector<double>& gradient); 00033 00034 protected: 00035 vnl_vector<double> storage_; 00036 vnl_matrix<double> jacobian_; 00037 vnl_least_squares_function* f_; 00038 }; 00039 00040 #endif // vnl_least_squares_cost_function_h_