Normal distribution. More...
#include <itpp/base/random.h>
Public Member Functions | |
Normal_RNG (double meanval, double variance) | |
Constructor. Set mean and variance. More... | |
Normal_RNG () | |
Constructor. Set mean and variance. More... | |
void | setup (double meanval, double variance) |
Set mean, and variance. More... | |
void | get_setup (double &meanval, double &variance) const |
Get mean and variance. More... | |
double | operator() () |
Get one sample. More... | |
vec | operator() (int n) |
Get a sample vector. More... | |
mat | operator() (int h, int w) |
Get a sample matrix. More... | |
double | sample () |
Get a Normal distributed (0,1) sample. More... | |
void | sample_vector (int size, vec &out) |
Get a Normal distributed (0,1) vector. More... | |
void | sample_matrix (int rows, int cols, mat &out) |
Get a Normal distributed (0,1) matrix. More... | |
Normal distribution.
Normal (Gaussian) random variables, using a simplified Ziggurat method.
For details see the following arcticle: George Marsaglia, Wai Wan Tsang, "The Ziggurat Method for Generating Random Variables", Journal of Statistical Software, vol. 5 (2000), no. 8
This implementation is based on the generator written by Jochen Voss found at http://seehuhn.de/comp/ziggurat/, which is also included in the GSL library (randlist/gauss.c).
|
inline |
|
inline |
|
inline |
Set mean, and variance.
Definition at line 449 of file random.h.
References itpp::mean(), itpp::sqrt(), and itpp::variance().
void itpp::Normal_RNG::get_setup | ( | double & | meanval, |
double & | variance | ||
) | const |
|
inline |
|
inline |
|
inline |
double itpp::Normal_RNG::sample | ( | ) |
Get a Normal distributed (0,1) sample.
Definition at line 690 of file random.cpp.
References itpp::exp(), itpp::Random_Generator::genrand_close_open(), itpp::Random_Generator::genrand_uint32(), itpp::log(), and itpp::sign().
Referenced by itpp::randn(), and itpp::Gamma_RNG::sample().
|
inline |
Get a Normal distributed (0,1) vector.
Definition at line 475 of file random.h.
References itpp::size().
Referenced by itpp::AWGN_Channel::operator()(), and itpp::randn().
|
inline |
Get a Normal distributed (0,1) matrix.
Definition at line 481 of file random.h.
Referenced by itpp::randn().
Generated on Tue Aug 17 2021 10:59:15 for IT++ by Doxygen 1.9.4