X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fstats%2Fruns.c;h=9ef4c64add1f601303ce894a6c2805d63293db39;hb=2c4b104df57f2e8b5ed2afa50819294aaac4aa6c;hp=f23b67867eb01deccb585ccbfa51968d814b103e;hpb=6b953e838dba6aea1d81b6736d00ae95ef7a5eec;p=pspp diff --git a/src/language/stats/runs.c b/src/language/stats/runs.c index f23b67867e..9ef4c64add 100644 --- a/src/language/stats/runs.c +++ b/src/language/stats/runs.c @@ -78,7 +78,7 @@ runs_statistic (const struct run_state *rs) z = rs->runs - mu; - if ( rs->n < 50) + if (rs->n < 50) { if (z <= -0.5) z += 0.5; @@ -116,9 +116,9 @@ runs_execute (const struct dataset *ds, struct one_sample_test *otp = UP_CAST (test, struct one_sample_test, parent); struct runs_test *rt = UP_CAST (otp, struct runs_test, parent); - struct run_state *rs = xcalloc (otp->n_vars, sizeof (*rs)); + struct run_state *rs = XCALLOC (otp->n_vars, struct run_state); - switch ( rt->cp_mode) + switch (rt->cp_mode) { case CP_MODE: { @@ -143,22 +143,22 @@ runs_execute (const struct dataset *ds, struct ccase *c; for (; (c = casereader_read (group)); case_unref (c)) { - const double w = weight ? case_data (c, weight)->f: 1.0; + const double w = weight ? case_num (c, weight) : 1.0; const union value *val = case_data (c, var); - if ( var_is_value_missing (var, val, exclude)) + if (var_is_value_missing (var, val, exclude)) continue; x = val->f; cc += w; } - if ( cc > last_cc) + if (cc > last_cc) { run->cutpoint = x; } - else if ( cc == last_cc) + else if (cc == last_cc) { multimodal = true; - if ( x > run->cutpoint) + if (x > run->cutpoint) run->cutpoint = x; } last_cc = cc; @@ -188,11 +188,11 @@ runs_execute (const struct dataset *ds, subcase_init_var (&sc, var, SC_ASCEND); writer = sort_create_writer (&sc, casereader_get_proto (reader)); - for (; (c = casereader_read (reader)); ) + for (; (c = casereader_read (reader));) { const union value *val = case_data (c, var); - const double w = weight ? case_data (c, weight)->f: 1.0; - if ( var_is_value_missing (var, val, exclude)) + const double w = weight ? case_num (c, weight) : 1.0; + if (var_is_value_missing (var, val, exclude)) { case_unref (c); continue; @@ -224,7 +224,7 @@ runs_execute (const struct dataset *ds, struct casereader *reader = casereader_clone (input); for (; (c = casereader_read (reader)); case_unref (c)) { - const double w = weight ? case_data (c, weight)->f: 1.0; + const double w = weight ? case_num (c, weight) : 1.0; for (v = 0; v < otp->n_vars; ++v) { const struct variable *var = otp->vars[v]; @@ -232,7 +232,7 @@ runs_execute (const struct dataset *ds, const double x = val->f; struct run_state *run = &rs[v]; - if ( var_is_value_missing (var, val, exclude)) + if (var_is_value_missing (var, val, exclude)) continue; run->cutpoint += x * w; @@ -260,7 +260,7 @@ runs_execute (const struct dataset *ds, for (; (c = casereader_read (input)); case_unref (c)) { - const double w = weight ? case_data (c, weight)->f: 1.0; + const double w = weight ? case_num (c, weight) : 1.0; for (v = 0; v < otp->n_vars; ++v) { @@ -271,7 +271,7 @@ runs_execute (const struct dataset *ds, double d = x - run->cutpoint; short sign = 0; - if ( var_is_value_missing (var, val, exclude)) + if (var_is_value_missing (var, val, exclude)) continue; if (d >= 0)