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]));
97 void getHistogram( std::vector<double> &x, std::vector<double> &hits )
const;
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,...
This class provides an easy way of computing histograms for unidimensional real valued variables.
void add(const double x)
Add an element to the histogram.
int getBinCount(const size_t index) const
Retuns the elements count into the selected bin index, where first one is 0.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
size_t m_count
The total elements count.
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:
static CHistogram createWithFixedWidth(double min, double max, double binWidth)
Constructor with a fixed bin width.
void getHistogram(std::vector< double > &x, std::vector< double > &hits) const
Returns the list of bin centers & hit counts.
CHistogram(const double min, const double max, const size_t nBins)
Constructor.
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.20 for MRPT 1.4.0 SVN: at Thu Aug 27 02:40:23 UTC 2020 | | |