25 #ifndef WHISTOGRAMND_H
26 #define WHISTOGRAMND_H
31 #include <boost/array.hpp>
40 template< std::
size_t N,
typename T =
double >
64 WHistogramND( TArray min, TArray max, SizeArray buckets );
85 virtual size_t operator()( SizeArray index )
const = 0;
92 virtual size_t size()
const;
125 virtual boost::array< std::pair< T, T >, N >
getIntervalForIndex( SizeArray index )
const = 0;
143 void reset( TArray min, TArray max, SizeArray buckets );
168 template< std::
size_t N,
typename T >
173 template< std::
size_t N,
typename T >
176 reset( min, max, buckets );
179 template< std::
size_t N,
typename T >
185 WAssert( min.size() == max.size(),
"Error, WHistogram initialized with wrong dimensionality" );
186 for(
size_t i = 0; i < min.size(); ++i )
188 WAssert( min[i] <= max[i],
"Error, WHistogram has at least one dimension where max is smaller than min" );
193 for(
typename SizeArray::const_iterator cit = buckets.begin(); cit != buckets.end(); ++cit )
199 template< std::
size_t N,
typename T >
204 template< std::
size_t N,
typename T >
213 template< std::
size_t N,
typename T >
219 template< std::
size_t N,
typename T >
225 template< std::
size_t N,
typename T >
231 #endif // WHISTOGRAMND_H
This template should handly arbitrary N-dimensional histograms.
virtual size_t size() const
Returns the number of buckets in the HistogramND with the actual mapping.
virtual ~WHistogramND()
Default destructor.
size_t m_nbBuckets
Total number of buckets.
TArray m_max
The biggest value in each dimension.
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 size_t operator()(SizeArray index) const =0
Get the count of the specified bucket.
boost::array< T, N > TArray
Shorthand for N-dimensional values of type T.
virtual T getBucketSize(SizeArray index) const =0
Return the measure of one specific bucket.
TArray m_min
The smallest value in each dimension.
void reset(TArray min, TArray max, SizeArray buckets)
Initializes all members.
virtual TArray getMaxima() const
Returns the maximum value(s).
boost::array< size_t, N > SizeArray
Shorthand for N-dimensional indices, counter, etc.
WHistogramND()
Default constructor is protected to allow subclassing constructors not to use initialization lists wh...
SizeArray m_buckets
The number of buckets.
virtual TArray getMinima() const
Returns the minimum value(s).