|
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 > >:
[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
Constructor & Destructor Documentation
|
Constructor Make a histogram with bins.
- Parameters:
-
| bins | The number of bins in each dimension |
| zero | Zero the histogram? |
|
|
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 bins, where is bins.first and 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 |
|
|
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 and the Y ranges - Parameters:
-
| bins | The number of bins in each dimension. |
| ranges | the ranges. |
|
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 bin number corresponding to x and y.
|
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] |
|
|
Check if to histograms have compatible ranges.
|
double gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::covariance |
( |
|
) |
const [inline] |
|
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.
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
Divide with the contents of a compatible histogram.
|
|
Assign one histogram to another.
|
double & gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::operator[] |
( |
const bin_type & |
bin |
) |
[inline] |
|
const double & gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::operator[] |
( |
const bin_type & |
bin |
) |
const [inline] |
|
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] |
|
bool gslmm::histogram< std::pair< double, double >, std::pair< size_t, size_t > >::range |
( |
const double * |
xranges, |
|
|
const double * |
yranges |
|
) |
[inline] |
|
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] |
|
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:
-
- 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
The documentation for this class was generated from the following file:
|