23 m_min(
min), m_max(max), m_bins(nBins,0), m_count(0)
79 const size_t N=
m_bins.size();
81 for (
size_t i=0;i<N;i++) hits[i] = static_cast<double>(
m_bins[i]);
90 const size_t N =
m_bins.size();
95 for (
size_t i=0;i<N;i++)
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
#define THROW_EXCEPTION(msg)
std::vector< size_t > m_bins
The bins counter.
CHistogram(const double min, const double max, const size_t nBins)
Constructor.
double m_binSizeInv
((max-min)/nBins)^-1
This base provides a set of functions for maths stuff.
void add(const double x)
Add an element to the histogram.
void linspace(T first, T last, size_t count, VECTOR &out_vector)
Generates an equidistant sequence of numbers given the first one, the last one and the desired number...
void getHistogram(std::vector< double > &x, std::vector< double > &hits) const
Returns the list of bin centers & hit counts.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
size_t m_count
The total elements count.
size_t getBinCount(const size_t index) const
Retuns the elements count into the selected bin index, where first one is 0.
double getBinRatio(const size_t index) const
Retuns the ratio in [0,1] range for the selected bin index, where first one is 0. ...
void clear()
Clear the histogram:
double m_max
The histogram limits.
void getHistogramNormalized(std::vector< double > &x, std::vector< double > &hits) const
Returns the list of bin centers & hit counts, normalized such as the integral of the histogram...