00001 #ifndef rrel_wls_obj_h_ 00002 #define rrel_wls_obj_h_ 00003 00004 //: 00005 // \file 00006 // \author Amitha Perera (perera@cs.rpi.edu) 00007 // Abstract base class for objective functions that can be used with 00008 // IRLS-type searches. 00009 00010 #include <rrel/rrel_objective.h> 00011 00012 //: Abstract base class for objective functions that can compute weights. 00013 // This class of objective functions, in addition to providing a 00014 // "cost" for the estimate, can provide a weight for each 00015 // residual. The weights are used by some search techniques, such as 00016 // IRLS. Most commonly used M-estimator objective functions can 00017 // provide a weights, and hence will be a descendant of this 00018 // class. (See Stewart, "Robust Parameter Estimation in Computer 00019 // Vision", SIAM Reviews 41, Sept 1999.) 00020 00021 class rrel_wls_obj : public rrel_objective { 00022 public: 00023 //: Constructor. 00024 rrel_wls_obj() {} 00025 00026 //: Destructor. 00027 virtual ~rrel_wls_obj() {} 00028 00029 //: Evaluate the objective function on heteroscedastic residuals. 00030 // This version is used for heteroscedastic data, where each 00031 // residual has its own scale. The number of scale values must, of 00032 // course, equal the number of residuals. 00033 // 00034 // The weights (one per residual) are returned using \a wgt_begin, 00035 // which should point to an appropriately sized container. 00036 virtual void wgt( vect_const_iter res_begin, vect_const_iter res_end, 00037 vect_const_iter scale_begin, 00038 vect_iter wgt_begin ) const = 0; 00039 00040 //: Computes the weights for homoscedastic residuals. 00041 // This version is used for homoscedastic data, where each residual 00042 // is distributed with a common scale. (See also the comments in 00043 // rrel_objective::fcn.) 00044 // 00045 // The weights (one per residual) are returned using \a wgt_begin, 00046 // which should point to an appropriately sized container. 00047 virtual void wgt( vect_const_iter begin, vect_const_iter end, 00048 double scale, 00049 vect_iter wgt_begin ) const = 0; 00050 00051 //: The weight of the residual. 00052 // \a u is a normalised residual (i.e. u=r/scale). wgt(u) is 00053 // normally \f$ (1/u) (\partial{\rho} / \partial{u}) \f$. 00054 virtual double wgt( double u ) const = 0; 00055 }; 00056 00057 #endif // rrel_wls_obj_h_