summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2018-07-26 01:50:39 -0400
committerJaron Kent-Dobias <jaron@kent-dobias.com>2018-07-26 01:50:39 -0400
commit215c40813a35c4fdc0bb5f1b8fdea125b9e9d2e4 (patch)
tree9ae07162fcd8932b01bb5bdbde8fd75d3b8d9e72
parentde8c6398f269c9fa14842c170b5b21651e817f9b (diff)
downloadc++-215c40813a35c4fdc0bb5f1b8fdea125b9e9d2e4.tar.gz
c++-215c40813a35c4fdc0bb5f1b8fdea125b9e9d2e4.tar.bz2
c++-215c40813a35c4fdc0bb5f1b8fdea125b9e9d2e4.zip
a couple more removed files
-rw-r--r--lib/measure.h14
-rw-r--r--lib/measurement.c76
-rw-r--r--lib/measurement.h45
3 files changed, 3 insertions, 132 deletions
diff --git a/lib/measure.h b/lib/measure.h
index 0b86309..8082dd2 100644
--- a/lib/measure.h
+++ b/lib/measure.h
@@ -1,7 +1,9 @@
#pragma once
-#include "measurement.h"
+#include "state.h"
+#include "correlation.h"
+#include <functional>
#define POSSIBLE_MEASUREMENTS 4
const unsigned char measurement_energy = 1 << 0;
@@ -11,14 +13,6 @@ const unsigned char measurement_fourierZero = 1 << 3;
char const *measurement_labels[] = {"E", "S", "M", "F"};
-#ifdef __cplusplus
-
-#include "state.h"
-#include "correlation.h"
-#include <functional>
-
-
-
FILE **measure_setup_files(unsigned char flags, unsigned long timestamp) {
FILE **files = (FILE **)calloc(POSSIBLE_MEASUREMENTS, sizeof(FILE *));
@@ -66,6 +60,4 @@ void measure_free_files(unsigned char flags, FILE **files) {
free(files);
}
-#endif
-
diff --git a/lib/measurement.c b/lib/measurement.c
deleted file mode 100644
index ad824f6..0000000
--- a/lib/measurement.c
+++ /dev/null
@@ -1,76 +0,0 @@
-
-#include "measurement.h"
-
-double add_to_avg(double mx, double x, count_t n) {
- return mx * (n / (n + 1.0)) + x / (n + 1.0);
-}
-
-void meas_update(meas_t *m, double x) {
- count_t n = m->n;
-
- m->x = add_to_avg(m->x, x, n);
- m->x2 = add_to_avg(m->x2, pow(x, 2), n);
-
- m->m2 = add_to_avg(m->m2, pow(x - m->x, 2), n);
- m->m4 = add_to_avg(m->m4, pow(x - m->x, 4), n);
-
- /*
- if (n > 1) {
- double s2 = n / (n - 1.) * (m->x2 - pow(m->x, 2));
- m->dx = sqrt(s2 / n);
- m->c = s2;
- m->dc = sqrt((m->m4 - (n - 3.)/(n - 1.) * pow(m->m2, 2)) / n);
- }
- */
-
- (m->n)++;
-}
-
-double meas_dx(const meas_t *m) {
- return sqrt(1. / (m->n - 1.) * (m->x2 - pow(m->x, 2)));
-}
-
-double meas_c(const meas_t *m) {
- return m->n / (m->n - 1.) * (m->x2 - pow(m->x, 2));
-}
-
-double meas_dc(const meas_t *m) {
- return sqrt((m->m4 - (m->n - 3.)/(m->n - 1.) * pow(m->m2, 2)) / m->n);
-}
-
-void update_autocorr(autocorr_t *OO, double O) {
- OO->O = add_to_avg(OO->O, O, OO->n);
- OO->O2 = add_to_avg(OO->O2, pow(O, 2), OO->n);
-
- dll_t *Otmp = OO->Op;
- dll_t *Osave;
- count_t t = 0;
-
- while (Otmp != NULL) {
- OO->OO[t] = add_to_avg(OO->OO[t], O * (Otmp->x), OO->n - t - 1);
- t++;
- if (t == OO->W - 1) {
- Osave = Otmp;
- }
- Otmp = Otmp->next;
- }
-
- if (t == OO->W) {
- if (OO->W == 1) {
- free(OO->Op);
- OO->Op = NULL;
- } else {
- free(Osave->next);
- Osave->next = NULL;
- }
- }
-
- stack_push_d(&(OO->Op), O);
-
- OO->n++;
-}
-
-double rho(const autocorr_t *o, count_t i) {
- return (o->OO[i] - pow(o->O, 2)) / (o->O2 - pow(o->O, 2));
-}
-
diff --git a/lib/measurement.h b/lib/measurement.h
deleted file mode 100644
index 78fa51b..0000000
--- a/lib/measurement.h
+++ /dev/null
@@ -1,45 +0,0 @@
-
-#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