Go to the documentation of this file.
51 CHistogram(
const double min,
const double max,
const size_t nBins);
57 double min,
double max,
double binWidth);
65 void add(
const double x);
69 template <
typename Derived>
72 const size_t N =
x.size();
73 for (
size_t i = 0; i < N; i++)
74 this->
add(
static_cast<const double>(
x(i)));
79 inline void add(
const std::vector<T>&
x)
81 const size_t N =
x.size();
82 for (
size_t i = 0; i < N; i++)
83 this->
add(
static_cast<const double>(x[i]));
102 void getHistogram(std::vector<double>&
x, std::vector<double>& hits)
const;
109 std::vector<double>&
x, std::vector<double>& hits)
const;
CHistogram(const double min, const double max, const size_t nBins)
Constructor.
double getBinRatio(const size_t index) const
Retuns the ratio in [0,1] range for the selected bin index, where first one is 0.
This class provides an easy way of computing histograms for unidimensional real valued variables.
void clear()
Clear the histogram:
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.
CHistogram createWithFixedWidth(double min, double max, double binWidth)
Constructor with a fixed bin width.
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,...
void add(const Eigen::MatrixBase< Derived > &x)
Add all the elements from a MRPT container to the histogram.
void getHistogram(std::vector< double > &x, std::vector< double > &hits) const
Returns the list of bin centers & hit counts.
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_min
The histogram limits.
double m_binSizeInv
((max-min)/nBins)^-1
void add(const double x)
Add an element to the histogram.
std::vector< size_t > m_bins
The bins counter.
Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST | |