X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fmath%2Flevene.c;h=13fad93e52107ebe5a16ca826fbbedb06dbf8928;hb=81579d9e9f994fb2908f50af41c3eb033d216e58;hp=b92441b37babbf8505a931176aa00e1fd1ab7f89;hpb=889a94b673edadc571a0d0f3763e304f573ff2ec;p=pspp-builds.git diff --git a/src/math/levene.c b/src/math/levene.c index b92441b3..13fad93e 100644 --- a/src/math/levene.c +++ b/src/math/levene.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2010 Free Software Foundation, Inc. + Copyright (C) 2010, 2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,18 +16,15 @@ #include -#include "levene.h" +#include "math/levene.h" #include -#include - -#include -#include -#include - - -#include +#include "data/case.h" +#include "data/casereader.h" +#include "data/variable.h" +#include "libpspp/hmap.h" +#include "libpspp/misc.h" struct lev { @@ -113,6 +110,7 @@ levene (struct casereader *rx, const struct variable *gvar, r = casereader_clone (rx); for (; (c = casereader_read (r)) != NULL; case_unref (c)) { + struct lev *l = NULL; const union value *target = case_data (c, gvar); int width = var_get_width (gvar); const double x = case_data (c, var)->f; @@ -121,8 +119,7 @@ levene (struct casereader *rx, const struct variable *gvar, if (var_is_value_missing (var, case_data (c, var), exclude)) continue; - struct lev *l = find_group (&map, target, width); - + l = find_group (&map, target, width); assert (l); l->z_mean += fabs (x - l->t_bar) * weight; @@ -144,6 +141,7 @@ levene (struct casereader *rx, const struct variable *gvar, for (; (c = casereader_read (r)) != NULL; case_unref (c)) { double z; + struct lev *l; const union value *target = case_data (c, gvar); int width = var_get_width (gvar); const double x = case_data (c, var)->f; @@ -152,10 +150,10 @@ levene (struct casereader *rx, const struct variable *gvar, if (var_is_value_missing (var, case_data (c, var), exclude)) continue; - struct lev *l = find_group (&map, target, width); + l = find_group (&map, target, width); assert (l); - z = fabs (x - l->t_bar); + z = fabs (x - l->t_bar); denominator += pow2 (z - l->z_mean) * weight; } casereader_destroy (r); @@ -164,7 +162,7 @@ levene (struct casereader *rx, const struct variable *gvar, { double grand_n = 0.0; - struct hmap_node *next; + struct lev *next; struct lev *l; HMAP_FOR_EACH_SAFE (l, next, struct lev, node, &map) {