X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fmath%2Fpercentiles.h;fp=src%2Fmath%2Fpercentiles.h;h=c79a629fe3623de7b531186ec6ef09dec6e9d329;hb=feb269112e14589474c0a75e96cd5a892d9aaeef;hp=86fd641addd46d5e6c3c955e547421a04649cf65;hpb=922dfe227e0a157f895c025b8f8590e2bfc59f23;p=pspp diff --git a/src/math/percentiles.h b/src/math/percentiles.h index 86fd641add..c79a629fe3 100644 --- a/src/math/percentiles.h +++ b/src/math/percentiles.h @@ -21,6 +21,16 @@ #include "order-stats.h" +/* To calculate a percentile: + + - Create a "struct percentile" with percentile_create(). + - Feed in the data with order_stats_accumulate() or + order_stats_accumulate_idx(). The data must be in sorted order: if + necessary, use one of the sorting functions from sort.h to sort them. + - Obtain the percentile with percentile_calculate(). + - Destroy the data structure with statistic_destroy(). +*/ + /* The algorithm used to calculate percentiles */ enum pc_alg { PC_NONE=0, @@ -48,15 +58,7 @@ struct percentile struct k k[2]; }; -/* Create the Pth percentile. - W is the total sum of weights in the data set -*/ struct percentile *percentile_create (double p, double W); +double percentile_calculate (const struct percentile *, enum pc_alg); -/* Return the value of the percentile */ -double percentile_calculate (const struct percentile *ptl, enum pc_alg alg); - -void percentile_dump (const struct percentile *ptl); - - -#endif +#endif /* percentiles.h */