From: John Darrington Date: Mon, 31 Dec 2012 10:33:38 +0000 (+0100) Subject: Remove assertions which compare the sum of weights between passes. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=97f2fd8ca9f4a977ed055e145eb722a52e0e6cc7;p=pspp Remove assertions which compare the sum of weights between passes. 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. --- diff --git a/src/math/moments.c b/src/math/moments.c index 83cbbe4ca1..40180f7b7e 100644 --- a/src/math/moments.c +++ b/src/math/moments.c @@ -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.) { diff --git a/src/math/percentiles.c b/src/math/percentiles.c index 2063dd2c65..9055279b5a 100644 --- a/src/math/percentiles.c +++ b/src/math/percentiles.c @@ -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; diff --git a/src/math/trimmed-mean.c b/src/math/trimmed-mean.c index b985125295..2d44d0dc08 100644 --- a/src/math/trimmed-mean.c +++ b/src/math/trimmed-mean.c @@ -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