NEST  2.6.0,not_revisioned_source_dir@0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
librandom::BinomialRandomDev Class Reference

Class BinomialRNG. More...

#include <binomial_randomdev.h>

Inheritance diagram for librandom::BinomialRandomDev:
librandom::RandomDev

Public Member Functions

 BinomialRandomDev (RngPtr, double p_s=0.5, unsigned int n_s=1)
 
 BinomialRandomDev (double p_s=0.5, unsigned int n_s=1)
 
void set_p_n (double, unsigned int)
 set parameters for p and n p - success probability for single trial n - number of trials More...
 
void set_p (double)
 set p More...
 
void set_n (unsigned int)
 set n More...
 
long ldev (RngPtr) const
 draw integer, threaded More...
 
bool has_ldev () const
 true if RDG implements ldev function More...
 
double operator() (RngPtr) const
 return as double, threaded More...
 
void set_status (const DictionaryDatum &)
 set distribution parameters from SLI dict More...
 
void get_status (DictionaryDatum &) const
 get distribution parameters from SLI dict More...
 
- Public Member Functions inherited from librandom::RandomDev
 RandomDev (RngPtr rng=RngPtr(0))
 Construct with (single-threaded) or without (multithreaded) RNG. More...
 
virtual ~RandomDev ()
 ensure proper clean-up More...
 
virtual double operator() (void)
 Operator delivering doubles. More...
 
virtual long ldev (void)
 integer valued functions for discrete distributions More...
 
void set_rng (RngPtr rng)
 set RNG More...
 

Private Member Functions

void init_ ()
 check and initialize internal parameters More...
 
void PrecomputeTable (size_t)
 compute the internal lookup table More...
 

Private Attributes

PoissonRandomDev poisson_dev_
 source of Poisson random numbers More...
 
ExpRandomDev exp_dev_
 source of exponential random numbers More...
 
double p_
 probability p of binomial distribution More...
 
double phi_
 
long m_
 
unsigned int n_
 parameter n in binomial distribution More...
 
std::vector< double_t > f_
 precomputed table of f More...
 
unsigned int n_tablemax_
 current maximal n with precomputed values More...
 

Additional Inherited Members

- Protected Attributes inherited from librandom::RandomDev
RngPtr rng_
 store underlying RNG More...
 

Detailed Description

Class BinomialRNG.

Generates an RNG which returns Binomial(k;p;n) distributed random numbers out of an RNG which returns binomially distributed random numbers:

p(k) = (n! / k!(n-k)!) p^k (1-p)^(n-k) , 0<=k<=n, n<0

Arguments:

See also
Fishman, Sampling From the Binomial Distribution on a Computer, Journal of the American Statistical Association, Vol. 74, No. 366 (Jun., 1979), pp. 418-423

Constructor & Destructor Documentation

librandom::BinomialRandomDev::BinomialRandomDev ( RngPtr  r_s,
double  p_s = 0.5,
unsigned int  n_s = 1 
)

References init_(), and PrecomputeTable().

librandom::BinomialRandomDev::BinomialRandomDev ( double  p_s = 0.5,
unsigned int  n_s = 1 
)

References init_(), and PrecomputeTable().

Member Function Documentation

void librandom::BinomialRandomDev::get_status ( DictionaryDatum d) const
virtual

get distribution parameters from SLI dict

Implements librandom::RandomDev.

References nest::names::d.

bool librandom::BinomialRandomDev::has_ldev ( ) const
inlinevirtual

true if RDG implements ldev function

Reimplemented from librandom::RandomDev.

void librandom::BinomialRandomDev::init_ ( )
private

check and initialize internal parameters

References assert(), nest::names::mu, and nest::names::theta.

Referenced by BinomialRandomDev().

long librandom::BinomialRandomDev::ldev ( RngPtr  rng) const
virtual

draw integer, threaded

Reimplemented from librandom::RandomDev.

References assert(), and lockPTR< D >::valid().

Referenced by nest::FixedTotalNumberBuilder::connect_().

double librandom::BinomialRandomDev::operator() ( RngPtr  rthrd) const
inlinevirtual

return as double, threaded

Implements librandom::RandomDev.

References librandom::RandomDev::ldev().

void librandom::BinomialRandomDev::PrecomputeTable ( size_t  nmax)
private

compute the internal lookup table

Referenced by BinomialRandomDev().

void librandom::BinomialRandomDev::set_n ( unsigned int  n_s)
void librandom::BinomialRandomDev::set_p ( double  p_s)
void librandom::BinomialRandomDev::set_p_n ( double  p_s,
unsigned int  n_s 
)

set parameters for p and n p - success probability for single trial n - number of trials

void librandom::BinomialRandomDev::set_status ( const DictionaryDatum d)
virtual

set distribution parameters from SLI dict

Implements librandom::RandomDev.

References nest::names::d, and nest::names::max.

Member Data Documentation

ExpRandomDev librandom::BinomialRandomDev::exp_dev_
private

source of exponential random numbers

std::vector<double_t> librandom::BinomialRandomDev::f_
private

precomputed table of f

long librandom::BinomialRandomDev::m_
private
unsigned int librandom::BinomialRandomDev::n_
private

parameter n in binomial distribution

unsigned int librandom::BinomialRandomDev::n_tablemax_
private

current maximal n with precomputed values

double librandom::BinomialRandomDev::p_
private

probability p of binomial distribution

double librandom::BinomialRandomDev::phi_
private
PoissonRandomDev librandom::BinomialRandomDev::poisson_dev_
private

source of Poisson random numbers


The documentation for this class was generated from the following files: