]> granicus.if.org Git - liblinear/blob - tron.h
change version number in liblinear.h to 2.30 for the new release
[liblinear] / tron.h
1 #ifndef _TRON_H
2 #define _TRON_H
3
4 class function
5 {
6 public:
7         virtual double fun(double *w) = 0 ;
8         virtual void grad(double *w, double *g) = 0 ;
9         virtual void Hv(double *s, double *Hs) = 0 ;
10
11         virtual int get_nr_variable(void) = 0 ;
12         virtual void get_diag_preconditioner(double *M) = 0 ;
13         virtual ~function(void){}
14 };
15
16 class TRON
17 {
18 public:
19         TRON(const function *fun_obj, double eps = 0.1, double eps_cg = 0.1, int max_iter = 1000);
20         ~TRON();
21
22         void tron(double *w);
23         void set_print_string(void (*i_print) (const char *buf));
24
25 private:
26         int trpcg(double delta, double *g, double *M, double *s, double *r, bool *reach_boundary);
27         double norm_inf(int n, double *x);
28
29         double eps;
30         double eps_cg;
31         int max_iter;
32         function *fun_obj;
33         void info(const char *fmt,...);
34         void (*tron_print_string)(const char *buf);
35 };
36 #endif