Classes | |
class | CRandomGenerator |
A thred-safe pseudo random number generator, based on an internal MT19937 randomness generator. More... | |
Functions | |
MRPT_DECLARE_DEPRECATED_FUNCTION ("** deprecated **: Use mrpt::random::randomGenerator instead", double normalizedGaussian(double *likelihood=NULL)) | |
Generate a normalized normally distributed pseudo-random number. | |
MRPT_DECLARE_DEPRECATED_FUNCTION ("** deprecated **: Use mrpt::random::randomGenerator instead", double RandomNormal(double mean=0, double std=1)) | |
Generate a normally distributed pseudo-random number. | |
MRPT_DECLARE_DEPRECATED_FUNCTION ("** deprecated **: Use mrpt::random::randomGenerator instead", uint32_t RandomUniInt()) | |
Generate a uniformly distributed pseudo-random number using the MT19937 algorithm, in the whole range of 32-bit integers. | |
MRPT_DECLARE_DEPRECATED_FUNCTION ("** deprecated **: Use mrpt::random::randomGenerator instead", double RandomUni(const double min, const double max)) | |
Generate a uniformly distributed pseudo-random number using the MT19937 algorithm, scaled to the selected range. | |
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. | |
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. | |
template<class MAT > | |
void | matrixRandomNormal (MAT &matrix, const double mean=0, const double std=1) |
Fills the given matrix with independent, normally distributed samples. | |
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. | |
void | Randomize (const uint32_t seed) |
Randomize the generators. | |
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. | |
template<typename T > | |
void | randomNormalMultiDimensional (const CMatrixTemplateNumeric< T > &cov, std::vector< T > &out_result) |
Generate multidimensional random samples according to a given covariance matrix. | |
template<typename T > | |
void | randomNormalMultiDimensionalMany (const 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. | |
template<typename T , size_t N> | |
void | randomNormalMultiDimensionalMany (const CMatrixFixedNumeric< T, N, N > &cov, size_t desiredSamples, std::vector< std::vector< T > > &ret) |
Generate multidimensional random samples according to a given covariance matrix. | |
template<typename T , size_t N> | |
void | randomNormalMultiDimensional (const CMatrixFixedNumeric< T, N, N > &cov, std::vector< T > &out_result) |
Generate multidimensional random samples according to a given covariance matrix. | |
Variables | |
MRPTDLLIMPEXP CRandomGenerator | randomGenerator |
A static instance of a CRandomGenerator class, for use in single-thread applications. |
The central class in this namespace is mrpt::random::CRandomGenerator
void mrpt::random::matrixRandomNormal | ( | MAT & | matrix, | |
const double | mean = 0 , |
|||
const double | std = 1 | |||
) | [inline] |
Fills the given matrix with independent, normally distributed samples.
Matrix classes can be CMatrixTemplateNumeric or CMatrixFixedNumeric
Definition at line 391 of file RandomGenerators.h.
References mrpt::random::CRandomGenerator::drawGaussian1D_normalized(), mrpt::math::mean(), and randomGenerator.
void mrpt::random::matrixRandomUni | ( | MAT & | matrix, | |
const double | unif_min = 0 , |
|||
const double | unif_max = 1 | |||
) | [inline] |
Fills the given matrix with independent, uniformly distributed samples.
Matrix classes can be CMatrixTemplateNumeric or CMatrixFixedNumeric
Definition at line 362 of file RandomGenerators.h.
References mrpt::random::CRandomGenerator::drawUniform(), and randomGenerator.
mrpt::random::MRPT_DECLARE_DEPRECATED_FUNCTION | ( | "** deprecated **: Use mrpt::random::randomGenerator instead" | , | |
double | RandomUniconst double min, const double max | |||
) |
Generate a uniformly distributed pseudo-random number using the MT19937 algorithm, scaled to the selected range.
This function uses internally RandomUniInt to generate the number, then scales it to the desired range. Since MRPT 0.6.0 the MT19937 algorithm is used instead of C runtime library "rand" version. See: http://en.wikipedia.org/wiki/Mersenne_twister
mrpt::random::MRPT_DECLARE_DEPRECATED_FUNCTION | ( | "** deprecated **: Use mrpt::random::randomGenerator instead" | , | |
uint32_t | RandomUniInt() | |||
) |
Generate a uniformly distributed pseudo-random number using the MT19937 algorithm, in the whole range of 32-bit integers.
See: http://en.wikipedia.org/wiki/Mersenne_twister
mrpt::random::MRPT_DECLARE_DEPRECATED_FUNCTION | ( | "** deprecated **: Use mrpt::random::randomGenerator instead" | , | |
double | RandomNormaldouble mean=0, double std=1 | |||
) |
Generate a normally distributed pseudo-random number.
mean | The mean value of desired normal distribution | |
std | The standard deviation value of desired normal distribution |
mrpt::random::MRPT_DECLARE_DEPRECATED_FUNCTION | ( | "** deprecated **: Use mrpt::random::randomGenerator instead" | , | |
double | normalizedGaussiandouble *likelihood=NULL | |||
) |
Generate a normalized normally distributed pseudo-random number.
likelihood | If desired, pass a pointer to a double which will receive the likelihood of the given sample to have been obtained, that is, the value of the normal pdf at the sample value. |
void mrpt::random::Randomize | ( | ) | [inline] |
Definition at line 421 of file RandomGenerators.h.
References randomGenerator, and mrpt::random::CRandomGenerator::randomize().
void mrpt::random::Randomize | ( | const uint32_t | seed | ) | [inline] |
Randomize the generators.
A seed can be providen, or a current-time based seed can be used (default)
Definition at line 418 of file RandomGenerators.h.
References randomGenerator, and mrpt::random::CRandomGenerator::randomize().
void mrpt::random::randomNormalMultiDimensional | ( | const CMatrixFixedNumeric< T, N, N > & | cov, | |
std::vector< T > & | out_result | |||
) | [inline] |
Generate multidimensional random samples according to a given covariance matrix.
std::exception | On invalid covariance matrix |
Definition at line 486 of file RandomGenerators.h.
References mrpt::random::CRandomGenerator::drawGaussianMultivariate(), and randomGenerator.
void mrpt::random::randomNormalMultiDimensional | ( | const CMatrixTemplateNumeric< T > & | cov, | |
std::vector< T > & | out_result | |||
) | [inline] |
Generate multidimensional random samples according to a given covariance matrix.
std::exception | On invalid covariance matrix |
Definition at line 441 of file RandomGenerators.h.
References mrpt::random::CRandomGenerator::drawGaussianMultivariate(), and randomGenerator.
void mrpt::random::randomNormalMultiDimensionalMany | ( | const CMatrixFixedNumeric< T, N, N > & | cov, | |
size_t | desiredSamples, | |||
std::vector< std::vector< T > > & | ret | |||
) | [inline] |
Generate multidimensional random samples according to a given covariance matrix.
std::exception | On invalid covariance matrix |
Definition at line 473 of file RandomGenerators.h.
References mrpt::random::CRandomGenerator::drawGaussianMultivariateMany(), and randomGenerator.
void mrpt::random::randomNormalMultiDimensionalMany | ( | const CMatrixTemplateNumeric< T > & | cov, | |
size_t | desiredSamples, | |||
std::vector< std::vector< T > > & | ret, | |||
std::vector< T > * | samplesLikelihoods = NULL | |||
) | [inline] |
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 459 of file RandomGenerators.h.
References mrpt::random::CRandomGenerator::drawGaussianMultivariateMany(), and randomGenerator.
void mrpt::random::randomPermutation | ( | const std::vector< T > & | in_vector, | |
std::vector< T > & | out_result | |||
) | [inline] |
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 428 of file RandomGenerators.h.
References mrpt::random::CRandomGenerator::permuteVector(), and randomGenerator.
void mrpt::random::vectorRandomNormal | ( | std::vector< T > & | v_out, | |
const T & | mean = 0 , |
|||
const T & | std = 1 | |||
) | [inline] |
Generates a random vector with independent, normally distributed samples.
Definition at line 405 of file RandomGenerators.h.
References mrpt::random::CRandomGenerator::drawGaussian1D_normalized(), mrpt::math::mean(), and randomGenerator.
void mrpt::random::vectorRandomUni | ( | std::vector< T > & | v_out, | |
const T & | unif_min = 0 , |
|||
const T & | unif_max = 1 | |||
) | [inline] |
Fills the given matrix with independent, uniformly distributed samples.
Definition at line 376 of file RandomGenerators.h.
References mrpt::random::CRandomGenerator::drawUniform(), and randomGenerator.
MRPTDLLIMPEXP CRandomGenerator mrpt::random::randomGenerator |
A static instance of a CRandomGenerator class, for use in single-thread applications.
Referenced by matrixRandomNormal(), matrixRandomUni(), Randomize(), randomNormalMultiDimensional(), randomNormalMultiDimensionalMany(), randomPermutation(), mrpt::bayes::CRejectionSamplingCapable< mrpt::poses::CPose2D >::rejectionSampling(), vectorRandomNormal(), and vectorRandomUni().
Page generated by Doxygen 1.5.7.1 for MRPT 0.7.1 SVN: at Mon Aug 17 23:10:56 EDT 2009 |