00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef STATISTC_H
00021 #define STATISTC_H
00022
00023 #include <stdio.h>
00024 #include "scrollview.h"
00025 #include "host.h"
00026
00027 class DLLSYM STATS
00028 {
00029 inT32 rangemin;
00030 inT32 rangemax;
00031 inT32 total_count;
00032 inT32 *buckets;
00033
00034 public:
00035 STATS(
00036 inT32 min,
00037 inT32 max);
00038 STATS();
00039
00040 ~STATS ();
00041
00042 bool set_range(
00043 inT32 min,
00044 inT32 max);
00045
00046 void clear();
00047
00048 void add(
00049 inT32 value,
00050 inT32 count);
00051
00052 inT32 mode();
00053
00054 float mean();
00055
00056 float sd();
00057
00058 float ile(
00059 float frac);
00060
00061 inT32 min_bucket();
00062
00063 inT32 max_bucket();
00064
00065 float median();
00066
00067 void smooth(
00068 inT32 factor);
00069 inT32 cluster(
00070 float lower,
00071 float upper,
00072 float multiple,
00073 inT32 max_clusters,
00074 STATS *clusters);
00075
00076 inT32 pile_count(
00077 inT32 value
00078 ) {
00079 return value > rangemin ? (value < rangemax
00080 ? buckets[value -
00081 rangemin] : buckets[rangemax -
00082 rangemin -
00083 1]) : buckets[0];
00084 }
00085
00086 inT32 get_total() {
00087 return total_count;
00088 }
00089
00090 BOOL8 local_min(
00091 inT32 x);
00092
00093 void print(
00094 FILE *fp,
00095 BOOL8 dump);
00096
00097 void short_print(
00098 FILE *fp,
00099 BOOL8 dump);
00100
00101 void plot(
00102 ScrollView* window,
00103 float xorigin,
00104 float yorigin,
00105 float xscale,
00106 float yscale,
00107 ScrollView::Color colour);
00108
00109 void plotline(
00110 ScrollView* window,
00111 float xorigin,
00112 float yorigin,
00113 float xscale,
00114 float yscale,
00115 ScrollView::Color colour);
00116 };
00117 DLLSYM inT32 choose_nth_item(
00118 inT32 index,
00119 float *array,
00120 inT32 count
00121 );
00122 DLLSYM inT32 choose_nth_item (
00123 inT32 index,
00124 void *array,
00125 inT32 count,
00126 size_t size,
00127
00128 int (*compar) (const void *, const void *)
00129 );
00130 void swap_entries(
00131 void *array,
00132 size_t size,
00133 inT32 index1,
00134 inT32 index2);
00135 #endif