25 #ifndef WHISTOGRAMND_H
26 #define WHISTOGRAMND_H
30 #include <boost/array.hpp>
38 template< std::
size_t N,
typename T =
double >
90 virtual size_t size()
const;
166 template< std::
size_t N,
typename T >
171 template< std::
size_t N,
typename T >
174 reset( min, max, buckets );
177 template< std::
size_t N,
typename T >
183 WAssert( min.size() == max.size(),
"Error, WHistogram initialized with wrong dimensionality" );
184 for(
size_t i = 0; i < min.size(); ++i )
186 WAssert( min[i] <= max[i],
"Error, WHistogram has at least one dimension where max is smaller than min" );
191 for(
typename SizeArray::const_iterator cit = buckets.begin(); cit != buckets.end(); ++cit )
197 template< std::
size_t N,
typename T >
202 template< std::
size_t N,
typename T >
211 template< std::
size_t N,
typename T >
217 template< std::
size_t N,
typename T >
223 template< std::
size_t N,
typename T >
This template should handly arbitrary N-dimensional histograms.
size_t m_nbBuckets
Total number of buckets.
virtual size_t operator()(SizeArray index) const =0
Get the count of the specified bucket.
void reset(TArray min, TArray max, SizeArray buckets)
Initializes all members.
virtual T getBucketSize(SizeArray index) const =0
Return the measure of one specific bucket.
SizeArray m_buckets
The number of buckets.
boost::array< T, N > TArray
Shorthand for N-dimensional values of type T.
WHistogramND()
Default constructor is protected to allow subclassing constructors not to use initialization lists wh...
WHistogramND(const WHistogramND &hist)
Copy constructor.
TArray m_min
The smallest value in each dimension.
TArray m_max
The biggest value in each dimension.
virtual ~WHistogramND()
Default destructor.
boost::array< size_t, N > SizeArray
Shorthand for N-dimensional indices, counter, etc.
virtual boost::array< std::pair< T, T >, N > getIntervalForIndex(SizeArray index) const =0
Returns the actual (right-open) interval in each dimension associated with the given index.
virtual TArray getMaxima() const
Returns the maximum value(s).
WHistogramND(TArray min, TArray max, SizeArray buckets)
Default constructor.
virtual size_t size() const
Returns the number of buckets in the HistogramND with the actual mapping.
virtual TArray getMinima() const
Returns the minimum value(s).