gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > > Class Template Reference
[Histograms.]

#include <histogram_2d.hh>

Collaboration diagram for gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >:

Collaboration graph
[legend]
List of all members.

Detailed Description

template<>
class gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >

A 2D histogram class.


Public Types

typedef std::pair< double,
double > 
value_type
typedef std::pair< size_t,
size_t > 
bin_type

Public Member Functions

 histogram (const bin_type &bins, bool zero=true)
 histogram (const bin_type &bins, const value_type &min, const value_type &max)
 histogram (const bin_type &bins, const double *xranges, const double *yranges)
 histogram (const std::vector< double > &xranges, const std::vector< double > &yranges)
 histogram (const bin_type &bins, const std::vector< value_type > &ranges)
 histogram (const histogram< value_type, bin_type > &other)
virtual ~histogram ()
bool range (const value_type &min, const value_type &max)
bool range (const double *xranges, const double *yranges)
bool range (const std::vector< double > &xranges, const std::vector< double > &yranges)
value_type max () const
value_type min () const
bin_type bins () const
void reset ()
bool fill (const value_type &x)
bool fill (const value_type &x, double w)
double bin_content (const bin_type &bin) const
bool bin_range (const bin_type &bin, value_type &min, value_type &max) const
value_type bin_min (const bin_type &bin) const
value_type bin_max (const bin_type &bin) const
bin_type bin_number (const value_type &x) const
double max_content () const
double min_content () const
bin_type max_content_bin () const
bin_type min_content_bin () const
value_type mean () const
value_type sigma () const
double covariance () const
double sum () const
bool compatible (const histogram< value_type, bin_type > &other)
const double & operator[] (const bin_type &bin) const
double & operator[] (const bin_type &bin)
histogram< value_type, bin_type > & operator= (const histogram< value_type, bin_type > &other)
histogram< value_type, bin_type > & operator+= (const histogram< value_type, bin_type > &other)
histogram< value_type, bin_type > & operator-= (const histogram< value_type, bin_type > &other)
histogram< value_type, bin_type > & operator *= (const histogram< value_type, bin_type > &other)
histogram< value_type, bin_type > & operator/= (const histogram< value_type, bin_type > &other)
histogram< value_type, bin_type > & operator+= (double x)
histogram< value_type, bin_type > & operator-= (double x)
histogram< value_type, bin_type > & operator *= (double x)
histogram< value_type, bin_type > & operator/= (double x)
bool write (FILE *f) const
bool read (FILE *f)
bool print (FILE *s, const char *r="%g", const char *b="%f") const
bool scan (FILE *s)

Protected Attributes

gsl_histogram2d * _histogram

Friends

class pdf

Classes

class  pdf
 Probablity distribution function from a 2D histogram. More...


Member Typedef Documentation

typedef std::pair<size_t,size_t> gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::bin_type
 

Bin type.

typedef std::pair<double,double> gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::value_type
 

Value type.


Constructor & Destructor Documentation

gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::histogram const bin_type bins,
bool  zero = true
[inline]
 

Constructor Make a histogram with bins.

Parameters:
bins The number of bins in each dimension
zero Zero the histogram?

gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::histogram const bin_type bins,
const value_type min,
const value_type max
[inline]
 

Constructor.

Creates a histogram with bins evenly spaced bins in the ranges from min to max

        std::pair<size_t,size_t> bins(3,4);
        std::pair<double,double> min(1,10);
        std::pair<double,double> max(3,15);
        gslmm::histogram<std::pair<size_t,size_t>,std::pair<double,double> >
          h(bins, min, max);
Parameters:
bins Number of bins
min Minimum of the histogram
max Maximum of the histogram

gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::histogram const bin_type bins,
const double *  xranges,
const double *  yranges
[inline]
 

Construct a histogram with $ N \times M$ bins, where $ N$ is bins.first and $ M$ is bins.second, variable ranges.

Notice, that bins should be the size of the arrays minus 1 xranges and yranges. So, to construct a histogram with logarithmic scales, one would do

        std::pair<size_t,size_t> bins(2,3);
        double x[] = { 1, 10, 100 };
        double y[] = { 10, 100, 1000, 10000 };
        gslmm::histogram<std::pair<size_t,size_t>,std::pair<double,double> >
          h(bins, x, y);
Parameters:
bins The number of bins in each dimenstion
xranges The ranges in X
yranges The ranges in Y

gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::histogram const std::vector< double > &  xranges,
const std::vector< double > &  yranges
[inline]
 

Constructor Allocates.

        std::vector<double> x(3);
        std::vector<double> y(4);
        x[0] =  1; x[1] =  10; x[2] =  100;
        y[0] = 10; y[1] = 100; y[2] = 1000; y[3] = 10000;
        gslmm::histogram<std::pair<size_t,size_t>,std::pair<double,double> >
          h(x, y);
Parameters:
xranges The ranges in X
yranges The ranges in Y

gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::histogram const bin_type bins,
const std::vector< value_type > &  ranges
[inline]
 

Construct a histogram with variable ranges.

Note, that there doesn't have to be the same number of bins in each dimension. It's enough to specify the number of bins for each dimension seperately, like

        std::pair<size_t,size_t>                bins(2,3);
        std::vector<std::pair<double,double> >  
          ranges(std::max(bins.first, bins.second));
        ranges[0].first  = 1;
        ranges[0].second = 10;
        ranges[1].first  = 10;
        ranges[1].second = 100;
        ranges[2].first  = 100;
        ranges[2].second = 1000;
        ranges[3].second = 10000;
        gslmm::histogram<std::pair<size_t,size_t>,std::pair<double,double> >
          h(bins, ranges);
This will create a histogram with the X ranges $[1,10),[10,100]$ and the Y ranges $[10,100),[100,1000),[1000,10000]$
Parameters:
bins The number of bins in each dimension.
ranges the ranges.

gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::histogram const histogram< value_type, bin_type > &  other  )  [inline]
 

Copy constructor.

gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::~histogram  )  [inline, virtual]
 

Destructor.


Member Function Documentation

double gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::bin_content const bin_type bin  )  const [inline]
 

Get the bin contents.

histogram< std::pair< double, double >, std::pair< size_t, size_t > >::value_type gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::bin_max const bin_type bin  )  const [inline]
 

Get the bin range.

histogram< std::pair< double, double >, std::pair< size_t, size_t > >::value_type gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::bin_min const bin_type bin  )  const [inline]
 

Get the bin range.

histogram< std::pair< double, double >, std::pair< size_t, size_t > >::bin_type gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::bin_number const value_type x  )  const [inline]
 

Get bin number corresponding to x and y.

bool gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::bin_range const bin_type bin,
value_type min,
value_type max
const [inline]
 

Get the bin range.

histogram< std::pair< double, double >, std::pair< size_t, size_t > >::bin_type gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::bins  )  const [inline]
 

Get the number of bins.

bool gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::compatible const histogram< value_type, bin_type > &  other  )  [inline]
 

Check if to histograms have compatible ranges.

double gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::covariance  )  const [inline]
 

Get x,y covariance.

bool gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::fill const value_type x,
double  w
[inline]
 

Increment a bin with a weight.

bool gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::fill const value_type x  )  [inline]
 

Increment a bin.

histogram< std::pair< double, double >, std::pair< size_t, size_t > >::value_type gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::max  )  const [inline]
 

Get the maximum of the range.

double gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::max_content  )  const [inline]
 

Get the value of the maximal bin.

histogram< std::pair< double, double >, std::pair< size_t, size_t > >::bin_type gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::max_content_bin  )  const [inline]
 

Get the bin number of the maximal bin.

histogram< std::pair< double, double >, std::pair< size_t, size_t > >::value_type gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::mean  )  const [inline]
 

Get the mean of the histogram.

histogram< std::pair< double, double >, std::pair< size_t, size_t > >::value_type gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::min  )  const [inline]
 

Get the minimum of the range.

double gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::min_content  )  const [inline]
 

Get the value of the minimal bin.

histogram< std::pair< double, double >, std::pair< size_t, size_t > >::bin_type gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::min_content_bin  )  const [inline]
 

Get the bin number of the minimal bin.

histogram< std::pair< double, double >, std::pair< size_t, size_t > > & gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::operator *= double  x  )  [inline]
 

Scale this histogram with a constant.

histogram< std::pair< double, double >, std::pair< size_t, size_t > > & gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::operator *= const histogram< value_type, bin_type > &  other  )  [inline]
 

Multiply by the contents of a compatible histogram.

histogram< std::pair< double, double >, std::pair< size_t, size_t > > & gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::operator+= double  x  )  [inline]
 

Add a constant to the bins.

histogram< std::pair< double, double >, std::pair< size_t, size_t > > & gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::operator+= const histogram< value_type, bin_type > &  other  )  [inline]
 

Add the contents of a compatible histogram.

histogram< std::pair< double, double >, std::pair< size_t, size_t > > & gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::operator-= double  x  )  [inline]
 

Subtract a constant from this histogram.

histogram< std::pair< double, double >, std::pair< size_t, size_t > > & gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::operator-= const histogram< value_type, bin_type > &  other  )  [inline]
 

Subtract the contents of a compatible histogram.

histogram< std::pair< double, double >, std::pair< size_t, size_t > > & gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::operator/= double  x  )  [inline]
 

Scale this histogram with a constant.

histogram< std::pair< double, double >, std::pair< size_t, size_t > > & gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::operator/= const histogram< value_type, bin_type > &  other  )  [inline]
 

Divide with the contents of a compatible histogram.

histogram< std::pair< double, double >, std::pair< size_t, size_t > > & gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::operator= const histogram< value_type, bin_type > &  other  )  [inline]
 

Assign one histogram to another.

double & gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::operator[] const bin_type bin  )  [inline]
 

Bin content.

const double & gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::operator[] const bin_type bin  )  const [inline]
 

Bin content.

bool gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::print FILE *  s,
const char *  r = "%g",
const char *  b = "%f"
const [inline]
 

print to a (C) stream.

Parameters:
s The stream to print on.
r The format of the write for the ranges.
b The format of the write for the bins.
Returns:
true on success, false otherwise

bool gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::range const std::vector< double > &  xranges,
const std::vector< double > &  yranges
[inline]
 

Set the ranges.

bool gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::range const double *  xranges,
const double *  yranges
[inline]
 

Set the ranges.

bool gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::range const value_type min,
const value_type max
[inline]
 

Set the ranges.

bool gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::read FILE *  f  )  [inline]
 

Read into this object from a (C) file.

Parameters:
f The (C) file to read from.
Returns:
true on success, false otherwise

void gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::reset  )  [inline]
 

Reset all bins to zero.

bool gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::scan FILE *  s  )  [inline]
 

Read into this object from a (C) stream.

Parameters:
s Stream to read from.
Returns:
true on success, false otherwise

histogram< std::pair< double, double >, std::pair< size_t, size_t > >::value_type gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::sigma  )  const [inline]
 

Get the spread of the histogram.

double gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::sum  )  const [inline]
 

Get the sum of the histogram.

bool gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::write FILE *  f  )  const [inline]
 

Write this object to a (C) file.

Parameters:
f The (C) file to write to
Returns:
true on success, false otherwise


Friends And Related Function Documentation

friend class pdf [friend]
 


Member Data Documentation

gsl_histogram2d* gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::_histogram [protected]
 

The low level histogram.


The documentation for this class was generated from the following file:
Top of page Last update Tue May 9 10:11:39 2006
Christian Holm
Created by DoxyGen 1.4.6