GNU Octave  8.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
randpoisson.cc File Reference
#include <cmath>
#include <cstddef>
#include "f77-fcn.h"
#include "lo-error.h"
#include "lo-ieee.h"
#include "randmtzig.h"
#include "randpoisson.h"
Include dependency graph for randpoisson.cc:

Go to the source code of this file.

Macros

#define C0   9.18938533204672742e-01
 
#define C1   8.33333333333333333e-02
 
#define C3   -2.77777777777777778e-03
 
#define C5   7.93650793650793651e-04
 
#define C7   -5.95238095238095238e-04
 
#define TABLESIZE   46
 

Functions

static double f (double k, double l_nu, double c_pm)
 
static double flogfak (double k)
 
template<typename T >
static void poisson_cdf_lookup (double lambda, T *p, std::size_t n)
 
template<typename T >
static void poisson_rejection (double lambda, T *p, std::size_t n)
 
static double pprsc (double my)
 
template<typename T >
rand_poisson (T L_arg)
 
template<typename T >
void rand_poisson (T L_arg, octave_idx_type n, T *p)
 
template OCTAVE_API double rand_poisson< double > (double)
 
template void rand_poisson< double > (double, octave_idx_type, double *)
 
template OCTAVE_API float rand_poisson< float > (float)
 
template void rand_poisson< float > (float, octave_idx_type, float *)
 
static double xlgamma (double x)
 

Macro Definition Documentation

◆ C0

#define C0   9.18938533204672742e-01

◆ C1

#define C1   8.33333333333333333e-02

◆ C3

#define C3   -2.77777777777777778e-03

◆ C5

#define C5   7.93650793650793651e-04

◆ C7

#define C7   -5.95238095238095238e-04

◆ TABLESIZE

#define TABLESIZE   46

Definition at line 290 of file randpoisson.cc.

Function Documentation

◆ f()

static double f ( double  k,
double  l_nu,
double  c_pm 
)
static

Definition at line 118 of file randpoisson.cc.

References flogfak().

Referenced by pprsc().

◆ flogfak()

static double flogfak ( double  k)
static

Definition at line 52 of file randpoisson.cc.

References C0, C1, C3, C5, C7, and r.

Referenced by f(), poisson_rejection(), and pprsc().

◆ poisson_cdf_lookup()

template<typename T >
static void poisson_cdf_lookup ( double  lambda,
T *  p,
std::size_t  n 
)
static

Definition at line 296 of file randpoisson.cc.

References floor(), n, rand_uniform< double >(), and TABLESIZE.

◆ poisson_rejection()

template<typename T >
static void poisson_rejection ( double  lambda,
T *  p,
std::size_t  n 
)
static

Definition at line 361 of file randpoisson.cc.

References flogfak(), floor(), n, rand_uniform< double >(), and xlgamma().

◆ pprsc()

static double pprsc ( double  my)
static

Definition at line 123 of file randpoisson.cc.

References ceil(), f(), flogfak(), floor(), m, rand_uniform< double >(), and V.

Referenced by rand_poisson().

◆ rand_poisson() [1/2]

template<typename T >
T rand_poisson ( L_arg)

Definition at line 433 of file randpoisson.cc.

References floor(), lo_ieee_isinf, and NaN.

◆ rand_poisson() [2/2]

template<typename T >
void rand_poisson ( L_arg,
octave_idx_type  n,
T *  p 
)

Definition at line 398 of file randpoisson.cc.

References floor(), lo_ieee_isinf, n, NaN, and pprsc().

◆ rand_poisson< double >() [1/2]

template OCTAVE_API double rand_poisson< double > ( double  )

◆ rand_poisson< double >() [2/2]

template void rand_poisson< double > ( double  ,
octave_idx_type  ,
double *   
)

Referenced by rand::fill(), and rand::poisson().

◆ rand_poisson< float >() [1/2]

template OCTAVE_API float rand_poisson< float > ( float  )

◆ rand_poisson< float >() [2/2]

template void rand_poisson< float > ( float  ,
octave_idx_type  ,
float *   
)

Referenced by rand::fill().

◆ xlgamma()

static double xlgamma ( double  x)
static

Definition at line 44 of file randpoisson.cc.

References lgamma(), and x.

Referenced by poisson_rejection().