]> granicus.if.org Git - liblinear/commitdiff
move l2r_lr_fun::get_diagH(double *M) to an earlier place to be consistent
authorChih-Jen Lin <cjlin@csie.ntu.edu.tw>
Sun, 24 Dec 2017 01:52:27 +0000 (09:52 +0800)
committerChih-Jen Lin <cjlin@csie.ntu.edu.tw>
Sun, 24 Dec 2017 01:52:27 +0000 (09:52 +0800)
with l2r_l2_svc_fun::get_diagH(double *M)

linear.cpp

index 9b49892a14dca61773982bd061d14cccc41aad14..746192b8c4a4c6247746664bb2a78146e6a8ae49 100644 (file)
@@ -170,6 +170,27 @@ int l2r_lr_fun::get_nr_variable(void)
        return prob->n;
 }
 
+void l2r_lr_fun::get_diagH(double *M)
+{
+       int i;
+       int l = prob->l;
+       int w_size=get_nr_variable();
+       feature_node **x = prob->x;
+
+       for (i=0; i<w_size; i++)
+               M[i] = 1;
+
+       for (i=0; i<l; i++)
+       {
+               feature_node *s = x[i];
+               while (s->index!=-1)
+               {
+                       M[s->index-1] += s->value*s->value*C[i]*D[i];
+                       s++;
+               }
+       }
+}
+
 void l2r_lr_fun::Hv(double *s, double *Hs)
 {
        int i;
@@ -192,27 +213,6 @@ void l2r_lr_fun::Hv(double *s, double *Hs)
                Hs[i] = s[i] + Hs[i];
 }
 
-void l2r_lr_fun::get_diagH(double *M)
-{
-       int i;
-       int l = prob->l;
-       int w_size=get_nr_variable();
-       feature_node **x = prob->x;
-
-       for (i=0; i<w_size; i++)
-               M[i] = 1;
-
-       for (i=0; i<l; i++)
-       {
-               feature_node *s = x[i];
-               while (s->index!=-1)
-               {
-                       M[s->index-1] += s->value*s->value*C[i]*D[i];
-                       s++;
-               }
-       }
-}
-
 void l2r_lr_fun::Xv(double *v, double *Xv)
 {
        int i;