Skip to content
Snippets Groups Projects
Commit b1e7f06c authored by Andreas Schenk's avatar Andreas Schenk
Browse files

added min max caclulation to stat_acuumulator

parent 283438ee
No related branches found
No related tags found
No related merge requests found
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#ifndef OST_STAT_ACCUMULATOR_HH #ifndef OST_STAT_ACCUMULATOR_HH
#define OST_STAT_ACCUMULATOR_HH #define OST_STAT_ACCUMULATOR_HH
#include <limits>
#include <boost/math/special_functions/binomial.hpp> #include <boost/math/special_functions/binomial.hpp>
#include <ost/base.hh> #include <ost/base.hh>
#include <ost/message.hh> #include <ost/message.hh>
...@@ -35,6 +36,8 @@ public: ...@@ -35,6 +36,8 @@ public:
StatAccumulator(): StatAccumulator():
sum_(0.0), sum_(0.0),
sum2_(0.0), sum2_(0.0),
max_(-std::numeric_limits<Real>::max()),
min_(std::numeric_limits<Real>::max()),
m_(), m_(),
w_(0.0), w_(0.0),
n_(0) n_(0)
...@@ -48,6 +51,8 @@ public: ...@@ -48,6 +51,8 @@ public:
StatAccumulator(Real val, Real w=1.0): StatAccumulator(Real val, Real w=1.0):
sum_(val), sum_(val),
sum2_(val*val), sum2_(val*val),
max_(val),
min_(val),
m_(), m_(),
w_(w), w_(w),
n_(1) n_(1)
...@@ -86,7 +91,8 @@ public: ...@@ -86,7 +91,8 @@ public:
sum_+=acc.sum_; sum_+=acc.sum_;
sum2_+=acc.sum2_; sum2_+=acc.sum2_;
max_=std::max<Real>(max_,acc.max_);
min_=std::min<Real>(min_,acc.min_);
if(MAX_MOMENT>0){ if(MAX_MOMENT>0){
Real delta=acc.m_[0]-m_[0]; Real delta=acc.m_[0]-m_[0];
Real delta_w=delta/wn; Real delta_w=delta/wn;
...@@ -132,6 +138,16 @@ public: ...@@ -132,6 +138,16 @@ public:
return n_; return n_;
} }
Real GetMaximum() const
{
return max_;
}
Real GetMinimum() const
{
return min_;
}
Real GetWeight() const Real GetWeight() const
{ {
return w_; return w_;
...@@ -212,6 +228,8 @@ public: ...@@ -212,6 +228,8 @@ public:
private: private:
Real sum_; Real sum_;
Real sum2_; Real sum2_;
Real max_;
Real min_;
Real m_[MAX_MOMENT]; Real m_[MAX_MOMENT];
Real w_; Real w_;
unsigned int n_; unsigned int n_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment