LRT14
1.0
Main Page
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Functions
Variables
Enumerations
Enumerator
RunningSum.h
1
#ifndef RUNNING_SUM_H_
2
#define RUNNING_SUM_H_
3
4
namespace
Rhesus
5
{
6
namespace
Toolkit
7
{
8
namespace
Control
9
{
13
class
RunningSum
14
{
15
public
:
20
RunningSum
(
double
decayConstant) :
21
decayConstant(decayConstant), runningSum(0)
22
{
23
24
}
25
31
double
UpdateSum
(
double
x)
32
{
33
runningSum *= decayConstant;
34
runningSum += x;
35
return
runningSum * (1 - decayConstant);
36
}
37
41
void
Clear
()
42
{
43
runningSum = 0;
44
}
45
50
void
setDecayConstant
(
double
decayConstant)
51
{
52
this->decayConstant = decayConstant;
53
}
54
55
private
:
56
double
decayConstant;
57
double
runningSum;
58
};
59
60
}
61
}
62
}
63
64
#endif
Rhesus
Toolkit
Control
RunningSum.h
Generated on Tue Feb 11 2014 00:29:35 for LRT14 by
1.8.3