Go to the documentation of this file.
33 map<string, CVectorDouble>
results;
37 #define TEST_RESAMPLING(ALGOR) \
38 mrpt::system::deleteFile(#ALGOR); \
43 for (size_t i = 0; i < N_TESTS; i++) \
45 mrpt::random::getRandomGenerator().drawUniformVector( \
46 log_ws, MIN_LOG_WEIG, 0.0); \
47 CParticleFilterCapable::log2linearWeights(log_ws, lin_ws); \
48 CParticleFilterCapable::computeResampling( \
49 CParticleFilter::ALGOR, log_ws, out_indxs); \
50 hist_parts = mrpt::math::histogram(out_indxs, 0, M - 1, M, true); \
51 vector<double> errs_hist = lin_ws - hist_parts; \
52 ERR_MEANs.push_back(mrpt::math::mean(errs_hist)); \
53 ERR_STDs.push_back(mrpt::math::stddev(errs_hist)); \
55 printf("%s: ERR_MEAN %e\n", #ALGOR, mrpt::math::mean(ERR_MEANs)); \
56 printf("%s: ERR_STD %f\n", #ALGOR, mrpt::math::mean(ERR_STDs)); \
57 results[#ALGOR].push_back(mrpt::math::mean(ERR_STDs));
64 vector<double> log_ws;
65 std::vector<size_t> out_indxs;
73 vector<double> lin_ws;
74 vector<double> hist_parts;
75 vector<double> ERR_MEANs;
76 vector<double> ERR_STDs;
90 for (
double LL = -2; LL <= 2.01; LL += 0.08)
92 double L = pow(10.0, LL);
95 printf(
"MIN_LOG_W=%f\n", L);
119 int main(
int argc,
char** argv)
134 cerr <<
"EXCEPCTION: " << e.what() << endl;
139 cerr <<
"Untyped excepcion!!";
Column vector, like Eigen::MatrixX*, but automatically initialized to zeros since construction.
map< string, CVectorDouble > results
void randomize(const uint32_t seed)
Initialize the PRNG from the given random seed.
CRandomGenerator & getRandomGenerator()
A static instance of a CRandomGenerator class, for use in single-thread applications.
The namespace for Bayesian filtering algorithm: different particle filters and Kalman filter algorith...
This base provides a set of functions for maths stuff.
A namespace of pseudo-random numbers generators of diferent distributions.
bool vectorToTextFile(const std::vector< float > &vec, const std::string &fileName, bool append=false, bool byRows=false)
A useful function for debugging, which saves a std::vector into a text file (compat.
#define TEST_RESAMPLING(ALGOR)
This namespace provides a OS-independent interface to many useful functions: filenames manipulation,...
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 | |