COMBINATORIAL_BLAS
1.6
Loading...
Searching...
No Matches
splittable_mrg.h
Go to the documentation of this file.
1
/* Copyright (C) 2010 The Trustees of Indiana University. */
2
/* */
3
/* Use, modification and distribution is subject to the Boost Software */
4
/* License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at */
5
/* http://www.boost.org/LICENSE_1_0.txt) */
6
/* */
7
/* Authors: Jeremiah Willcock */
8
/* Andrew Lumsdaine */
9
10
#ifndef SPLITTABLE_MRG_H
11
#define SPLITTABLE_MRG_H
12
13
#include <
stdint.h
>
14
15
/* Multiple recursive generator from L'Ecuyer, P., Blouin, F., and */
16
/* Couture, R. 1993. A search for good multiple recursive random number */
17
/* generators. ACM Trans. Model. Comput. Simul. 3, 2 (Apr. 1993), 87-98. */
18
/* DOI= http://doi.acm.org/10.1145/169702.169698 -- particular generator */
19
/* used is from table 3, entry for m = 2^31 - 1, k = 5 (same generator */
20
/* is used in GNU Scientific Library). */
21
22
/* See notes at top of splittable_mrg.c for information on this */
23
/* implementation. */
24
25
#ifdef __cplusplus
26
extern
"C"
{
27
#endif
28
29
typedef
struct
mrg_state
{
30
uint_fast32_t
z1
,
z2
,
z3
,
z4
,
z5
;
31
}
mrg_state
;
32
33
/* Returns integer value in [0, 2^31-1) using original transition matrix */
34
uint_fast32_t
mrg_get_uint_orig
(
mrg_state
* state);
35
36
/* Returns real value in [0, 1) using original transition matrix */
37
double
mrg_get_double_orig
(
mrg_state
* state);
38
39
/* Seed PRNG with a given array of five values in the range [0, 0x7FFFFFFE] and
40
* not all zero. */
41
void
mrg_seed
(
mrg_state
* st,
const
uint_fast32_t
seed[5]);
42
43
/* Skip the PRNG ahead _exponent_ steps. This code treats the exponent as a
44
* 192-bit word, even though the PRNG period is less than that. */
45
void
mrg_skip
(
mrg_state
* state,
46
uint_least64_t
exponent_high,
47
uint_least64_t
exponent_middle,
48
uint_least64_t
exponent_low);
49
50
#ifdef __cplusplus
51
}
52
#endif
53
54
#endif
/* SPLITTABLE_MRG_H */
mrg_get_double_orig
double mrg_get_double_orig(mrg_state *state)
mrg_seed
void mrg_seed(mrg_state *st, const uint_fast32_t seed[5])
mrg_state
struct mrg_state mrg_state
mrg_skip
void mrg_skip(mrg_state *state, uint_least64_t exponent_high, uint_least64_t exponent_middle, uint_least64_t exponent_low)
mrg_get_uint_orig
uint_fast32_t mrg_get_uint_orig(mrg_state *state)
stdint.h
uint_fast32_t
uint32_t uint_fast32_t
Definition
stdint.h:110
uint_least64_t
uint64_t uint_least64_t
Definition
stdint.h:101
mrg_state
Definition
splittable_mrg.h:35
mrg_state::z3
uint_fast32_t z3
Definition
splittable_mrg.h:36
mrg_state::z4
uint_fast32_t z4
Definition
splittable_mrg.h:36
mrg_state::z2
uint_fast32_t z2
Definition
splittable_mrg.h:36
mrg_state::z5
uint_fast32_t z5
Definition
splittable_mrg.h:36
mrg_state::z1
uint_fast32_t z1
Definition
splittable_mrg.h:36
KameshCode
graph500_2D_SC11
src
generator
splittable_mrg.h
Generated by
1.9.8