31 #include "WHistogramBasic.h"
38 m_intervalWidth( std::abs( m_maximum - m_minimum ) / static_cast< double >( m_nbBuckets ) )
44 m_bins( hist.m_bins ),
45 m_intervalWidth( hist.m_intervalWidth )
61 if( index >=
m_bins.size() )
63 wlog::error(
"WHistogramBasic" ) << index <<
"th interval is not available, there are only: " <<
m_bins.size();
78 return std::make_pair( first, second );
85 wlog::warn(
"WHistogramBasic" ) << std::scientific << std::setprecision( 16 ) <<
"Inserted value out of bounds, thread: "
108 return std::accumulate(
m_bins.begin(),
m_bins.end(), 0 );
Container which associate values with (uniform width) bins (aka intervals or buckets).
double m_intervalWidth
The width of an interval is precomputed to save performance.
virtual std::size_t insert(double value)
Inserts a given value within the given range (min, max) into exactly one bin and increment its size.
~WHistogramBasic()
Default destructor.
virtual std::pair< double, double > getIntervalForIndex(std::size_t index) const
Returns the actual interval associated with the given index.
std::vector< std::size_t > m_bins
Bins to associate with the values.
virtual std::size_t at(std::size_t index) const
Get the count of the specified bucket.
WHistogramBasic(double min, double max, std::size_t buckets=1000)
Default constructor.
virtual double getBucketSize(std::size_t index=0) const
Return the size of one specific bucket.
std::size_t valuesSize() const
Computes the number of inserted values so far.
virtual std::size_t operator[](std::size_t index) const
Get the count of the specified bucket.
Container which associate values with (uniform width) bins (aka intervals or buckets).
double m_minimum
The smallest value.
double m_nbBuckets
The number of buckets.
double m_maximum
The biggest value.
const double DBL_EPS
Smallest double such: 1.0 + DBL_EPS == 1.0 is still true.
WStreamedLogger warn(const std::string &source)
Logging a warning message.
WStreamedLogger error(const std::string &source)
Logging an error message.