-
Notifications
You must be signed in to change notification settings - Fork 0
/
CooledTwoStageAvg.h
44 lines (36 loc) · 917 Bytes
/
CooledTwoStageAvg.h
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
/*
* CooledTwoStageAvg.h
*
* Created on: 30.12.2018
* Author: pantec
*
*
* implementation of a windowed average with equally weighted elements over the past n steps
* the largest and smallest values are not taken into account
*
*/
#ifndef COOLEDTWOSTAGEAVG_H_
#define COOLEDTWOSTAGEAVG_H_
#include "tns_util/CooledAverage.h"
#ifndef MODNAME
#define MODNAME __FILE__
#include "tns_util/copyright.h"
#endif
class CooledTwoStageAvg : public CooledAverage {
private:
CooledAverage *stack;
CooledAverage *derivate;
public:
void Init(int len, bool ignoreMinMax=true);
CooledTwoStageAvg();
CooledTwoStageAvg(int len, bool ignoreMinMax=false);
virtual ~CooledTwoStageAvg() {
delete stack;
delete derivate;
};
virtual bool add(double v);
virtual double get();
virtual double acceleration() { return derivate->gradient(); };
virtual void reset();
};
#endif /* COOLEDTWOSTAGEAVG_H_ */