summaryrefslogtreecommitdiff
path: root/tests/variable.h
blob: 72466897dfae9e3a9c041405b311982a0abcaa02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#ifndef __VARIABLE_H__
#define __VARAIBLE_H__

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

#define VARIABLE_INIT { 0.0, 0.0, 0.0 }

void   variable_init               (Variable *variable);
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);

#endif /* __VARIABLE_H__ */