KrisLibrary
1.0.0
|
N-D histogram class. More...
#include <HistogramND.h>
Public Types | |
typedef Vector | Point |
typedef std::vector< int > | Index |
typedef std::vector< size_t > | Size |
typedef UNORDERED_MAP_TEMPLATE< Index, Real, IndexHash > | BucketHash |
Public Member Functions | |
HistogramND (int numDims=0) | |
void | Resize (int numDims) |
resizes to the given number of dimensions, sets one big bucket | |
void | Clear () |
Creates one big bucket. | |
void | Resize (const Size &dims, const Point &min, const Point &max) |
Creates mxnxp uniformly spaced buckets between min,max. | |
void | Resize (const Index &dims, const Point &min, const Point &max) |
void | ResizeToFit (const std::vector< Point > &data, const Size &dims) |
Creates mxnxp uniformly spaced buckets between the min/max of data. | |
void | Fill (Real val=0) |
Fills all buckets with the given value. | |
void | Calculate (const std::vector< Point > &data) |
Calculates the histogram of the data. | |
void | GetRange (const Index &bucket, Point &min, Point &max) const |
Gets the range of the given bucket. | |
void | GetBucket (const Point &val, Index &bucket) const |
void | AddBucket (const Point &val, Real num=1) |
Real | GetBucketCount (const Index &bucket) const |
Real | NumObservations () const |
Public Attributes | |
std::vector< std::vector< Real > > | divs |
BucketHash | buckets |
N-D histogram class.
Uses unordered_map so the histogram can be sparse and of manageable size even when N is large