A namespace of pseudo-random numbers genrators of diferent distributions.
The central class in this namespace is mrpt::random::CRandomGenerator
Classes | |
class | CRandomGenerator |
A thred-safe pseudo random number generator, based on an internal MT19937 randomness generator. More... | |
Functions | |
ptrdiff_t | random_generator_for_STL (ptrdiff_t i) |
A random number generator for usage in STL algorithms expecting a function like this (eg, random_shuffle): More... | |
template<class MAT > | |
void | matrixRandomUni (MAT &matrix, const double unif_min=0, const double unif_max=1) |
Fills the given matrix with independent, uniformly distributed samples. More... | |
template<class T > | |
void | vectorRandomUni (std::vector< T > &v_out, const T &unif_min=0, const T &unif_max=1) |
Fills the given matrix with independent, uniformly distributed samples. More... | |
template<class MAT > | |
void | matrixRandomNormal (MAT &matrix, const double mean=0, const double std=1) |
Fills the given matrix with independent, normally distributed samples. More... | |
template<class T > | |
void | vectorRandomNormal (std::vector< T > &v_out, const T &mean=0, const T &std=1) |
Generates a random vector with independent, normally distributed samples. More... | |
void | Randomize (const uint32_t seed) |
Randomize the generators. More... | |
void | Randomize () |
template<class T > | |
void | randomPermutation (const std::vector< T > &in_vector, std::vector< T > &out_result) |
Returns a random permutation of a vector: all the elements of the input vector are in the output but at random positions. More... | |
template<typename T > | |
void | randomNormalMultiDimensional (const mrpt::math::CMatrixTemplateNumeric< T > &cov, std::vector< T > &out_result) |
Generate multidimensional random samples according to a given covariance matrix. More... | |
template<typename T > | |
void | randomNormalMultiDimensionalMany (const mrpt::math::CMatrixTemplateNumeric< T > &cov, size_t desiredSamples, std::vector< std::vector< T > > &ret, std::vector< T > *samplesLikelihoods=NULL) |
Generate a given number of multidimensional random samples according to a given covariance matrix. More... | |
template<typename T , typename MATRIXLIKE > | |
void | randomNormalMultiDimensionalMany (const MATRIXLIKE &cov, size_t desiredSamples, std::vector< std::vector< T > > &ret) |
Generate multidimensional random samples according to a given covariance matrix. More... | |
template<typename T , typename MATRIXLIKE > | |
void | randomNormalMultiDimensional (const MATRIXLIKE &cov, std::vector< T > &out_result) |
Generate multidimensional random samples according to a given covariance matrix. More... | |
Variables | |
BASE_IMPEXP CRandomGenerator | randomGenerator |
A static instance of a CRandomGenerator class, for use in single-thread applications. More... | |
void mrpt::random::matrixRandomNormal | ( | MAT & | matrix, |
const double | mean = 0 , |
||
const double | std = 1 |
||
) |
Fills the given matrix with independent, normally distributed samples.
Matrix classes can be mrpt::math::CMatrixTemplateNumeric or mrpt::math::CMatrixFixedNumeric
Definition at line 345 of file RandomGenerators.h.
References mrpt::math::mean().
void mrpt::random::matrixRandomUni | ( | MAT & | matrix, |
const double | unif_min = 0 , |
||
const double | unif_max = 1 |
||
) |
Fills the given matrix with independent, uniformly distributed samples.
Matrix classes can be mrpt::math::CMatrixTemplateNumeric or mrpt::math::CMatrixFixedNumeric
Definition at line 316 of file RandomGenerators.h.
|
inline |
A random number generator for usage in STL algorithms expecting a function like this (eg, random_shuffle):
Definition at line 306 of file RandomGenerators.h.
|
inline |
Randomize the generators.
A seed can be providen, or a current-time based seed can be used (default)
Definition at line 372 of file RandomGenerators.h.
|
inline |
Definition at line 375 of file RandomGenerators.h.
void mrpt::random::randomNormalMultiDimensional | ( | const mrpt::math::CMatrixTemplateNumeric< T > & | cov, |
std::vector< T > & | out_result | ||
) |
Generate multidimensional random samples according to a given covariance matrix.
std::exception | On invalid covariance matrix |
Definition at line 395 of file RandomGenerators.h.
void mrpt::random::randomNormalMultiDimensional | ( | const MATRIXLIKE & | cov, |
std::vector< T > & | out_result | ||
) |
Generate multidimensional random samples according to a given covariance matrix.
std::exception | On invalid covariance matrix |
Definition at line 440 of file RandomGenerators.h.
void mrpt::random::randomNormalMultiDimensionalMany | ( | const mrpt::math::CMatrixTemplateNumeric< T > & | cov, |
size_t | desiredSamples, | ||
std::vector< std::vector< T > > & | ret, | ||
std::vector< T > * | samplesLikelihoods = NULL |
||
) |
Generate a given number of multidimensional random samples according to a given covariance matrix.
cov | The covariance matrix where to draw the samples from. |
desiredSamples | The number of samples to generate. |
samplesLikelihoods | If desired, set to a valid pointer to a vector, where it will be stored the likelihoods of having obtained each sample: the product of the gaussian-pdf for each independent variable. |
ret | The output list of samples |
std::exception | On invalid covariance matrix |
Definition at line 413 of file RandomGenerators.h.
void mrpt::random::randomNormalMultiDimensionalMany | ( | const MATRIXLIKE & | cov, |
size_t | desiredSamples, | ||
std::vector< std::vector< T > > & | ret | ||
) |
Generate multidimensional random samples according to a given covariance matrix.
std::exception | On invalid covariance matrix |
Definition at line 427 of file RandomGenerators.h.
void mrpt::random::randomPermutation | ( | const std::vector< T > & | in_vector, |
std::vector< T > & | out_result | ||
) |
Returns a random permutation of a vector: all the elements of the input vector are in the output but at random positions.
Definition at line 382 of file RandomGenerators.h.
void mrpt::random::vectorRandomNormal | ( | std::vector< T > & | v_out, |
const T & | mean = 0 , |
||
const T & | std = 1 |
||
) |
Generates a random vector with independent, normally distributed samples.
Definition at line 359 of file RandomGenerators.h.
References mrpt::math::mean().
void mrpt::random::vectorRandomUni | ( | std::vector< T > & | v_out, |
const T & | unif_min = 0 , |
||
const T & | unif_max = 1 |
||
) |
Fills the given matrix with independent, uniformly distributed samples.
Definition at line 330 of file RandomGenerators.h.
BASE_IMPEXP CRandomGenerator mrpt::random::randomGenerator |
A static instance of a CRandomGenerator class, for use in single-thread applications.
Referenced by mrpt::random::CRandomGenerator::permuteVector(), mrpt::slam::PF_implementation< mrpt::poses::CPose3D, CMonteCarloLocalization3D >::PF_SLAM_aux_perform_one_rejection_sampling_step(), mrpt::slam::PF_implementation< mrpt::poses::CPose3D, CMonteCarloLocalization3D >::PF_SLAM_implementation_pfAuxiliaryPFStandardAndOptimal(), mrpt::bayes::CRejectionSamplingCapable< mrpt::poses::CPose2D >::rejectionSampling(), and mrpt::math::transform_gaussian_montecarlo().
Page generated by Doxygen 1.8.13 for MRPT 1.4.0 SVN: at Sat Sep 2 18:44:07 UTC 2017 |