Alexandria 2.31.0
SDC-CH common library for the Euclid project
|
#include <Histogram.h>
Public Member Functions | |
BinStrategy () | |
virtual | ~BinStrategy ()=default |
size_t | getBinCount () const |
virtual ssize_t | getBinIndex (VarType value) const =0 |
virtual std::vector< VarType > | getEdges () const |
virtual std::pair< VarType, VarType > | getBinEdges (size_t i) const |
virtual VarType | getEdge (size_t e) const =0 |
virtual VarType | getBin (size_t i) const |
Protected Attributes | |
size_t | m_nbins |
Different binning strategies must implement this interface, plus a templated method called computeBins, which should operate over a pair of (begin, end) iterators.
VarType | The type of the continuous variable. Must be an arithmetic type (either integral or floating point) |
Definition at line 50 of file Histogram.h.
|
inline |
Constructor.
m_nbins is to be computed by the concrete implementations
Definition at line 57 of file Histogram.h.
|
virtualdefault |
Destructor
|
inlinevirtual |
Get the center of the bin i
i | Bin index |
The default implementation returns the midpoint between the edges. Concrete implementations can override this with a direct calculation.
Definition at line 121 of file Histogram.h.
References Euclid::Histogram::BinStrategy< VarType >::getBinEdges().
|
inline |
Definition at line 67 of file Histogram.h.
References Euclid::Histogram::BinStrategy< VarType >::m_nbins.
|
inlinevirtual |
Get the two edges corresponding to the bin i
i | The bin index |
Reimplemented in Euclid::Histogram::Binning::EdgeVector< VarType >, Euclid::Histogram::Binning::Scott< VarType >, and Euclid::Histogram::Binning::Sqrt< VarType >.
Definition at line 101 of file Histogram.h.
References Euclid::Histogram::BinStrategy< VarType >::getEdge(), and std::make_pair().
Referenced by Euclid::Histogram::BinStrategy< VarType >::getBin().
|
pure virtual |
Get the bin index corresponding to the given value
value | The value to map to a bin |
Implemented in Euclid::Histogram::Binning::EdgeVector< VarType >, Euclid::Histogram::Binning::Scott< VarType >, and Euclid::Histogram::Binning::Sqrt< VarType >.
|
pure virtual |
Get the edge value e. Note that there are always one more edge than bins: i.e. the bin 0 has the edges (0, 1), the bin 1 the edges (1, 2), etc...
Implemented in Euclid::Histogram::Binning::EdgeVector< VarType >, Euclid::Histogram::Binning::Scott< VarType >, and Euclid::Histogram::Binning::Sqrt< VarType >.
Referenced by Euclid::Histogram::BinStrategy< VarType >::getBinEdges().
|
inlinevirtual |
The default implementation is based on getEdge, but the specific implementations can override an do something more optimal
Definition at line 87 of file Histogram.h.
References std::vector< T >::begin(), std::vector< T >::end(), std::generate(), and Euclid::Histogram::BinStrategy< VarType >::m_nbins.
|
protected |
Definition at line 127 of file Histogram.h.
Referenced by Euclid::Histogram::Binning::Scott< VarType >::computeBins(), Euclid::Histogram::Binning::Sqrt< VarType >::computeBins(), Euclid::Histogram::Binning::EdgeVector< VarType >::EdgeVector(), Euclid::Histogram::BinStrategy< VarType >::getBinCount(), Euclid::Histogram::Binning::Scott< VarType >::getBinIndex(), Euclid::Histogram::Binning::Sqrt< VarType >::getBinIndex(), and Euclid::Histogram::BinStrategy< VarType >::getEdges().