moved call to subcommand_save outside multipass_procedure_with_splits
[pspp] / src / math / linreg / predict.c
index 0bab23c8cd89f0b9bcd66ac6fb1cf69cbce72a7b..34e709c82782e039a4c2d6f19b218fda21c64f52 100644 (file)
@@ -31,8 +31,9 @@
 double
 pspp_linreg_predict (const struct variable **predictors,
                     const union value **vals,
-                    const pspp_linreg_cache * c, int n_vals)
+                    const void *c_, int n_vals)
 {
+  const pspp_linreg_cache *c = c_;
   int i;
   int j;
   const struct pspp_linreg_coeff **found;
@@ -62,7 +63,7 @@ pspp_linreg_predict (const struct variable **predictors,
     {
       coe = pspp_linreg_get_coeff (c, predictors[j], vals[j]);
       i = 1;
-      while (found[i] != coe && i < c->n_coeffs)
+      while (found[i] == coe && i < c->n_coeffs)
        {
          i++;
        }
@@ -86,8 +87,9 @@ double
 pspp_linreg_residual (const struct variable **predictors,
                      const union value **vals,
                      const union value *obs,
-                     const pspp_linreg_cache * c, int n_vals)
+                     const void *c_, int n_vals)
 {
+  const pspp_linreg_cache *c = c_;
   double pred;
   double result;