Theoretica
A C++ numerical and automatic mathematical library
theoretica::pdf_sampler Struct Reference

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_sampleroperator>> (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 pdf
 A p.d.f sampling function.
 
std::vector< realtheta
 The parameters of the target distribution.
 
PRNGgenerator
 A pseudorandom number generator.
 

Detailed Description

A probability density function sampler which generates pseudorandom numbers following asymptotically a given distribution \(f(x; \vec \theta)\).


The documentation for this struct was generated from the following file: