9#include "utils/mardyn_assert.h"
24 Accumulator(
size_t windowLength = 100) : _windowLength(windowLength), _insertPosition(0), _size(0) {
25 _data =
new T[windowLength];
37 for(
size_t i = 0; i < _size; i++ ) {
49 for(
size_t i = 0; i < _size; i++ ) {
50 T diff = _data[i] - avg;
54 stddev = sqrt(stddev);
63 T *sorted_data =
new T[_size];
64 std::copy(_data, _data + _size, sorted_data);
65 std::sort(sorted_data, sorted_data + _size);
66 T retValue = sorted_data[
static_cast<size_t>(_size * p) - 1];
77 T *sorted_data =
new T[_size];
78 std::copy(_data, _data + _size, sorted_data);
79 std::sort(sorted_data, sorted_data + _size);
80 T qmin = sorted_data[
static_cast<size_t>(_size * pmin) - 1];
81 T qmax = sorted_data[
static_cast<size_t>(_size * pmax) - 1];
82 T retValue = qmax - qmin;
91 _data[_insertPosition] = value;
92 _insertPosition = (_insertPosition + 1) % _windowLength;
93 if (_size < _windowLength)
109 mardyn_assert(0 <
id &&
id <= _windowLength);
110 return _data[(_insertPosition + _windowLength -
id) % _windowLength];
117 return _windowLength;
131 size_t _windowLength;
132 size_t _insertPosition;
Definition: TemperatureControl.h:211
T getInterPercentileRange(double pmin, double pmax)
Definition: Accumulator.h:76
void addEntry(T value)
Definition: Accumulator.h:90
Accumulator(size_t windowLength=100)
Definition: Accumulator.h:24
T getEntry(size_t id)
Definition: Accumulator.h:108
T getAverage()
Definition: Accumulator.h:35
T getPercentile(double p)
Definition: Accumulator.h:62
~Accumulator()
Definition: Accumulator.h:28
T getLastEntry()
Definition: Accumulator.h:100
size_t getWindowLength()
Definition: Accumulator.h:116
size_t getSize()
Definition: Accumulator.h:126
T getStddev()
Definition: Accumulator.h:46
::xsd::cxx::tree::id< char, ncname > id
C++ type corresponding to the ID XML Schema built-in type.
Definition: vtk-punstructured.h:322