-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstats_utils.h
72 lines (56 loc) · 2.62 KB
/
stats_utils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
Copyright (C) 2013
Fabien Gaud <[email protected]>, Baptiste Lepers <[email protected]>,
Fabien Mottet <[email protected]>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
version 2 or later, as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __STATS_UTILS_H__
#define __STATS_UTILS_H__
#include <math.h> //for sqrt and pow
/**********************************************************************
*
* This file contains tools to easilly handle statitic computation
* There are two kinds of functions:
* -The ones that maipulates a struct which contains samples.
* -Basic functions which compte on a table of values
*
**********************************************************************/
/***********************stats_sample_Lf_t functions****************************/
/**
* This structure is used by the programmer to store values
* It must be initialized with init_stats_sample_Lf.
*/
typedef struct{
long double * s;
unsigned long nb_elem;
unsigned long size_max;
char * name;
}stats_sample_Lf_t;
void init_stats_sample_Lf(stats_sample_Lf_t * sample, int size_max, char * name);
void destroy_stats_sample_Lf(stats_sample_Lf_t * sample);
void insert_Lf(stats_sample_Lf_t *sample, long double val);
void dump_Lf(stats_sample_Lf_t *sample);
long double average_Lf(stats_sample_Lf_t *sample);
long double average_multiple_Lf(stats_sample_Lf_t **sample, unsigned int nb_tabs);
long double stddev_Lf(stats_sample_Lf_t *sample);
long double interval_average_Lf(stats_sample_Lf_t *sample, int percent);
long double interval_stddev_Lf(stats_sample_Lf_t *sample, int percent);
long double percentil_average_Lf(stats_sample_Lf_t *sample, int percentil);
long double percentil_stddev_Lf(stats_sample_Lf_t *sample, int percentil);
long double min_Lf(stats_sample_Lf_t *sample);
long double max_Lf(stats_sample_Lf_t *sample);
/***********************Table functions****************************/
double t_average_f(double *table,int n);
double t_average_ul(unsigned long *table,int n);
unsigned long t_minSearch_ul(unsigned long *table,int n);
unsigned long t_maxSearch_ul(unsigned long *table,int n);
#endif //__STATS_UTILS_H__