summaryrefslogtreecommitdiff
path: root/lib/measurement.h
blob: 78fa51b85a79c6c3b7bb0158ba4e349123f80e94 (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

#pragma once

#include <math.h>
#include <stdlib.h>

#include "types.h"
#include "stack.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct {
  uint64_t n;
  double x;
  double x2;
  double m2;
  double m4;
} meas_t;

typedef struct {
  uint64_t n;
  uint64_t W;
  double *OO;
  dll_t *Op;
  double O;
  double O2;
} autocorr_t;

void meas_update(meas_t *m, double x);

double meas_dx(const meas_t *m);

double meas_c(const meas_t *m);

double meas_dc(const meas_t *m);

void update_autocorr(autocorr_t *OO, double O);

double rho(const autocorr_t *o, uint64_t i);

#ifdef __cplusplus
}
#endif