GNU Octave  4.4.1
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 INFINITE   lo_ieee_isinf
 
#define LGAMMA   xlgamma
 
#define RNOR   oct_randn()
 
#define RUNI   oct_randu()
 
#define TABLESIZE   46
 

Functions

static double f (double k, double l_nu, double c_pm)
 
static double flogfak (double k)
 
void oct_fill_float_randp (float FL, octave_idx_type n, float *p)
 
void oct_fill_randp (double L, octave_idx_type n, double *p)
 
float oct_float_randp (float FL)
 
double oct_randp (double L)
 
static void poisson_cdf_lookup (double lambda, double *p, size_t n)
 
static void poisson_cdf_lookup_float (double lambda, float *p, size_t n)
 
static void poisson_rejection (double lambda, double *p, size_t n)
 
static void poisson_rejection_float (double lambda, float *p, size_t n)
 
static double pprsc (double my)
 
static double xlgamma (double x)
 

Macro Definition Documentation

◆ C0

#define C0   9.18938533204672742e-01

Referenced by flogfak().

◆ C1

#define C1   8.33333333333333333e-02

Referenced by flogfak().

◆ C3

#define C3   -2.77777777777777778e-03

Referenced by flogfak().

◆ C5

#define C5   7.93650793650793651e-04

Referenced by flogfak().

◆ C7

#define C7   -5.95238095238095238e-04

Referenced by flogfak().

◆ INFINITE

#define INFINITE   lo_ieee_isinf

Definition at line 48 of file randpoisson.cc.

Referenced by oct_fill_float_randp(), oct_fill_randp(), oct_float_randp(), and oct_randp().

◆ LGAMMA

#define LGAMMA   xlgamma

Definition at line 51 of file randpoisson.cc.

Referenced by poisson_rejection(), and poisson_rejection_float().

◆ RNOR

#define RNOR   oct_randn()

Definition at line 50 of file randpoisson.cc.

Referenced by oct_fill_float_randp(), oct_fill_randp(), oct_float_randp(), and oct_randp().

◆ RUNI

◆ TABLESIZE

#define TABLESIZE   46

Function Documentation

◆ f()

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

Definition at line 130 of file randpoisson.cc.

References flogfak(), and k.

Referenced by pprsc().

◆ flogfak()

static double flogfak ( double  k)
static

Definition at line 63 of file randpoisson.cc.

References C0, C1, C3, C5, C7, k, and log().

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

◆ oct_fill_float_randp()

void oct_fill_float_randp ( float  FL,
octave_idx_type  n,
float p 
)

Definition at line 536 of file randpoisson.cc.

References octave::math::floor(), i, INFINITE, NaN(), p, poisson_cdf_lookup_float(), pprsc(), and RNOR.

Referenced by octave_rand::fill().

◆ oct_fill_randp()

void oct_fill_randp ( double  L,
octave_idx_type  n,
double p 
)

Definition at line 465 of file randpoisson.cc.

References octave::math::floor(), i, INFINITE, NaN(), p, poisson_cdf_lookup(), pprsc(), and RNOR.

Referenced by octave_rand::fill().

◆ oct_float_randp()

float oct_float_randp ( float  FL)

Definition at line 569 of file randpoisson.cc.

References octave::math::floor(), INFINITE, NaN(), poisson_rejection_float(), RNOR, RUNI, and t.

◆ oct_randp()

double oct_randp ( double  L)

◆ poisson_cdf_lookup()

static void poisson_cdf_lookup ( double  lambda,
double p,
size_t  n 
)
static

Definition at line 285 of file randpoisson.cc.

References octave::math::floor(), i, k, p, RUNI, t, TABLESIZE, and u.

Referenced by oct_fill_randp().

◆ poisson_cdf_lookup_float()

static void poisson_cdf_lookup_float ( double  lambda,
float p,
size_t  n 
)
static

Definition at line 358 of file randpoisson.cc.

References octave::math::floor(), i, k, p, RUNI, t, TABLESIZE, and u.

Referenced by oct_fill_float_randp().

◆ poisson_rejection()

static void poisson_rejection ( double  lambda,
double p,
size_t  n 
)
static

Definition at line 404 of file randpoisson.cc.

References flogfak(), octave::math::floor(), i, LGAMMA, log(), p, RUNI, t, and y.

Referenced by oct_randp().

◆ poisson_rejection_float()

static void poisson_rejection_float ( double  lambda,
float p,
size_t  n 
)
static

Definition at line 430 of file randpoisson.cc.

References flogfak(), octave::math::floor(), i, LGAMMA, log(), p, RUNI, t, and y.

Referenced by oct_float_randp().

◆ pprsc()

static double pprsc ( double  my)
static

Definition at line 136 of file randpoisson.cc.

References octave::math::ceil(), f(), flogfak(), octave::math::floor(), log(), RUNI, and V.

Referenced by oct_fill_float_randp(), and oct_fill_randp().

◆ xlgamma()

static double xlgamma ( double  x)
static

Definition at line 54 of file randpoisson.cc.

References octave::math::lgamma(), and x.