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