From 67a893ac6d33a892dfbf13ae3338865732744d9c Mon Sep 17 00:00:00 2001 From: bresch Date: Fri, 10 Dec 2021 15:10:39 +0100 Subject: [PATCH] WelfordMean: remove unnecessary case for first sample setting the mean to the sample value and then adding 0 is the same as setting the mean to zero and then add the sample value divided by 1 --- src/lib/mathlib/math/WelfordMean.hpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/lib/mathlib/math/WelfordMean.hpp b/src/lib/mathlib/math/WelfordMean.hpp index 75bb59bce9..e5b0240533 100644 --- a/src/lib/mathlib/math/WelfordMean.hpp +++ b/src/lib/mathlib/math/WelfordMean.hpp @@ -49,10 +49,6 @@ public: // For a new value, compute the new count, new mean, the new M2. void update(const T &new_value) { - if (_count == 0) { - _mean = new_value; - } - _count++; // mean accumulates the mean of the entire dataset