X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fmoments.h;h=791e9c546916535e6b6d2b77fc029459cf231161;hb=fa33e52b61bc3cb1018ad2759880f5ecaf65653e;hp=e48bfd5ec6f7930089cef29042a3f00b79ccb1cb;hpb=b9e28aa5614a079548c616bcf97aa804024ad647;p=pspp-builds.git diff --git a/src/moments.h b/src/moments.h index e48bfd5e..791e9c54 100644 --- a/src/moments.h +++ b/src/moments.h @@ -36,6 +36,7 @@ enum moment struct moments; +/* Two-pass moments. */ struct moments *moments_create (enum moment max_moment); void moments_clear (struct moments *); void moments_pass_one (struct moments *, double value, double weight); @@ -46,6 +47,7 @@ void moments_calculate (const struct moments *, double *skewness, double *kurtosis); void moments_destroy (struct moments *); +/* Convenience functions for two-pass moments. */ void moments_of_doubles (const double *array, size_t cnt, double *weight, double *mean, double *variance, @@ -55,6 +57,18 @@ void moments_of_values (const union value *array, size_t cnt, double *mean, double *variance, double *skewness, double *kurtosis); +/* One-pass moments. Use only if two passes are impractical. */ +struct moments1 *moments1_create (enum moment max_moment); +void moments1_clear (struct moments1 *); +void moments1_add (struct moments1 *, double value, double weight); +void moments1_calculate (const struct moments1 *, + double *weight, + double *mean, double *variance, + double *skewness, double *kurtosis); +void moments1_destroy (struct moments1 *); + +/* Standard errors. */ +double calc_semean (double stddev, double weight); double calc_seskew (double weight); double calc_sekurt (double weight);