MathUtil: Add Population (vs Sample) versions of Variance and StandardDeviation to RunningVariance.

This commit is contained in:
Jordan Woyak 2020-09-22 17:44:28 -05:00
parent 960750003e
commit 1063c4e940
1 changed files with 5 additions and 1 deletions

View File

@ -135,8 +135,12 @@ public:
constexpr size_t Count() const { return m_running_mean.Count(); } constexpr size_t Count() const { return m_running_mean.Count(); }
constexpr T Mean() const { return m_running_mean.Mean(); } constexpr T Mean() const { return m_running_mean.Mean(); }
constexpr T Variance() const { return m_variance / (Count() - 1); } constexpr T Variance() const { return m_variance / (Count() - 1); }
constexpr T StandardDeviation() const { return std::sqrt(Variance()); } T StandardDeviation() const { return std::sqrt(Variance()); }
constexpr T PopulationVariance() const { return m_variance / Count(); }
T PopulationStandardDeviation() const { return std::sqrt(PopulationVariance()); }
private: private:
RunningMean<T> m_running_mean; RunningMean<T> m_running_mean;