Defines | Functions | Variables

randmtzig.c File Reference

#include <stdio.h>
#include <time.h>
#include "lo-math.h"
#include "randmtzig.h"
Include dependency graph for randmtzig.c:

Go to the source code of this file.

Defines

#define EMANTISSA   9007199254740992.0
#define ERANDI   randi53()
#define EXP_SECTION_AREA   0.0039496598225815571993
#define LMASK   0x7fffffffUL
#define MATRIX_A   0x9908b0dfUL
#define MIXBITS(u, v)   ( ((u) & UMASK) | ((v) & LMASK) )
#define MT_M   397
#define NMANTISSA   EMANTISSA
#define NOR_SECTION_AREA   0.00492867323399
#define NRANDI   randi54()
#define randi32   randmt
#define RANDU   randu53()
#define TWIST(u, v)   ((MIXBITS(u,v) >> 1) ^ ((v)&1UL ? MATRIX_A : 0UL))
#define UMASK   0x80000000UL
#define USE_X86_32   0
#define ZIGGURAT_EXP_INV_R   0.129918765548341586
#define ZIGGURAT_EXP_R   7.69711747013104972
#define ZIGGURAT_NOR_INV_R   0.27366123732975828
#define ZIGGURAT_NOR_R   3.6541528853610088
#define ZIGGURAT_TABLE_SIZE   256
#define ZIGINT   uint64_t

Functions

static void create_ziggurat_tables (void)
static void next_state (void)
void oct_fill_rande (octave_idx_type n, double *p)
void oct_fill_randn (octave_idx_type n, double *p)
void oct_fill_randu (octave_idx_type n, double *p)
void oct_get_state (uint32_t *save)
void oct_init_by_array (uint32_t *init_key, int key_length)
void oct_init_by_entropy (void)
void oct_init_by_int (uint32_t s)
double oct_rande (void)
double oct_randn (void)
double oct_randu (void)
void oct_set_state (uint32_t *save)
static uint64_t randi53 (void)
static uint64_t randi54 (void)
static uint32_t randmt (void)
static double randu53 (void)

Variables

static double fe [ZIGGURAT_TABLE_SIZE]
static double fi [ZIGGURAT_TABLE_SIZE]
static int initf = 0
static int initt = 1
static ZIGINT ke [ZIGGURAT_TABLE_SIZE]
static ZIGINT ki [ZIGGURAT_TABLE_SIZE]
static int left = 1
static uint32_t * next
static uint32_t state [MT_N]
static double we [ZIGGURAT_TABLE_SIZE]
static double wi [ZIGGURAT_TABLE_SIZE]

Define Documentation

#define EMANTISSA   9007199254740992.0

Definition at line 440 of file randmtzig.c.

Referenced by create_ziggurat_tables().

#define ERANDI   randi53()

Definition at line 441 of file randmtzig.c.

#define EXP_SECTION_AREA   0.0039496598225815571993

Definition at line 455 of file randmtzig.c.

Referenced by create_ziggurat_tables().

#define LMASK   0x7fffffffUL

Definition at line 174 of file randmtzig.c.

#define MATRIX_A   0x9908b0dfUL

Definition at line 172 of file randmtzig.c.

#define MIXBITS (   u,
  v 
)    ( ((u) & UMASK) | ((v) & LMASK) )

Definition at line 175 of file randmtzig.c.

#define MT_M   397

Definition at line 171 of file randmtzig.c.

Referenced by next_state().

#define NMANTISSA   EMANTISSA

Definition at line 442 of file randmtzig.c.

Referenced by create_ziggurat_tables().

#define NOR_SECTION_AREA   0.00492867323399

Definition at line 451 of file randmtzig.c.

Referenced by create_ziggurat_tables().

#define NRANDI   randi54()

Definition at line 443 of file randmtzig.c.

#define randi32   randmt

Definition at line 347 of file randmtzig.c.

Referenced by oct_randn(), randi53(), randi54(), and randu53().

#define RANDU   randu53()

Definition at line 444 of file randmtzig.c.

Referenced by oct_rande(), and oct_randn().

#define TWIST (   u,
  v 
)    ((MIXBITS(u,v) >> 1) ^ ((v)&1UL ? MATRIX_A : 0UL))

Definition at line 176 of file randmtzig.c.

Referenced by next_state().

#define UMASK   0x80000000UL

Definition at line 173 of file randmtzig.c.

#define USE_X86_32   0

Definition at line 165 of file randmtzig.c.

#define ZIGGURAT_EXP_INV_R   0.129918765548341586

Definition at line 454 of file randmtzig.c.

#define ZIGGURAT_EXP_R   7.69711747013104972

Definition at line 453 of file randmtzig.c.

Referenced by oct_rande().

#define ZIGGURAT_NOR_INV_R   0.27366123732975828

Definition at line 450 of file randmtzig.c.

Referenced by oct_randn().

#define ZIGGURAT_NOR_R   3.6541528853610088

Definition at line 449 of file randmtzig.c.

Referenced by oct_randn().

#define ZIGGURAT_TABLE_SIZE   256

Definition at line 447 of file randmtzig.c.

#define ZIGINT   uint64_t

Definition at line 439 of file randmtzig.c.

Referenced by oct_rande().


Function Documentation

static void create_ziggurat_tables ( void   )  [static]

Definition at line 501 of file randmtzig.c.

References EMANTISSA, EXP_SECTION_AREA, NMANTISSA, NOR_SECTION_AREA, and x.

Referenced by oct_rande(), and oct_randn().

static void next_state ( void   )  [static]

Definition at line 303 of file randmtzig.c.

References MT_M, MT_N, next, oct_init_by_entropy(), state, and TWIST.

Referenced by randmt().

void oct_fill_rande ( octave_idx_type  n,
double p 
)

Definition at line 698 of file randmtzig.c.

References oct_rande().

Referenced by octave_rand::fill().

void oct_fill_randn ( octave_idx_type  n,
double p 
)

Definition at line 690 of file randmtzig.c.

References oct_randn().

Referenced by octave_rand::fill().

void oct_fill_randu ( octave_idx_type  n,
double p 
)

Definition at line 682 of file randmtzig.c.

References oct_randu().

Referenced by octave_rand::fill().

void oct_get_state ( uint32_t *  save  ) 

Definition at line 294 of file randmtzig.c.

References state.

Referenced by octave_rand::get_internal_state().

void oct_init_by_array ( uint32_t *  init_key,
int  key_length 
)

Definition at line 206 of file randmtzig.c.

References MT_N, oct_init_by_int(), and state.

Referenced by oct_init_by_entropy(), and octave_rand::set_internal_state().

void oct_init_by_entropy ( void   ) 
void oct_init_by_int ( uint32_t  s  ) 

Definition at line 186 of file randmtzig.c.

References state.

Referenced by oct_init_by_array().

double oct_rande ( void   ) 

Definition at line 654 of file randmtzig.c.

References create_ziggurat_tables(), RANDU, x, ZIGGURAT_EXP_R, and ZIGINT.

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

double oct_randn ( void   ) 
double oct_randu ( void   ) 

Definition at line 421 of file randmtzig.c.

References randu53().

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

void oct_set_state ( uint32_t *  save  ) 

Definition at line 284 of file randmtzig.c.

References next, and state.

Referenced by octave_rand::set_internal_state().

static uint64_t randi53 ( void   )  [static]

Definition at line 350 of file randmtzig.c.

References randi32.

static uint64_t randi54 ( void   )  [static]

Definition at line 366 of file randmtzig.c.

References randi32.

static uint32_t randmt ( void   )  [static]

Definition at line 329 of file randmtzig.c.

References next, and next_state().

static double randu53 ( void   )  [static]

Definition at line 411 of file randmtzig.c.

References randi32.

Referenced by oct_randu().


Variable Documentation

double fe[ZIGGURAT_TABLE_SIZE] [static]

Definition at line 460 of file randmtzig.c.

double fi[ZIGGURAT_TABLE_SIZE] [static]
int initf = 0 [static]

Definition at line 181 of file randmtzig.c.

int initt = 1 [static]

Definition at line 182 of file randmtzig.c.

ZIGINT ke[ZIGGURAT_TABLE_SIZE] [static]

Definition at line 459 of file randmtzig.c.

ZIGINT ki[ZIGGURAT_TABLE_SIZE] [static]

Definition at line 457 of file randmtzig.c.

int left = 1 [static]
uint32_t* next [static]
uint32_t state[MT_N] [static]
double we[ZIGGURAT_TABLE_SIZE] [static]

Definition at line 460 of file randmtzig.c.

double wi[ZIGGURAT_TABLE_SIZE] [static]

Definition at line 458 of file randmtzig.c.

Referenced by DEFUN_DLD(), FloatSCHUR::init(), FloatEIG::init(), EIG::init(), SCHUR::init(), and zbesy().

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines