34 class SlidingWindowVectorMedian;
42 std::vector<float> data;
48 : windowSize(windowSize),
49 vectorSize(vectorSize),
50 data(vectorSize * windowSize, 0),
58 if (entry.size() != vectorSize)
60 throw LocalException(
"Vector of wrong size added. Execting: ") << vectorSize <<
"; Actual: " << entry.size();
63 for (
size_t i = 0; i < entry.size(); i++)
65 data.at(i + currentIndex * vectorSize) = entry.at(i);
68 currentIndex = (currentIndex + 1) % windowSize;
69 fullCycle = fullCycle || currentIndex == 0;
74 std::vector<float> median;
76 for (
size_t i = 0; i < vectorSize; i++)
78 std::vector<float> samples;
80 for (
size_t n = 0; n < windowSize; n++)
82 samples.push_back(
data.at(i + n * vectorSize));
85 std::sort(samples.begin(), samples.end());