#include <cmath>
#include <cstdio>
#include <ctime>
#include <algorithm>
#include <random>
#include "oct-syscalls.h"
#include "oct-time.h"
#include "randmtzig.h"
Go to the source code of this file.
Macros | |
#define | EMANTISSA 9007199254740992.0 /* 53 bit mantissa */ |
#define | EMANTISSA 4294967296.0 /* 32 bit mantissa */ |
#define | ERANDI randi53() /* 53 bits for mantissa */ |
#define | ERANDI randi32() /* 32 bits for mantissa */ |
#define | EXP_SECTION_AREA 0.0039496598225815571993 |
#define | LMASK 0x7fffffffUL /* least significant r bits */ |
#define | MATRIX_A 0x9908b0dfUL /* constant vector a */ |
#define | MIXBITS(u, v) ( ((u) & UMASK) | ((v) & LMASK) ) |
#define | MT_M 397 |
#define | NMANTISSA EMANTISSA |
#define | NMANTISSA 2147483648.0 /* 31 bit mantissa */ |
#define | NOR_SECTION_AREA 0.00492867323399 |
#define | NRANDI randi54() /* 53 bits for mantissa + 1 bit sign */ |
#define | NRANDI randi32() /* 31 bits for mantissa + 1 bit sign */ |
#define | randi32 randmt |
#define | RANDU randu53() |
#define | RANDU randu24() |
#define | TWIST(u, v) ((MIXBITS(u,v) >> 1) ^ ((v)&1UL ? MATRIX_A : 0UL)) |
#define | UMASK 0x80000000UL /* most significant w-r bits */ |
#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 |
#define | ZIGINT uint32_t |
Functions | |
void | create_ziggurat_tables () |
void | get_mersenne_twister_state (uint32_t *save) |
void | init_mersenne_twister () |
void | init_mersenne_twister (const uint32_t *init_key, const int key_length) |
void | init_mersenne_twister (const uint32_t s) |
template<> | |
void | rand_exponential (octave_idx_type n, double *p) |
template<> | |
void | rand_exponential (octave_idx_type n, float *p) |
template<> | |
double | rand_exponential< double > () |
template<> | |
float | rand_exponential< float > () |
template<> | |
void | rand_normal (octave_idx_type n, double *p) |
template<> | |
void | rand_normal (octave_idx_type n, float *p) |
template<> | |
double | rand_normal< double > () |
template<> | |
float | rand_normal< float > () |
template<> | |
void | rand_uniform (octave_idx_type n, float *p) |
template<> | |
double | rand_uniform< double > () |
template<> | |
void | rand_uniform< double > (octave_idx_type n, double *p) |
template<> | |
float | rand_uniform< float > () |
void | set_mersenne_twister_state (const uint32_t *save) |
#define EMANTISSA 9007199254740992.0 /* 53 bit mantissa */ |
Definition at line 714 of file randmtzig.cc.
#define EMANTISSA 4294967296.0 /* 32 bit mantissa */ |
Definition at line 714 of file randmtzig.cc.
#define ERANDI randi53() /* 53 bits for mantissa */ |
Definition at line 715 of file randmtzig.cc.
Definition at line 715 of file randmtzig.cc.
#define EXP_SECTION_AREA 0.0039496598225815571993 |
Definition at line 465 of file randmtzig.cc.
#define LMASK 0x7fffffffUL /* least significant r bits */ |
Definition at line 188 of file randmtzig.cc.
#define MATRIX_A 0x9908b0dfUL /* constant vector a */ |
Definition at line 186 of file randmtzig.cc.
Definition at line 189 of file randmtzig.cc.
#define MT_M 397 |
Definition at line 185 of file randmtzig.cc.
#define NMANTISSA EMANTISSA |
Definition at line 716 of file randmtzig.cc.
#define NMANTISSA 2147483648.0 /* 31 bit mantissa */ |
Definition at line 716 of file randmtzig.cc.
#define NOR_SECTION_AREA 0.00492867323399 |
Definition at line 461 of file randmtzig.cc.
#define NRANDI randi54() /* 53 bits for mantissa + 1 bit sign */ |
Definition at line 717 of file randmtzig.cc.
Definition at line 717 of file randmtzig.cc.
#define randi32 randmt |
Definition at line 374 of file randmtzig.cc.
#define RANDU randu53() |
Definition at line 718 of file randmtzig.cc.
#define RANDU randu24() |
Definition at line 718 of file randmtzig.cc.
Definition at line 190 of file randmtzig.cc.
#define UMASK 0x80000000UL /* most significant w-r bits */ |
Definition at line 187 of file randmtzig.cc.
#define USE_X86_32 0 |
Definition at line 177 of file randmtzig.cc.
#define ZIGGURAT_EXP_INV_R 0.129918765548341586 |
Definition at line 464 of file randmtzig.cc.
#define ZIGGURAT_EXP_R 7.69711747013104972 |
Definition at line 463 of file randmtzig.cc.
#define ZIGGURAT_NOR_INV_R 0.27366123732975828 |
Definition at line 460 of file randmtzig.cc.
#define ZIGGURAT_NOR_R 3.6541528853610088 |
Definition at line 459 of file randmtzig.cc.
#define ZIGGURAT_TABLE_SIZE 256 |
Definition at line 457 of file randmtzig.cc.
#define ZIGINT uint64_t |
Definition at line 713 of file randmtzig.cc.
#define ZIGINT uint32_t |
Definition at line 713 of file randmtzig.cc.
void create_ziggurat_tables | ( | ) |
Definition at line 518 of file randmtzig.cc.
References x, and ZIGGURAT_NOR_R.
void get_mersenne_twister_state | ( | uint32_t * | save | ) |
Definition at line 323 of file randmtzig.cc.
void init_mersenne_twister | ( | ) |
Definition at line 263 of file randmtzig.cc.
References getpid(), init_mersenne_twister(), min(), MT_N, and n.
void init_mersenne_twister | ( | const uint32_t * | init_key, |
const int | key_length | ||
) |
Definition at line 222 of file randmtzig.cc.
References init_mersenne_twister(), and MT_N.
void init_mersenne_twister | ( | const uint32_t | s | ) |
Definition at line 201 of file randmtzig.cc.
Referenced by init_mersenne_twister().
void rand_exponential | ( | octave_idx_type | n, |
double * | p | ||
) |
Definition at line 701 of file randmtzig.cc.
References n, and rand_exponential< double >().
void rand_exponential | ( | octave_idx_type | n, |
float * | p | ||
) |
Definition at line 884 of file randmtzig.cc.
References n, and rand_exponential< float >().
double rand_exponential< double > | ( | ) |
Definition at line 664 of file randmtzig.cc.
Referenced by rand_exponential().
float rand_exponential< float > | ( | ) |
Definition at line 847 of file randmtzig.cc.
Referenced by rand_exponential().
void rand_normal | ( | octave_idx_type | n, |
double * | p | ||
) |
Definition at line 696 of file randmtzig.cc.
References n, and rand_normal< double >().
void rand_normal | ( | octave_idx_type | n, |
float * | p | ||
) |
Definition at line 879 of file randmtzig.cc.
References n, and rand_normal< float >().
double rand_normal< double > | ( | ) |
Definition at line 598 of file randmtzig.cc.
Referenced by rand_normal().
float rand_normal< float > | ( | ) |
Definition at line 805 of file randmtzig.cc.
Referenced by rand_normal().
void rand_uniform | ( | octave_idx_type | n, |
float * | p | ||
) |
Definition at line 874 of file randmtzig.cc.
References n, and rand_uniform< float >().
double rand_uniform< double > | ( | ) |
Definition at line 441 of file randmtzig.cc.
Referenced by rand_uniform< double >().
void rand_uniform< double > | ( | octave_idx_type | n, |
double * | p | ||
) |
Definition at line 691 of file randmtzig.cc.
References n, and rand_uniform< double >().
float rand_uniform< float > | ( | ) |
Definition at line 449 of file randmtzig.cc.
Referenced by rand_uniform().
void set_mersenne_twister_state | ( | const uint32_t * | save | ) |
Definition at line 315 of file randmtzig.cc.
References MT_N.