removed uneccessary cast to pspp_linreg_cache
[pspp-builds.git] / src / math / linreg / predict.c
index 0bab23c8cd89f0b9bcd66ac6fb1cf69cbce72a7b..6ac7167c8d636583024430e62b5b97ab5bcc1a08 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,7 +87,7 @@ 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)
 {
   double pred;
   double result;