template class mrpt::math::CMonteCarlo¶
Montecarlo simulation for experiments in 1D.
Template arguments are:
T: base type, i.e., if an experiment needs to generate random points, then T may be a TPoint3D, and so on.
NUM: the numeric type used to represent the error. Usually, double.
OTHER: an intermediate type, used especially when testing inverse functions. Leave as int or double if you don’t use it.
HOW TO USE THIS CLASS:
Create an instance of the class.
Refill the “valueGenerator” member with an appropriate function.
If your experiment calculates the error directly from the base value, then refill the “errorFun1” member.
Otherwise, if your experiment involves the calculation of some value whom with the experimental function is compared, refill “intermediateFun” and “errorFun2”.
Refill only on of the alternatives.
#include <mrpt/math/CMonteCarlo.h> template <typename T, typename NUM, typename OTHER> class CMonteCarlo { public: // classes class CStatisticalAnalyzer; // fields T(* valueGenerator)(mrpt::random::CRandomGenerator &); NUM(* errorFun1)(const T &); OTHER(* intermediateFun)(const T &); NUM(* errorFun2)(const T &, const OTHER &); // methods NUM doExperiment( size_t N, double& time, bool showInWindow = false ); };