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