variable.h 696 Bytes
Newer Older
1
#ifndef __VARIABLE_H__
2
#define __VARIABLE_H__
3 4 5 6 7 8 9 10

typedef struct
{
  double weight;
  double sum;
  double sum2;
} Variable;

11
#define VARIABLE_INIT { 0.0, 0.0, 0.0 }
12

13
void   variable_init               (Variable *variable);
14 15 16 17 18 19 20 21 22
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);

23
#endif /* __VARIABLE_H__ */
24