math: Improve comments.
[pspp] / src / math / percentiles.h
index 0dd09820945e1bafaee5a017ba3756cb4197783b..c79a629fe3623de7b531186ec6ef09dec6e9d329 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPP - a program for statistical analysis.
-   Copyright (C) 2004, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2008, 2009 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
 
 #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,
@@ -31,9 +41,6 @@ enum pc_alg {
   PC_AEMPIRICAL
 } ;
 
-extern  const char *const ptile_alg_desc[];
-
-
 struct percentile
 {
   struct order_stats parent;
@@ -47,17 +54,11 @@ struct percentile
 
   double g2;
   double g2_star;
-};
-
-/* Create the Pth percentile.
-   W is the total sum of weights in the data set
-*/
-struct order_stats *percentile_create (double p, double W);
 
-/* Return the value of the percentile */
-double percentile_calculate (const struct percentile *ptl, enum pc_alg alg);
-
-void percentile_dump (const struct percentile *ptl);
+  struct k k[2];
+};
 
+struct percentile *percentile_create (double p, double W);
+double percentile_calculate (const struct percentile *, enum pc_alg);
 
-#endif
+#endif  /* percentiles.h */