2012-11-14 22:54:03 +00:00
|
|
|
#ifndef __VARIABLE_H__
|
2014-12-09 00:34:23 +00:00
|
|
|
#define __VARIABLE_H__
|
2012-11-14 22:54:03 +00:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
double weight;
|
|
|
|
double sum;
|
|
|
|
double sum2;
|
|
|
|
} Variable;
|
|
|
|
|
2013-04-21 22:31:36 +00:00
|
|
|
#define VARIABLE_INIT { 0.0, 0.0, 0.0 }
|
2012-11-14 22:54:03 +00:00
|
|
|
|
2013-04-21 22:31:36 +00:00
|
|
|
void variable_init (Variable *variable);
|
2012-11-14 22:54:03 +00:00
|
|
|
void variable_add_weighted (Variable *variable,
|
|
|
|
double value,
|
|
|
|
double weight);
|
|
|
|
void variable_add (Variable *variable,
|
|
|
|
double value);
|
|
|
|
double variable_mean (Variable *variable);
|
|
|
|
double variable_standard_deviation (Variable *variable);
|
|
|
|
void variable_reset (Variable *variable);
|
|
|
|
|
2013-04-21 22:31:36 +00:00
|
|
|
#endif /* __VARIABLE_H__ */
|
2012-11-14 22:54:03 +00:00
|
|
|
|