OpenWalnut
1.5.0dev
|
Container which associate values with (uniform width) bins (aka intervals or buckets). More...
#include <WHistogram.h>
Public Member Functions | |
WHistogram (double min, double max, std::size_t buckets=1000) | |
Default constructor. More... | |
WHistogram (const WHistogram &hist) | |
Copy constructor. More... | |
virtual | ~WHistogram () |
Default destructor. More... | |
virtual std::size_t | operator[] (std::size_t index) const =0 |
Get the count of the specified bucket. More... | |
virtual std::size_t | at (std::size_t index) const =0 |
Get the count of the specified bucket. More... | |
virtual std::size_t | size () const |
Returns the number of buckets in the histogram with the actual mapping. More... | |
virtual double | getMinimum () const |
Returns the minimum value. More... | |
virtual double | getMaximum () const |
Returns the maximum value. More... | |
virtual double | getBucketSize (std::size_t index=0) const =0 |
Return the size of one specific bucket. More... | |
virtual std::pair< double, double > | getIntervalForIndex (std::size_t index) const =0 |
Returns the actual interval associated with the given index. More... | |
Protected Attributes | |
double | m_minimum |
The smallest value. More... | |
double | m_maximum |
The biggest value. More... | |
double | m_nbBuckets |
The number of buckets. More... | |
Container which associate values with (uniform width) bins (aka intervals or buckets).
This class implements the abstract interface and therefore builds the base class for all histogram classes. The interface also allows programming histogram of different bucket sizes.
Definition at line 35 of file WHistogram.h.
WHistogram::WHistogram | ( | double | min, |
double | max, | ||
std::size_t | buckets = 1000 |
||
) |
Default constructor.
Creates an empty histogram covering the specified min and max values with the specified number of buckets.
min | the smallest value |
max | the largest value |
buckets | the number of buckets |
Definition at line 30 of file WHistogram.cpp.
WHistogram::WHistogram | ( | const WHistogram & | hist | ) |
Copy constructor.
Creates a deep copy of the specified histogram.
hist | the histogram to copy. |
Definition at line 43 of file WHistogram.cpp.
|
virtual |
Default destructor.
Definition at line 50 of file WHistogram.cpp.
|
pure virtual |
Get the count of the specified bucket.
Testing if the position is valid.
index | which buckets count is to be returned; starts with 0 which is the bucket containing the smallest values. |
Implemented in WHistogramBasic.
|
pure virtual |
Return the size of one specific bucket.
index | the width for this bucket is queried. |
Implemented in WHistogramBasic.
|
pure virtual |
Returns the actual interval associated with the given index.
The interval is open, meaning that getIntervalForIndex( i ).second == getIntervalForIndex( i + 1 ).first but does not belong anymore to the interval itself but every value smaller than getIntervalForIndex( i ).second.
index | the intex |
Implemented in WHistogramBasic.
|
virtual |
Returns the maximum value.
Definition at line 64 of file WHistogram.cpp.
References m_maximum.
|
virtual |
Returns the minimum value.
Definition at line 59 of file WHistogram.cpp.
References m_minimum.
|
pure virtual |
Get the count of the specified bucket.
index | which buckets count is to be returned; starts with 0 which is the bucket containing the smallest values. |
Implemented in WHistogramBasic.
|
virtual |
Returns the number of buckets in the histogram with the actual mapping.
Reimplemented in WValueSetHistogram.
Definition at line 54 of file WHistogram.cpp.
References m_nbBuckets.
Referenced by WHistogramBasicTest::testInitialization(), WHistogramBasicTest::testInsert(), WHistogramBasicTest::testInsertOutOfBounds(), and WHistogramBasicTest::testOperatorToGetNumberOfElementsInsideTheBin().
|
protected |
The biggest value.
Definition at line 127 of file WHistogram.h.
Referenced by WValueSetHistogram::buildHistogram(), getMaximum(), WHistogramBasic::insert(), WValueSetHistogram::operator=(), WHistogram(), and WValueSetHistogram::WValueSetHistogram().
|
protected |
The smallest value.
Definition at line 122 of file WHistogram.h.
Referenced by WValueSetHistogram::buildHistogram(), WValueSetHistogram::getIndexForValue(), WValueSetHistogram::getIntervalForIndex(), WHistogramBasic::getIntervalForIndex(), getMinimum(), WHistogramBasic::insert(), WValueSetHistogram::operator=(), WHistogram(), and WValueSetHistogram::WValueSetHistogram().
|
protected |
The number of buckets.
Definition at line 132 of file WHistogram.h.
Referenced by WValueSetHistogram::buildHistogram(), WHistogramBasic::insert(), and size().