Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes

Histogram< ValueType, BinSizeType > Class Template Reference
[Math]

Representation of a histogram. More...

#include <OpenMS/MATH/STATISTICS/Histogram.h>

List of all members.

Public Types

typedef std::vector< ValueType >
::const_iterator 
ConstIterator
 Non-mutable iterator of the bins.

Public Member Functions

BinSizeType minBound () const
 returns the lower bound
BinSizeType maxBound () const
 returns the upper bound
ValueType maxValue () const
 returns the highest value of all bins
ValueType minValue () const
 returns the lowest value of all bins
BinSizeType binSize () const
 returns the bin size
Size size () const
 returns the number of bins
ValueType operator[] (Size index) const
 returns the value of bin index
BinSizeType centerOfBin (Size bin_index) const
 returns the center position of the bin with the index bin_index
ValueType binValue (BinSizeType val) const
 returns the value of bin corresponding to the value val
Size inc (BinSizeType val, ValueType increment=1)
 increases the bin corresponding to value val by increment
void reset (BinSizeType min, BinSizeType max, BinSizeType bin_size)
 resets the histogram with the given range and bin size
void applyLogTransformation (BinSizeType multiplier)
 Transforms the bin values with f(x)=multiplier*log(x+1).
Constructors and Destructors

 Histogram ()
 default constructor
 Histogram (const Histogram &histogram)
 copy constructor
 Histogram (BinSizeType min, BinSizeType max, BinSizeType bin_size)
 constructor with min, max and bin size
virtual ~Histogram ()
 destructor
Assignment and equality operators

bool operator== (const Histogram &histogram) const
 Equality operator.
bool operator!= (const Histogram &histogram) const
 Inequality operator.
Histogramoperator= (const Histogram &histogram)
 Assignment.
Iterators

ConstIterator begin () const
 Non-mutable iterator pointing to the first bin.
ConstIterator end () const
 Non-mutable iterator pointing after the last bin.

Protected Member Functions

Size valToBin_ (BinSizeType val) const
 Returns the bin a given value belongs to.

Protected Attributes

BinSizeType min_
 Lower bound.
BinSizeType max_
 Upper bound.
BinSizeType bin_size_
 Bin size.
std::vector< ValueType > bins_
 Vector of bins.

Detailed Description

template<typename ValueType = UInt, typename BinSizeType = DoubleReal>
class OpenMS::Math::Histogram< ValueType, BinSizeType >

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.


Member Typedef Documentation

typedef std::vector<ValueType>::const_iterator ConstIterator

Non-mutable iterator of the bins.


Constructor & Destructor Documentation

Histogram (  )  [inline]

default constructor

Histogram ( const Histogram< ValueType, BinSizeType > &  histogram  )  [inline]

copy constructor

Histogram ( BinSizeType  min,
BinSizeType  max,
BinSizeType  bin_size 
) [inline]
virtual ~Histogram (  )  [inline, virtual]

destructor


Member Function Documentation

void applyLogTransformation ( BinSizeType  multiplier  )  [inline]

Transforms the bin values with f(x)=multiplier*log(x+1).

References Histogram< ValueType, BinSizeType >::bins_.

ConstIterator begin (  )  const [inline]

Non-mutable iterator pointing to the first bin.

References Histogram< ValueType, BinSizeType >::bins_.

BinSizeType binSize (  )  const [inline]

returns the bin size

References Histogram< ValueType, BinSizeType >::bin_size_.

ValueType binValue ( BinSizeType  val  )  const [inline]

returns the value of bin corresponding to the value val

Exceptions:
Exception::OutOfRange is thrown if the value is out of valid range

References Histogram< ValueType, BinSizeType >::bins_, and Histogram< ValueType, BinSizeType >::valToBin_().

BinSizeType centerOfBin ( Size  bin_index  )  const [inline]

returns the center position of the bin with the index bin_index

Exceptions:
Exception::IndexOverflow is thrown for invalid indices

References Histogram< ValueType, BinSizeType >::bin_size_, Histogram< ValueType, BinSizeType >::bins_, and Histogram< ValueType, BinSizeType >::min_.

ConstIterator end (  )  const [inline]

Non-mutable iterator pointing after the last bin.

References Histogram< ValueType, BinSizeType >::bins_.

Size inc ( BinSizeType  val,
ValueType  increment = 1 
) [inline]

increases the bin corresponding to value val by increment

Returns:
The index of the increased bin.
Exceptions:
Exception::OutOfRange is thrown if the value is out of valid range

References Histogram< ValueType, BinSizeType >::bins_, and Histogram< ValueType, BinSizeType >::valToBin_().

BinSizeType maxBound (  )  const [inline]

returns the upper bound

References Histogram< ValueType, BinSizeType >::max_.

ValueType maxValue (  )  const [inline]

returns the highest value of all bins

References Histogram< ValueType, BinSizeType >::bins_.

BinSizeType minBound (  )  const [inline]

returns the lower bound

References Histogram< ValueType, BinSizeType >::min_.

ValueType minValue (  )  const [inline]

returns the lowest value of all bins

References Histogram< ValueType, BinSizeType >::bins_.

bool operator!= ( const Histogram< ValueType, BinSizeType > &  histogram  )  const [inline]

Inequality operator.

References Histogram< ValueType, BinSizeType >::operator==().

Histogram& operator= ( const Histogram< ValueType, BinSizeType > &  histogram  )  [inline]
bool operator== ( const Histogram< ValueType, BinSizeType > &  histogram  )  const [inline]
ValueType operator[] ( Size  index  )  const [inline]

returns the value of bin index

Exceptions:
Exception::IndexOverflow is thrown for invalid indices

References Histogram< ValueType, BinSizeType >::bins_.

void reset ( BinSizeType  min,
BinSizeType  max,
BinSizeType  bin_size 
) [inline]

resets the histogram with the given range and bin size

Exceptions:
Exception::OutOfRange is thrown if bin_size negative or zero

References Histogram< ValueType, BinSizeType >::bin_size_, Histogram< ValueType, BinSizeType >::bins_, Histogram< ValueType, BinSizeType >::max_, and Histogram< ValueType, BinSizeType >::min_.

Size size (  )  const [inline]

returns the number of bins

References Histogram< ValueType, BinSizeType >::bins_.

Size valToBin_ ( BinSizeType  val  )  const [inline, protected]

Member Data Documentation

BinSizeType bin_size_ [protected]
std::vector<ValueType> bins_ [protected]
BinSizeType max_ [protected]
BinSizeType min_ [protected]

OpenMS / TOPP release 1.10.0 Documentation generated on Thu Mar 7 2013 09:43:00 using doxygen 1.7.1