47 CHistogram(
const double min,
const double max,
const size_t nBins);
63 void add(
const double x);
66 template <
typename Derived>
67 inline void add(
const Eigen::MatrixBase<Derived> &
x)
69 const size_t N =
x.size();
70 for (
size_t i=0;i<N;i++)
71 this->add(static_cast<const double>(
x(i)));
76 inline void add(
const std::vector<T> &
x)
78 const size_t N =
x.size();
79 for (
size_t i=0;i<N;i++)
80 this->add(static_cast<const double>(
x[i]));
86 size_t getBinCount(
const size_t index)
const;
92 double getBinRatio(
const size_t index)
const;
97 void getHistogram( std::vector<double> &
x, std::vector<double> &hits )
const;
102 void getHistogramNormalized( std::vector<double> &
x, std::vector<double> &hits )
const;
This class provides an easy way of computing histograms for unidimensional real valued variables...
std::vector< size_t > m_bins
The bins counter.
void add(const Eigen::MatrixBase< Derived > &x)
Add all the elements from a MRPT container to the histogram.
void clear()
Clear the contents of this container.
void add(const std::vector< T > &x)
double m_binSizeInv
((max-min)/nBins)^-1
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
size_t m_count
The total elements count.
static CHistogram createWithFixedWidth(double min, double max, double binWidth)
Constructor with a fixed bin width.