fixed update of moments
[pspp-builds.git] / src / math / covariance-matrix.c
index fb67a64cf1a2205b9dfd5bc9a60d2dcb463f9cb2..b6411fb3d78262e2450f3cbbdd1bccd1844f9184 100644 (file)
@@ -26,6 +26,7 @@
 #include <libpspp/hash.h>
 #include <libpspp/hash-functions.h>
 #include <math/covariance-matrix.h>
+#include <math/interaction.h>
 #include <math/moments.h>
 #include <string.h>
 #include <xalloc.h>
@@ -227,7 +228,7 @@ column_iterate (struct design_matrix *cov, const struct variable *v,
       col += i;
       y = -1.0 * cat_get_category_count (i, v) / ssize;
       tmp_val = cat_subscript_to_value (i, v);
-      if (compare_values (tmp_val, val1, v))
+      if (compare_values_short (tmp_val, val1, v))
        {
          y += -1.0;
        }
@@ -262,7 +263,7 @@ covariance_pass_two (struct design_matrix *cov, double mean1, double mean2,
          row += i;
          x = -1.0 * cat_get_category_count (i, v1) / ssize;
          tmp_val = cat_subscript_to_value (i, v1);
-         if (compare_values (tmp_val, val1, v1))
+         if (compare_values_short (tmp_val, val1, v1))
            {
              x += 1.0;
            }
@@ -399,23 +400,23 @@ match_nodes (const struct covariance_accumulator *c,
          }
        if (var_is_numeric (v1) && var_is_alpha (v2))
          {
-           if (compare_values (val2, c->val2, v2))
+           if (compare_values_short (val2, c->val2, v2))
              {
                return 0;
              }
          }
        if (var_is_alpha (v1) && var_is_numeric (v2))
          {
-           if (compare_values (val1, c->val1, v1))
+           if (compare_values_short (val1, c->val1, v1))
              {
                return 0;
              }
          }
        if (var_is_alpha (v1) && var_is_alpha (v2))
          {
-           if (compare_values (val1, c->val1, v1))
+           if (compare_values_short (val1, c->val1, v1))
              {
-               if (compare_values (val2, c->val2, v2))
+               if (compare_values_short (val2, c->val2, v2))
                  {
                    return 0;
                  }
@@ -588,7 +589,7 @@ covariance_accumulate_pairwise (struct covariance_matrix *cov,
       if (!var_is_value_missing (v_variables[i], val1, cov->missing_value))
        {
          cat_value_update (v_variables[i], val1);
-         if (var_is_alpha (v_variables[i]))
+         if (var_is_numeric (v_variables[i]))
            cov->update_moments (cov, i, val1->f);
 
          for (j = i; j < cov->n_variables; j++)
@@ -643,7 +644,7 @@ covariance_accumulate_listwise (struct covariance_matrix *cov,
     {
       val1 = case_data (ccase, v_variables[i]);
       cat_value_update (v_variables[i], val1);
-      if (var_is_alpha (v_variables[i]))
+      if (var_is_numeric (v_variables[i]))
        cov->update_moments (cov, i, val1->f);
 
       for (j = i; j < cov->n_variables; j++)
@@ -689,7 +690,7 @@ covariance_matrix_insert (struct design_matrix *cov,
     {
       i = 0;
       tmp_val = cat_subscript_to_value (i, v1);
-      while (!compare_values (tmp_val, val1, v1))
+      while (!compare_values_short (tmp_val, val1, v1))
        {
          i++;
          tmp_val = cat_subscript_to_value (i, v1);
@@ -704,7 +705,7 @@ covariance_matrix_insert (struct design_matrix *cov,
          col = design_matrix_var_to_column (cov, v2);
          i = 0;
          tmp_val = cat_subscript_to_value (i, v1);
-         while (!compare_values (tmp_val, val1, v1))
+         while (!compare_values_short (tmp_val, val1, v1))
            {
              i++;
              tmp_val = cat_subscript_to_value (i, v1);