Remove assertions which compare the sum of weights between passes. 20130101030509/pspp
authorJohn Darrington <john@darrington.wattle.id.au>
Mon, 31 Dec 2012 10:33:38 +0000 (11:33 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Mon, 31 Dec 2012 10:33:38 +0000 (11:33 +0100)
These asserted that the sum of case-weights of a dataset calculated
in one pass, was the same as that calculated in a second pass.
Algebraically this is correct.  However, for optimisation purposes,
it is sometimes desireable that the second pass occurs after the
data has been reordered.   If that happens, the sum of weights can
be slightly different due to floating point rounding errors.  This
happens particularly when the caseweights are fractional.

src/math/moments.c
src/math/percentiles.c
src/math/trimmed-mean.c

index 83cbbe4ca1fb3e4c2d4e2a6497ed84ced68b0c31..40180f7b7ecdb461c46eaa31b42c1927835c7b66 100644 (file)
@@ -225,12 +225,8 @@ moments_calculate (const struct moments *m,
     }
   else
     {
-      /* After the second pass we can calculate any stat.  We
-         don't support "online" computation during the second
-         pass, so As a simple self-check, the total weight for
-         the passes must agree. */
+      /* After the second pass we can calculate any stat.  */
       assert (m->pass == 2);
-      assert (m->w1 == m->w2);
 
       if (m->w2 > 0.)
         {
index 2063dd2c6549a2fe3c5cc06039a4986d0a1f86c8..9055279b5afa1db5f54db6a0cb062eaf734d78bf 100644 (file)
@@ -48,8 +48,6 @@ percentile_calculate (const struct percentile *ptl, enum pc_alg alg)
   struct percentile *mutable = CONST_CAST (struct percentile *, ptl);
   const struct order_stats *os = &ptl->parent;
 
-  assert (os->cc == ptl->w);
-
   if ( ptl->g1 == SYSMIS)
     mutable->g1 = (os->k[0].tc - os->k[0].cc) / os->k[0].c_p1;
 
index b985125295f9754d1ffec7c6b751c02e08425516..2d44d0dc08cc3bba114f4ed9004c17eaf9ae6a7f 100644 (file)
@@ -81,8 +81,6 @@ trimmed_mean_calculate (const struct trimmed_mean *tm)
 {
   const struct order_stats *os = (const struct order_stats *) tm;
 
-  assert (os->cc == tm->w);
-
   return
     (
      (os->k[0].cc_p1 - os->k[0].tc) * os->k[0].y_p1