Histogram class, that splits an interval into n regular bins, and counts how often a value is added to a bin.
More...
#include <Histogram.hpp>
Histogram class, that splits an interval into n regular bins, and counts how often a value is added to a bin.
The counts can be recovered using the bracket operator and a bin index.
h.update( 1.5 );
h.update( 11 );
for( size_t i=0; i<h.size(); i++ )
cout << h[i] << endl;
◆ Histogram()
numeric::Histogram::Histogram |
( |
int |
count, |
|
|
double |
min_val, |
|
|
double |
max_val |
|
) |
| |
|
inline |
Constructs a histogram where the number of update() calls with a value that all into a bin are counted.
- Parameters
-
count | - number of divisions in the interval, needs to be greater 0 |
min_val | - lower bound for the interval |
max_val | - upper bound for the interval, needs to be greater than min_val |
◆ getRelative()
double numeric::Histogram::getRelative |
( |
size_t |
idx | ) |
const |
|
inline |
return relative count in bin so that the integral over all bins would result in 1.0. Note, that this is the integral and not the sum, so it takes the width of the bins into account.
◆ total()
size_t numeric::Histogram::total |
( |
| ) |
const |
|
inline |
total number of values in the bins
◆ update()
void numeric::Histogram::update |
( |
double |
value | ) |
|
|
inline |
Increase the count for the bin, which value fits in by one. This function will assign a value which is less than min_val the first bucket, and greater than max_val to the last bucket.
- Parameters
-
value | - value for which the count in the bin should be increased |
size_t numeric::Histogram::n |
The documentation for this struct was generated from the following file:
- /home/dfki.uni-bremen.de/roehr/workspace/2maz/dev/base/numeric/src/Histogram.hpp