]> granicus.if.org Git - liblinear/commitdiff
in solve_l1r_l2_svc, loss_old is initialized in a for loop over num_linesearch
authorChih-Jen Lin <cjlin@csie.ntu.edu.tw>
Tue, 18 Dec 2018 12:41:46 +0000 (20:41 +0800)
committerChih-Jen Lin <cjlin@csie.ntu.edu.tw>
Tue, 18 Dec 2018 12:41:46 +0000 (20:41 +0800)
by
if(num_linesearch == 0)
Some compiler think it's not initialized.. Hence this change add loss_old = 0 when it's declared.

linear.cpp

index d92b1248190976ae18fccdf086cc2f8cb89e69a3..151029f5bb585a32c7710b7927460e31d8b3e677 100644 (file)
@@ -1400,7 +1400,7 @@ static void solve_l1r_l2_svc(
        double Gmax_new, Gnorm1_new;
        double Gnorm1_init = -1.0; // Gnorm1_init is initialized at the first iteration
        double d_old, d_diff;
-       double loss_old, loss_new;
+       double loss_old = 0, loss_new;
        double appxcond, cond;
 
        int *index = new int[w_size];