Representation of a histogram. More...
#include <OpenMS/MATH/STATISTICS/Histogram.h>
Public Types | |
typedef std::vector< ValueType >::const_iterator | ConstIterator |
Non-mutable iterator of the bins. More... | |
Public Member Functions | |
BinSizeType | minBound () const |
returns the lower bound More... | |
BinSizeType | maxBound () const |
returns the upper bound More... | |
ValueType | maxValue () const |
returns the highest value of all bins More... | |
ValueType | minValue () const |
returns the lowest value of all bins More... | |
BinSizeType | binSize () const |
returns the bin size More... | |
Size | size () const |
returns the number of bins More... | |
ValueType | operator[] (Size index) const |
returns the value of bin index More... | |
BinSizeType | centerOfBin (Size bin_index) const |
returns the center position of the bin with the index bin_index More... | |
ValueType | binValue (BinSizeType val) const |
returns the value of bin corresponding to the value val More... | |
Size | inc (BinSizeType val, ValueType increment=1) |
increases the bin corresponding to value val by increment More... | |
Size | incUntil (BinSizeType val, bool inclusive, ValueType increment=1) |
Size | incFrom (BinSizeType val, bool inclusive, ValueType increment=1) |
void | reset (BinSizeType min, BinSizeType max, BinSizeType bin_size) |
resets the histogram with the given range and bin size More... | |
void | applyLogTransformation (BinSizeType multiplier) |
Transforms the bin values with f(x)=multiplier*log(x+1) More... | |
Constructors and Destructors | |
Histogram () | |
default constructor More... | |
Histogram (const Histogram &histogram) | |
copy constructor More... | |
Histogram (BinSizeType min, BinSizeType max, BinSizeType bin_size) | |
constructor with min, max and bin size More... | |
template<typename DataIterator > | |
Histogram (DataIterator begin, DataIterator end, BinSizeType min, BinSizeType max, BinSizeType bin_size) | |
constructor with data iterator and min, max, bin_size parameters More... | |
virtual | ~Histogram () |
destructor More... | |
Assignment and equality operators | |
bool | operator== (const Histogram &histogram) const |
Equality operator. More... | |
bool | operator!= (const Histogram &histogram) const |
Inequality operator. More... | |
Histogram & | operator= (const Histogram &histogram) |
Assignment. More... | |
Iterators | |
ConstIterator | begin () const |
Non-mutable iterator pointing to the first bin. More... | |
ConstIterator | end () const |
Non-mutable iterator pointing after the last bin. More... | |
Static Public Member Functions | |
template<typename DataIterator > | |
static void | getCumulativeHistogram (DataIterator begin, DataIterator end, bool complement, bool inclusive, Histogram< ValueType, BinSizeType > &histogram) |
Protected Member Functions | |
Size | valToBin_ (BinSizeType val) const |
Returns the bin a given value belongs to. More... | |
void | initBins_ () |
initialize the bins More... | |
Protected Attributes | |
BinSizeType | min_ |
Lower bound. More... | |
BinSizeType | max_ |
Upper bound. More... | |
BinSizeType | bin_size_ |
Bin size. More... | |
std::vector< ValueType > | bins_ |
Vector of bins. More... | |
Representation of a histogram.
The first template argument gives the Type of the values that are stored in the bins. The second argument gives the type for the bin size and range.
typedef std::vector<ValueType>::const_iterator ConstIterator |
Non-mutable iterator of the bins.
|
inline |
default constructor
|
inline |
constructor with min, max and bin size
Exception::OutOfRange | is thrown if bin_size negative or zero |
References Histogram< ValueType, BinSizeType >::initBins_().
|
inline |
constructor with data iterator and min, max, bin_size parameters
Exception::OutOfRange | is thrown if bin_size negative or zero |
References Histogram< ValueType, BinSizeType >::end(), Histogram< ValueType, BinSizeType >::inc(), and Histogram< ValueType, BinSizeType >::initBins_().
|
inlinevirtual |
destructor
|
inline |
Transforms the bin values with f(x)=multiplier*log(x+1)
References Histogram< ValueType, BinSizeType >::bins_.
|
inline |
Non-mutable iterator pointing to the first bin.
Referenced by Histogram< ValueType, BinSizeType >::operator=().
|
inline |
returns the bin size
References Histogram< ValueType, BinSizeType >::bin_size_.
|
inline |
returns the value of bin corresponding to the value val
Exception::OutOfRange | is thrown if the value is out of valid range |
References Histogram< ValueType, BinSizeType >::bins_, and Histogram< ValueType, BinSizeType >::valToBin_().
|
inline |
returns the center position of the bin with the index bin_index
Exception::IndexOverflow | is thrown for invalid indices |
References Histogram< ValueType, BinSizeType >::bin_size_, Histogram< ValueType, BinSizeType >::bins_, and Histogram< ValueType, BinSizeType >::min_.
|
inline |
Non-mutable iterator pointing after the last bin.
References Histogram< ValueType, BinSizeType >::bins_.
Referenced by Histogram< ValueType, BinSizeType >::getCumulativeHistogram(), and Histogram< ValueType, BinSizeType >::Histogram().
|
inlinestatic |
|
inline |
increases the bin corresponding to value val
by increment
Exception::OutOfRange | is thrown if the value is out of valid range |
References Histogram< ValueType, BinSizeType >::bins_, and Histogram< ValueType, BinSizeType >::valToBin_().
Referenced by Histogram< ValueType, BinSizeType >::Histogram().
|
inline |
|
inline |
|
inlineprotected |
initialize the bins
Referenced by Histogram< ValueType, BinSizeType >::Histogram().
|
inline |
returns the upper bound
References Histogram< ValueType, BinSizeType >::max_.
|
inline |
returns the highest value of all bins
References Histogram< ValueType, BinSizeType >::bins_.
|
inline |
returns the lower bound
References Histogram< ValueType, BinSizeType >::min_.
|
inline |
returns the lowest value of all bins
References Histogram< ValueType, BinSizeType >::bins_.
|
inline |
Inequality operator.
References Histogram< ValueType, BinSizeType >::operator==().
|
inline |
Equality operator.
Referenced by Histogram< ValueType, BinSizeType >::operator!=(), and Histogram< ValueType, BinSizeType >::reset().
|
inline |
returns the value of bin index
Exception::IndexOverflow | is thrown for invalid indices |
References Histogram< ValueType, BinSizeType >::bins_.
|
inline |
resets the histogram with the given range and bin size
Exception::OutOfRange | is thrown if bin_size negative or zero |
References Histogram< ValueType, BinSizeType >::bin_size_, Histogram< ValueType, BinSizeType >::bins_, Histogram< ValueType, BinSizeType >::max_, Histogram< ValueType, BinSizeType >::min_, and Histogram< ValueType, BinSizeType >::operator==().
|
inline |
returns the number of bins
References Histogram< ValueType, BinSizeType >::bins_.
|
inlineprotected |
Returns the bin a given value belongs to.
Exception::OutOfRange | is thrown if the value is out of valid range |
Referenced by Histogram< ValueType, BinSizeType >::binValue(), Histogram< ValueType, BinSizeType >::inc(), Histogram< ValueType, BinSizeType >::incFrom(), and Histogram< ValueType, BinSizeType >::incUntil().
|
protected |
|
protected |
Vector of bins.
Referenced by Histogram< ValueType, BinSizeType >::applyLogTransformation(), Histogram< ValueType, BinSizeType >::binValue(), Histogram< ValueType, BinSizeType >::centerOfBin(), Histogram< ValueType, BinSizeType >::end(), Histogram< ValueType, BinSizeType >::inc(), Histogram< ValueType, BinSizeType >::incFrom(), Histogram< ValueType, BinSizeType >::incUntil(), Histogram< ValueType, BinSizeType >::maxValue(), Histogram< ValueType, BinSizeType >::minValue(), Histogram< ValueType, BinSizeType >::operator=(), Histogram< ValueType, BinSizeType >::operator[](), Histogram< ValueType, BinSizeType >::reset(), and Histogram< ValueType, BinSizeType >::size().
|
protected |
Upper bound.
Referenced by Histogram< ValueType, BinSizeType >::maxBound(), Histogram< ValueType, BinSizeType >::operator=(), and Histogram< ValueType, BinSizeType >::reset().
|
protected |
OpenMS / TOPP release 2.3.0 | Documentation generated on Tue Jan 9 2018 18:22:15 using doxygen 1.8.13 |