25 #ifndef WVALUESETHISTOGRAM_H
26 #define WVALUESETHISTOGRAM_H
33 #include <boost/scoped_array.hpp>
34 #include <boost/shared_array.hpp>
36 #include "../../common/WHistogram.h"
37 #include "../WValueSet.h"
60 explicit WValueSetHistogram( std::shared_ptr< WValueSetBase > valueSet,
size_t buckets = 1000 );
80 WValueSetHistogram( std::shared_ptr< WValueSetBase > valueSet,
double min,
double max,
size_t buckets = 1000 );
125 virtual size_t operator[](
size_t index )
const;
134 virtual size_t at(
size_t index )
const;
141 virtual size_t size()
const;
189 virtual size_t accumulate(
size_t startIndex,
size_t endIndex )
const;
219 virtual void insert(
double value );
275 size_t idx =
static_cast< size_t >( std::floor( pos ) );
280 bool inL = ( pos >= 0.0 );
Container which associate values with (uniform width) bins (aka intervals or buckets).
double m_minimum
The smallest value.
Abstract base class to all WValueSets.
Used to find the occurrence frequencies of values in a value set.
virtual size_t accumulate(size_t startIndex, size_t endIndex) const
Sums up the buckets in the specified interval.
double m_mappedBucketSize
Size of one bucket in the mapped histogram.
virtual size_t at(size_t index) const
Get the count of the bucket.
WValueSetHistogram(std::shared_ptr< WValueSetBase > valueSet, size_t buckets=1000)
Constructor.
boost::shared_array< size_t > getInitialBuckets() const
Return the initial buckets.
boost::shared_array< size_t > m_initialBuckets
Pointer to all initial buckets of the histogram.
size_t getNInitialBuckets() const
Return the number of initial buckets.
size_t m_nInitialBuckets
Number of buckets in the initial histogram.
virtual size_t getIndexForValue(double value) const
Returns the right index to the bucket containing the given value.
virtual void insert(double value)
increment the value by one, contains the logic to find the element place in the array.
virtual size_t getTotalElementCount() const
This returns the number of value set entries added to the histogram.
double getInitialBucketSize() const
Return the size of one initial bucket.
virtual double getBucketSize(size_t index=0) const
Return the size of one bucket.
double m_initialBucketSize
Size of one bucket in the initial histogram.
virtual size_t operator[](size_t index) const
Get the count of the bucket.
void buildHistogram(const WValueSetBase &valueSet)
Actually builds the histogram.
size_t m_nMappedBuckets
Tracks the number of a buckets in the mapped histogram.
virtual size_t size() const
Returns the number of buckets in the histogram with the actual mapping.
virtual std::pair< double, double > getIntervalForIndex(size_t index) const
Returns the actual interval associated with the given index.
WValueSetHistogram & operator=(const WValueSetHistogram &other)
Copy assignment.
size_t m_nbTotalElements
The number of elements distributed in the buckets.
~WValueSetHistogram()
Destructor.
boost::shared_array< size_t > m_mappedBuckets
Pointer to all initial buckets of the histogram.