zigrandom.cc File Reference
Detailed Description
========================================================================== This code is Copyright (C) 2005, Jurgen A. Doornik. Permission to use this code for non-commercial purposes is hereby given, provided proper reference is made to: Doornik, J.A. (2005), "An Improved Ziggurat Method to Generate Normal Random Samples", mimeo, Nuffield College, University of Oxford, and www.doornik.com/research. or the published version when available. This reference is still required when using modified versions of the code. This notice should be maintained in modified versions of the code. No warranty is given regarding the correctness of this code. ==========================================================================
- Author:
- Jurgen A. Doornik (Creator)
- Author
- ejt
- Name
- Revision
- 1.2
- State
- Exp
- Date
- 2007/01/30 23:17:12
Definition in file zigrandom.cc.
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include "zigrandom.h"
Include dependency graph for zigrandom.cc:
Go to the source code of this file.
|
Defines |
|
#define | MWC_R 256 |
|
#define | MWC_A LIT_UINT64(809430660) |
|
#define | MWC_AI 809430660 |
|
#define | MWC_C 362436 |
| #define | POLARBLOCK(u1, u2, d) |
| #define | FPOLARBLOCK(u1, u2, d) |
Functions |
|
void | GetInitialSeeds (unsigned int auiSeed[], int cSeed, unsigned int uiSeed, unsigned int uiMin) |
|
void | RanSetSeed_MWC8222 (int *piSeed, int cSeed) |
|
unsigned int | IRan_MWC8222 (void) |
|
double | DRan_MWC8222 (void) |
|
void | VecIRan_MWC8222 (unsigned int *auiRan, int cRan) |
|
void | VecDRan_MWC8222 (double *adRan, int cRan) |
|
double | DRanU (void) |
|
unsigned int | IRanU (void) |
|
void | RanVecIntU (unsigned int *auiRan, int cRan) |
|
void | RanVecU (double *adRan, int cRan) |
|
void | RanSetSeed (int *piSeed, int cSeed) |
|
void | RanSetRan (const char *sRan) |
|
static unsigned int | IRanUfromDRanU (void) |
|
static double | DRanUfromIRanU (void) |
|
void | RanSetRanExt (DRANFUN DRanFun, IRANFUN IRanFun, IVECRANFUN IVecRanFun, DVECRANFUN DVecRanFun, RANSETSEEDFUN RanSetSeedFun) |
|
double | DRanNormalPolar (void) |
|
double | FRanNormalPolar (void) |
|
static double | dProbN (double x, int fUpper) |
|
double | DProbNormal (double x) |
|
double | DRanQuanNormal (void) |
|
double | FRanQuanNormal (void) |
Variables |
|
static unsigned int | s_uiStateMWC = MWC_R - 1 |
|
static unsigned int | s_uiCarryMWC = MWC_C |
|
static unsigned int | s_auiStateMWC [MWC_R] |
|
static int | s_cNormalInStore = 0 |
|
static DRANFUN | s_fnDRanu = DRan_MWC8222 |
|
static IRANFUN | s_fnIRanu = IRan_MWC8222 |
|
static IVECRANFUN | s_fnVecIRanu = VecIRan_MWC8222 |
|
static DVECRANFUN | s_fnVecDRanu = VecDRan_MWC8222 |
|
static RANSETSEEDFUN | s_fnRanSetSeed = RanSetSeed_MWC8222 |
|
static double | s_dNormalInStore |
|
static float | s_fNormalInStore |
Define Documentation
| #define FPOLARBLOCK |
( |
u1, |
|
|
u2, |
|
|
d |
|
) |
|
Value: do \
{ u1 = (float)((*s_fnDRanu)()); u1 = 2 * u1 - 1;\
u2 = (float)((*s_fnDRanu)()); u2 = 2 * u2 - 1;\
d = u1 * u1 + u2 * u2; \
} while (d >= 1); \
d = sqrt( (-2.0 / d) * log(d) ); \
u1 *= d; u2 *= d
Definition at line 242 of file zigrandom.cc.
| #define POLARBLOCK |
( |
u1, |
|
|
u2, |
|
|
d |
|
) |
|
Value: do \
{ u1 = (*s_fnDRanu)(); u1 = 2 * u1 - 1;\
u2 = (*s_fnDRanu)(); u2 = 2 * u2 - 1;\
d = u1 * u1 + u2 * u2; \
} while (d >= 1); \
d = sqrt( (-2.0 / d) * log(d) ); \
u1 *= d; u2 *= d
Definition at line 216 of file zigrandom.cc.
Referenced by DRanNormalPolar(), and FRanNormalPolar().
|