fixed counting of valid cases in fill_covariance
[pspp-builds.git] / src / language / stats / regression.q
index abb3bd353aebea6814d55c7b7c00ab0be926f95a..2b31158d5418c8009f2fbab38fad2c75dd216af3 100644 (file)
@@ -821,22 +821,17 @@ fill_covariance (gsl_matrix *cov, struct covariance *all_cov,
   
   for (i = 0; i < n_all_vars; i++)
     {
-      for (j = k; j < n_vars; j++)
+      for (j = 0; j < n_vars; j++)
        {
          if (vars[j] == all_vars[i])
            {
-             if (vars[j] != dep_var)
-               {
-                 rows[j] = i;
-               }
-             else
-               {
-                 dep_subscript = i;
-               }
-             k++;
-             break;
+             rows[j] = i;
            }
        }
+      if (all_vars[i] == dep_var)
+       {
+         dep_subscript = i;
+       }
     }
   for (i = 0; i < cov->size1 - 1; i++)
     {