NuTo
Numerics Tool
Average.h
Go to the documentation of this file.
1 #pragma once
2 namespace NuTo
3 {
4 
6 struct Average
7 {
8  long double mCurrentAverage = 0;
9  int mNum = 0;
10 
11  void operator()(int x)
12  {
13  mCurrentAverage = (x + mNum * mCurrentAverage) / (mNum + 1);
14  mNum++;
15  }
16 };
17 }
calculates the cumulative moving average
Definition: Average.h:6
void operator()(int x)
Definition: Average.h:11
int mNum
Definition: Average.h:9
Definition: Exception.h:6
long double mCurrentAverage
Definition: Average.h:8