GNU Octave  3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Macros | Functions
randpoisson.c File Reference
#include <stdio.h>
#include "f77-fcn.h"
#include "lo-error.h"
#include "lo-ieee.h"
#include "lo-math.h"
#include "randmtzig.h"
#include "randpoisson.h"
Include dependency graph for randpoisson.c:

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 NAN   octave_NaN
#define RNOR   oct_randn()
#define RUNI   oct_randu()
#define TABLESIZE   46

Functions

static double f (double k, double l_nu, double c_pm)
F77_RET_T F77_FUNC (dlgams, DLGAMS) const
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)

Macro Definition Documentation

#define C0   9.18938533204672742e-01

Referenced by flogfak().

#define C1   8.33333333333333333e-02

Referenced by flogfak().

#define C3   -2.77777777777777778e-03

Referenced by flogfak().

#define C5   7.93650793650793651e-04

Referenced by flogfak().

#define C7   -5.95238095238095238e-04

Referenced by flogfak().

#define INFINITE   lo_ieee_isinf

Definition at line 50 of file randpoisson.c.

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

#define LGAMMA   xlgamma

Definition at line 53 of file randpoisson.c.

Referenced by poisson_rejection(), and poisson_rejection_float().

#define NAN   octave_NaN

Definition at line 48 of file randpoisson.c.

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

#define RNOR   oct_randn()

Definition at line 52 of file randpoisson.c.

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

#define RUNI   oct_randu()
#define TABLESIZE   46

Function Documentation

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

Definition at line 148 of file randpoisson.c.

References flogfak().

F77_RET_T F77_FUNC ( dlgams  ,
DLGAMS   
) const

Definition at line 56 of file randpoisson.c.

References dlgams(), F77_XFCN, lo_ieee_isinf, lo_ieee_isnan, octave_Inf, and x.

static double flogfak ( double  k)
static

Definition at line 81 of file randpoisson.c.

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

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

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

Definition at line 553 of file randpoisson.c.

References floor(), INFINITE, NAN, poisson_cdf_lookup_float(), pprsc(), and RNOR.

Referenced by octave_rand::fill().

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

Definition at line 482 of file randpoisson.c.

References floor(), INFINITE, NAN, poisson_cdf_lookup(), pprsc(), and RNOR.

Referenced by octave_rand::fill().

float oct_float_randp ( float  FL)

Definition at line 586 of file randpoisson.c.

References floor(), INFINITE, NAN, poisson_rejection_float(), RNOR, and RUNI.

double oct_randp ( double  L)

Definition at line 514 of file randpoisson.c.

References floor(), INFINITE, NAN, poisson_rejection(), RNOR, and RUNI.

Referenced by octave_rand::do_float_scalar(), and octave_rand::do_scalar().

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

Definition at line 304 of file randpoisson.c.

References floor(), RUNI, and TABLESIZE.

Referenced by oct_fill_randp().

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

Definition at line 376 of file randpoisson.c.

References floor(), RUNI, and TABLESIZE.

Referenced by oct_fill_float_randp().

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

Definition at line 421 of file randpoisson.c.

References flogfak(), floor(), LGAMMA, and RUNI.

Referenced by oct_randp().

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

Definition at line 447 of file randpoisson.c.

References flogfak(), floor(), LGAMMA, and RUNI.

Referenced by oct_float_randp().

static double pprsc ( double  my)
static

Definition at line 154 of file randpoisson.c.

References ceil(), f, flogfak(), floor(), r1, r2, RUNI, and V.

Referenced by oct_fill_float_randp(), and oct_fill_randp().