Go to the documentation of this file.
47 CHistogram(
const double min,
const double max,
const size_t nBins);
55 return CHistogram(min,max,
static_cast<size_t>(ceil((max-min)/binWidth)));
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 int 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.
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.
void add(const Eigen::MatrixBase< Derived > &x)
Add all the elements from a MRPT container to the histogram.
void add(const std::vector< T > &x)
This is an overloaded member function, provided for convenience. It differs from the above function o...
double m_binSizeInv
((max-min)/nBins)^-1
std::vector< size_t > m_bins
The bins counter.
Page generated by Doxygen 1.8.17 for MRPT 1.4.0 SVN: at Tue Mar 3 09:15:16 UTC 2020 | | |