Tron.h

Go to the documentation of this file.
00001 #ifndef _CTron_H
00002 #define _CTron_H
00003 
00004 #include "lib/config.h"
00005 
00006 #ifdef HAVE_LAPACK
00007 #include "base/SGObject.h"
00008 
00010 class function
00011 {
00012 public:
00020     virtual float64_t fun(float64_t *w) = 0 ;
00021 
00029     virtual void grad(float64_t *w, float64_t *g) = 0 ;
00030 
00038     virtual void Hv(float64_t *s, float64_t *Hs) = 0 ;
00039 
00046     virtual int32_t get_nr_variable(void) = 0 ;
00047 
00048     virtual ~function(void){}
00049 };
00050 
00052 class CTron : public CSGObject
00053 {
00054 public:
00061     CTron(
00062         const function *fun_obj, float64_t eps = 0.1, int32_t max_iter = 1000);
00063     ~CTron();
00064 
00069     void tron(float64_t *w);
00070 
00071 private:
00072     int32_t trcg(float64_t delta, double* g, double* s, double* r);
00073     float64_t norm_inf(int32_t n, float64_t *x);
00074 
00075     float64_t eps;
00076     int32_t max_iter;
00077     function *fun_obj;
00078 };
00079 
00080 #endif
00081 #endif //HAVE_LAPACK

SHOGUN Machine Learning Toolbox - Documentation