41 double median_out = 0.0;
55 std::sort(vec_sorted.begin(), vec_sorted.end());
57 median_out = vec_sorted.at(vec_sorted.size() / 2);
71 double mean_out = 0.0;
79 mean_out = std::accumulate(
95 double std_dev_out = 0.0;
105 double sum_of_sq_diffs = 0;
110 sum_of_sq_diffs += std::pow(*it -
mean, 2);
112 std_dev_out = sqrt(sum_of_sq_diffs /
m_win_size);
130 return measurement > low_lim && measurement < upper_lim;
136 double threshold = this->
getMean();
137 return (value > threshold);
175 if (new_size < curr_size)
196 size_t sliding_win_size =
197 source.read_int(section,
"sliding_win_size", 10,
false);
207 "-----------[ %s: Sliding Window Properties ]-----------\n",
209 out.
printf(
"Measurements Vector: \n");
213 out.
printf(
"\t%.2f\n", *it);
void resizeWindow(size_t new_size)
Resize the window.
std::vector< double > m_measurements_vec
void loadFromConfigFile(const mrpt::utils::CConfigFileBase &source, const std::string §ion)
This method load the options from a ".ini"-like file or memory-stored string list.
const Scalar * const_iterator
This class allows loading and storing values and vectors of different types from a configuration text...
bool evaluateMeasurementInGaussian(double measurement)
Determine whether the incoming measurement is inside the [-3sigma, +3sigma] boundaries from the curre...
bool evaluateMeasurementAbove(double value)
Determine whether the incoming measurement is over the current mean value.
void addNewMeasurement(double measurement)
Update the sliding window by appending a new measurement.
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
bool m_is_initialized
flag is raised the first time that TSlidingWindow::addNewMeasurement is called
SLAM methods related to graphs of pose constraints.
double getStdDev()
Return the Standard deviation of the current measurement vector.
double m_mean_cached
Cached mean value.
double getMean()
Return the current mean value.
double m_std_dev_cached
Cached version of the standard deviation.
GLsizei const GLchar ** string
bool m_median_updated
Is the median up-to-date?
TSlidingWindow(std::string name="window")
void dumpToTextStream(mrpt::utils::CStream &out) const
This method should clearly display all the contents of the structure in textual form, sending it to a CStream.
GLuint const GLchar * name
GLsizei GLsizei GLchar * source
std::string m_name
Name of the TSlidingWindow Instance at hand.
bool evaluateMeasurementBelow(double value)
Determine whether the incoming measurement is less or equal to the current mean value.
GLsizei const GLfloat * value
size_t getWindowSize() const
Return the size of the window.
bool m_mean_updated
Is the mean up-to-date?
bool windowIsFull() const
Check if the window has reached its limit.
double m_median_cached
Cached median value.
EIGEN_STRONG_INLINE double mean() const
Computes the mean of the entire matrix.
double getMedian()
Return the current median value.
virtual int printf(const char *fmt,...) MRPT_printf_format_check(2
Writes a string to the stream in a textual form.
bool m_std_dev_updated
Is the standard deviation up-to-date?