Crossings Minimization  1.0
Statistics.h
Go to the documentation of this file.
1 /**
2  * @file Statistics.h
3  * @brief
4  * Interface for a Statistics class with methods for computing min, median,
5  * mean, max, and standard deviation.
6  *
7  * @author Matt Stallmann
8  * @date 2009/05/18
9  *
10  * Migrate changes back to C-Utilities
11  */
12 
13 #ifndef STATISTICS_H
14 #define STATISTICS_H
15 
16 #include <stdio.h>
17 
18 typedef struct statistics_struct {
21  double sum;
22  double * data;
23 } * Statistics;
24 
25 /**
26  * @param size the maximum number of data items
27  * @return a new instance of the class
28  * @todo allow for unlimited capacity
29  */
30 Statistics init_statistics( int size );
31 
32 double get_min( Statistics s );
33 double get_median( Statistics s );
34 double get_mean( Statistics s );
35 double get_max( Statistics s );
38 void add_data( Statistics s, double data_point );
39 
40 /**
41  * Prints statistics in the form (tab separated items)
42  * min median mean max stdev N
43  * @param format the printf format to use for each statistic, e.g. "%5.2f"
44  */
45 void print_statistics( Statistics s, FILE * output_stream, const char * format );
46 
47 /**
48  * deallocates data structures for s
49  */
50 void free_statistics( Statistics s );
51 
52 #endif
53 
54 // [Last modified: 2011 06 02 at 21:41:49 GMT]
Statistics init_statistics(int size)
Definition: Statistics.c:26
void print_statistics(Statistics s, FILE *output_stream, const char *format)
Definition: Statistics.c:127
void free_statistics(Statistics s)
Definition: Statistics.c:142
int get_number_of_data_points(Statistics s)
Definition: Statistics.c:75
double get_mean(Statistics s)
Definition: Statistics.c:61
struct statistics_struct * Statistics
void add_data(Statistics s, double data_point)
Definition: Statistics.c:111
int number_of_data_points
Definition: Statistics.h:20
double get_median(Statistics s)
Definition: Statistics.c:44
double get_standard_deviation(Statistics s)
Definition: Statistics.c:65
double get_min(Statistics s)
Definition: Statistics.c:42
double get_max(Statistics s)
Definition: Statistics.c:63