mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-12-01 21:52:12 +08:00
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
This commit is contained in:
1 parent
5468841aa5
commit
67a893ac6d
1 file changed
-4
@@ -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
|
||||
|
||||
Reference in new issue
Block a user