Theoretica
A C++ numerical and automatic mathematical library
|
A probability density function sampler which generates pseudorandom numbers following asymptotically a given distribution \(f(x; \vec \theta)\). More...
#include <sampling.h>
Public Member Functions | |
pdf_sampler (pdf_sampling_function pdf, const std::vector< real > &theta, PRNG &generator) | |
Initialize the sampler with the given parameters. | |
real | next () |
Generate the next number. | |
real | operator() () |
Generate the next number. | |
template<typename Vector > | |
void | fill (Vector &x, size_t N) |
Fill a vector with sampled points. | |
template<typename Vector > | |
void | fill (Vector &x) |
Fill a vector with sampled points. | |
pdf_sampler & | operator>> (real &x) |
Stream the next generated number. | |
Static Public Member Functions | |
static pdf_sampler | uniform (real a, real b, PRNG &generator) |
Returns a uniform distribution sampler. | |
static pdf_sampler | gaussian (real mean, real sigma, PRNG &generator) |
Returns a Gaussian distribution sampler. | |
static pdf_sampler | exponential (real lambda, PRNG &generator) |
Returns an exponential distribution sampler. | |
static pdf_sampler | cauchy (real mu, real alpha, PRNG &generator) |
Returns a Cauchy distribution sampler. | |
static pdf_sampler | rayleigh (real sigma, PRNG &generator) |
Returns a Rayleigh distribution sampler. | |
static pdf_sampler | pareto (real x_m, real alpha, PRNG &generator) |
Returns a Pareto distribution sampler. | |
static pdf_sampler | laplace (real mu, real b, PRNG &generator) |
Returns a Laplace distribution sampler. | |
Public Attributes | |
pdf_sampling_function | |
A p.d.f sampling function. | |
std::vector< real > | theta |
The parameters of the target distribution. | |
PRNG & | generator |
A pseudorandom number generator. | |
A probability density function sampler which generates pseudorandom numbers following asymptotically a given distribution \(f(x; \vec \theta)\).