X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fmath%2Flevene.c;h=5785623a6ab0fd519d2a7d8105833f2528c71b8d;hb=8b069a8dd30582d725034ba78922d919b242236a;hp=5193c86a1a453f001456ecc7f747870cf346548b;hpb=d0dc2e01dc5f60df296c657b7ceeaf0f3624cfb9;p=pspp diff --git a/src/math/levene.c b/src/math/levene.c index 5193c86a1a..5785623a6a 100644 --- a/src/math/levene.c +++ b/src/math/levene.c @@ -45,7 +45,7 @@ struct levene /* Width of the categorical variable */ int gvw ; - /* The value deviding the the groups. Valid only for dichotomous categorical variable.*/ + /* The value dividing the groups. Valid only for dichotomous categorical variable.*/ const union value *cutpoint; @@ -93,10 +93,10 @@ cutpoint_cmp (const struct levene *nl, const union value *val0, const union valu int y = value_compare_3way (val1, nl->cutpoint, nl->gvw); - if ( x == 0) x = 1; - if ( y == 0) y = 1; + if (x == 0) x = 1; + if (y == 0) y = 1; - return ( x == y); + return (x == y); } @@ -110,7 +110,6 @@ find_group (const struct levene *nl, const union value *target) { if (nl->cmp (nl, &l->group, target)) break; - l = NULL; } return l; } @@ -134,18 +133,18 @@ levene_create (int indep_width, const union value *cutpoint) /* Data accumulation. First pass */ -void +void levene_pass_one (struct levene *nl, double value, double weight, const union value *gv) { struct lev *lev = find_group (nl, gv); - if ( nl->pass == 0 ) + if (nl->pass == 0) { nl->pass = 1; } assert (nl->pass == 1); - if ( NULL == lev) + if (NULL == lev) { struct lev *l = xzalloc (sizeof *l); value_clone (&l->group, gv, nl->gvw); @@ -160,12 +159,12 @@ levene_pass_one (struct levene *nl, double value, double weight, const union val } /* Data accumulation. Second pass */ -void +void levene_pass_two (struct levene *nl, double value, double weight, const union value *gv) { struct lev *lev = NULL; - if ( nl->pass == 1 ) + if (nl->pass == 1) { struct lev *next; struct lev *l; @@ -186,13 +185,13 @@ levene_pass_two (struct levene *nl, double value, double weight, const union val } /* Data accumulation. Third pass */ -void +void levene_pass_three (struct levene *nl, double value, double weight, const union value *gv) { double z; struct lev *lev = NULL; - if ( nl->pass == 2 ) + if (nl->pass == 2) { struct lev *next; struct lev *l; @@ -232,7 +231,7 @@ levene_calculate (struct levene *nl) */ assert (nl->pass == 0 || nl->pass == 3); - if ( nl->pass == 0 ) + if (nl->pass == 0) return SYSMIS; nl->denominator *= hmap_count (&nl->hmap) - 1; @@ -244,7 +243,7 @@ levene_calculate (struct levene *nl) } numerator *= nn - hmap_count (&nl->hmap); - + return numerator / nl->denominator; }