huge commit

- worked on about everything
- grid walker using plugable modules
- wifi models
- new distributions
- worked on geometric data-structures
- added typesafe timestamps
- worked on grid-building
- added sensor-classes
- added sensor analysis (step-detection, turn-detection)
- offline data reader
- many test-cases
This commit is contained in:
2016-08-29 08:18:44 +02:00
parent 99ee95ce7b
commit a2c9e575a2
94 changed files with 8298 additions and 257 deletions

View File

@@ -0,0 +1,51 @@
#ifndef DIST_REGION_H
#define DIST_REGION_H
#include <cmath>
#include <random>
#include "../Random.h"
#include "../../Assertions.h"
#include "Normal.h"
namespace Distribution {
/** normal distribution */
template <typename T> class Region {
private:
const T mu;
const T a;
const T h;
const T sigma;
public:
/** ctor */
Region(const T mu, const T a) : mu(mu), a(a), h(1.0/(2*2*a)), sigma(std::exp(0) / (2*h*std::sqrt(2*M_PI))) {
}
/** get probability for the given value */
T getProbability(const T val) const {
const T diff = std::abs(val - mu);
if (diff < a) {return h;}
//if (diff < a+b) {const float p = 1.0f-(diff-a)/b; return p*h;}
//return 0;
const T diff2 = ((val - mu) < 0) ? (val - mu + a) : (val - mu - a);
return Distribution::Normal<T>::getProbability(0, sigma, diff2) / 2;
}
/** get the probability for the given value */
static T getProbability(const T mu, const T a, const T val) {
Region<T> dist(mu, a);
return dist.getProbability(val);
}
};
}
#endif // DIST_REGION_H