![]() |
Elementa v8.0.0
Minimalistic library for any C++ application (C++11 and up)
|
Definition of the support (bins) of a histogram. More...
Definition of the support (bins) of a histogram.
The definition consists of a vector of increasing values that define the left boundaries of the bins (to be considered open intervals), plus the rightmost boundary (also open), plus possible infinite bins at the left and right of the finite bins. If the finite bins is empty, the definition is considered to cover from -inf to +inf in a single bin.
Definition at line 62 of file histograms.h.
#include "histograms.h"


Static Public Member Functions | |
| static size_t | eq_freq_nbins (size_t ndata) |
| Return a reasonable number of bins for a sample with NDATA data. More... | |
Public Member Functions | |
| BinDef (void) | |
| Default constructor: one bin from -inf to +inf. More... | |
| BinDef (double leftmost, double binwidth_or_rightmost, size_t numbins, bool iswidthorright=true, bool addleftinf=false, bool addrightinf=false) | |
| Constructor for periodic bins. More... | |
| BinDef (long leftcenter, long rightcenter, bool addleftinf=false, bool addrightinf=false) | |
| Constructor for bins that cover discrete supports. More... | |
| size_t | numbins (void) const noexcept |
| Return the total number of bins, including infinite ones. More... | |
| bool | entireReals (void) const noexcept |
| Return TRUE if there is only one bin covering from -inf to +inf. More... | |
| void | binBounds (size_t ind, double &left, double &right) const |
| Fill LEFT and RIGHT with the boundaries of the IND-th bin. More... | |
| bool | whichBin (double v, size_t &ind) const noexcept |
| Fill IND with the index of the bin where V lies. | |
| std::string | to_string (void) const |
| Return an informative text with the summary of the bin definition. | |
|
inline |
Default constructor: one bin from -inf to +inf.
Definition at line 77 of file histograms.h.
| elementa::math::stats::Histogram::BinDef::BinDef | ( | double | leftmost, |
| double | binwidth_or_rightmost, | ||
| size_t | numbins, | ||
| bool | iswidthorright = true, |
||
| bool | addleftinf = false, |
||
| bool | addrightinf = false |
||
| ) |
Constructor for periodic bins.
| leftmost | is the finite (not included) left boundary of the first bin. |
| binwidth_or_rightmost | is, if iswidthorright == TRUE, the width of all bins (it cannot be infinity or 0.0), and, if iswidthorright == FALSE the rightmost boundary of the finite bins. |
| numbins | is the number of finite bins (it cannot be 0). |
| addleftinf | is TRUE for adding a bin from -inf to the leftmost. |
| addrightinf | is TRUE for adding a bin from the rightmost to +inf. |
| elementa::math::stats::Histogram::BinDef::BinDef | ( | long | leftcenter, |
| long | rightcenter, | ||
| bool | addleftinf = false, |
||
| bool | addrightinf = false |
||
| ) |
Constructor for bins that cover discrete supports.
| leftcenter | is the position of the first integral value that must be a the center of a bin and separated from the two adjacent integral values. |
| rightcenter | is the center of the rightmost bin. |
| addleftinf | is TRUE for adding a bin from -inf to the leftmost boundary. |
|
inlinestatic |
Return a reasonable number of bins for a sample with NDATA data.
This is calculated for dividing the histogram into close-to-equal- frequency bins, according to "Goodness-of-fit-techniques" (Ralph B. D'Agostino and Michael A. Stephens -eds-, 1986), p. 70.
Definition at line 70 of file histograms.h.
|
inlinenoexcept |
Return the total number of bins, including infinite ones.
Definition at line 105 of file histograms.h.
Referenced by elementa::math::stats::Histogram::Histogram().
|
inlinenoexcept |
Return TRUE if there is only one bin covering from -inf to +inf.
This is necessary since there are definitions with 1 bin that is finite and does not cover the real line.
Definition at line 110 of file histograms.h.
Referenced by elementa::math::stats::Histogram::Histogram().
| void elementa::math::stats::Histogram::BinDef::binBounds | ( | size_t | ind, |
| double & | left, | ||
| double & | right | ||
| ) | const |
Fill LEFT and RIGHT with the boundaries of the IND-th bin.
Take into account infinite bins. IND must go from 0 to numbins()-1. Throw if IND is out of range.