IT++ Logo
Public Member Functions | List of all members
itpp::Histogram< Num_T > Class Template Reference

Histogram computation class. More...

#include <itpp/stat/histogram.h>

Public Member Functions

 Histogram (Num_T from=Num_T(0), Num_T to=Num_T(99), int n_bins=100)
 
 ~Histogram ()
 Default destructor.
 
void setup (Num_T from, Num_T to, int n_bins)
 Histogram setup.
 
void update (Num_T value)
 Histogram update.
 
void update (Vec< Num_T > values)
 Histogram update.
 
void update (Mat< Num_T > values)
 Histogram update.
 
void reset ()
 Bins reset, so accumulation can be restarted.
 
int get_bin (int ix) const
 Access to single bin counter.
 
ivec get_bins () const
 Access to histogram as a vector.
 
Vec< Num_T > get_bin_centers () const
 Access to bin center values (all bins)
 
Num_T get_bin_center (int ix) const
 Access to bin center (single bin)
 
Vec< Num_T > get_bin_lefts () const
 Access to left boundary of bin intervals (all bins)
 
Num_T get_bin_left (int ix) const
 Access to left boundary of single bin.
 
Vec< Num_T > get_bin_rights () const
 Access to right boundary of bin intervals (all bins)
 
Num_T get_bin_right (int ix) const
 Access to right boundary of single bin.
 
vec get_pdf () const
 Experimental Probability Density Function (PDF) computation.
 
vec get_cdf () const
 Experimental Cumulative Density Function (CDF) computation.
 
int bins_num () const
 Current number of bins.
 
int trials_num () const
 Current trials counter.
 

Detailed Description

template<typename Num_T>
class itpp::Histogram< Num_T >

Histogram computation class.

Author
Andy Panov

The Histogram class counts the number of observations of arbitrary numerical types that fall into specified bins. Centers of the leftmost and rightmost bin along with a total number of bins are passed to a histogram object as constructor parameters. Histogram counters are updated when calling update() method. It is possible to access bin counters and bin interval parameters for all bins at once or separately for each bin.

Example:

// Create histogram with 100 bins spanning from 0 to 99 (leftmost bin is
// centered at 0, rightmost bin is centerd at 99).
Histogram<double> hist(0, 99, 100);
// Compute histogram of 100 random variables taken from normal distribution
hist.update(randn(100));
// Get position of bin number 5
double bin5_center = hist.get_bin_center(5);
// Get corresponding bin counter
int bin5_counter = hist.get_bin(5);
// Get bin 5 left boundary:
double bin5_left = hist.get_bin_left(5);
// compute PDF & CDF of experimental data
vec my_data_pdf = hist.get_pdf();
vec my_data_cdf = hist.get_cdf();

Definition at line 75 of file histogram.h.


The documentation for this class was generated from the following file:
SourceForge Logo

Generated on Sat Jul 6 2013 10:54:35 for IT++ by Doxygen 1.8.2