Debian Codegraph @

external/gsl/gsl_rng__fishman2x.c

raw symbols SCIP
1 /* rng/fishman2x.c
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 3 of the License, or (at
6 * your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 */
17
18 /*
19 * This generator is taken from
20 *
21 * Donald E. Knuth
22 * The Art of Computer Programming
23 * Volume 2
24 * Third Edition
25 * Addison-Wesley
26 * Page 108
27 *
28 * It is called "Fishman - L'Ecuyer"
29 *
30 * This implementation copyright (C) 2001 Carlo Perassi
31 * and (C) 2003 Heiko Bauke.
32 */
33
34 #include "gsl__config.h"cxx . . $ `<file>/external/gsl/gsl__config.h`/
35 #include <stdlib.h>
36 #include "gsl_rng.h"cxx . . $ `<file>/external/gsl/gsl_rng.h`/
37
38 /* Fishman */
39 #define AAA_Fcxx . . $ `external/gsl/gsl_rng__fishman2x.c:39:9`! 48271UL
40 #define MMM_Fcxx . . $ `external/gsl/gsl_rng__fishman2x.c:40:9`! 0x7fffffffUL /* 2 ^ 31 - 1 */
41 #define QQQ_Fcxx . . $ `external/gsl/gsl_rng__fishman2x.c:41:9`! 44488UL
42 #define RRR_Fcxx . . $ `external/gsl/gsl_rng__fishman2x.c:42:9`! 3399UL
43
44 /* L'Ecuyer */
45 #define AAA_Lcxx . . $ `external/gsl/gsl_rng__fishman2x.c:45:9`! 40692UL
46 #define MMM_Lcxx . . $ `external/gsl/gsl_rng__fishman2x.c:46:9`! 0x7fffff07UL /* 2 ^ 31 - 249 */
47 #define QQQ_Lcxx . . $ `external/gsl/gsl_rng__fishman2x.c:47:9`! 52774UL
48 #define RRR_Lcxx . . $ `external/gsl/gsl_rng__fishman2x.c:48:9`! 3791UL
49
50 static inline unsigned long int ran_getcxx . . $ ran_get(751e5d26f8574c32). (void *vstate);
51 static double ran_get_doublecxx . . $ ran_get_double(a405b17f82753acc). (void *vstate);
52 static void ran_setcxx . . $ ran_set(5500c4293b1bbef0). (void *state, unsigned long int s);
53
54 typedef structcxx . . $ $anonymous_type_f4553247582595af_0#
55 {
56 unsigned long int xcxx . . $ $anonymous_type_f4553247582595af_0#x.;
57 unsigned long int ycxx . . $ $anonymous_type_f4553247582595af_0#y.;
58 unsigned long int zcxx . . $ $anonymous_type_f4553247582595af_0#z.;
59 }
60 ran_state_tcxx . . $ ran_state_t#;
61
62 static inline unsigned long int
63 ran_getcxx . . $ ran_get(751e5d26f8574c32). (void *vstate)
64 {
65 ran_state_tcxx . . $ ran_state_t# *state = (ran_state_tcxx . . $ ran_state_t# *) vstate;
66
67 long int y, r;
68
69 r = RRR_Fcxx . . $ `external/gsl/gsl_rng__fishman2x.c:42:9`! * (state->xcxx . . $ $anonymous_type_f4553247582595af_0#x. / QQQ_Fcxx . . $ `external/gsl/gsl_rng__fishman2x.c:41:9`!);
70 y = AAA_Fcxx . . $ `external/gsl/gsl_rng__fishman2x.c:39:9`! * (state->xcxx . . $ $anonymous_type_f4553247582595af_0#x. % QQQ_Fcxx . . $ `external/gsl/gsl_rng__fishman2x.c:41:9`!) - r;
71 if (y < 0)
72 y += MMM_Fcxx . . $ `external/gsl/gsl_rng__fishman2x.c:40:9`!;
73 state->xcxx . . $ $anonymous_type_f4553247582595af_0#x. = y;
74
75 r = RRR_Lcxx . . $ `external/gsl/gsl_rng__fishman2x.c:48:9`! * (state->ycxx . . $ $anonymous_type_f4553247582595af_0#y. / QQQ_Lcxx . . $ `external/gsl/gsl_rng__fishman2x.c:47:9`!);
76 y = AAA_Lcxx . . $ `external/gsl/gsl_rng__fishman2x.c:45:9`! * (state->ycxx . . $ $anonymous_type_f4553247582595af_0#y. % QQQ_Lcxx . . $ `external/gsl/gsl_rng__fishman2x.c:47:9`!) - r;
77 if (y < 0)
78 y += MMM_Lcxx . . $ `external/gsl/gsl_rng__fishman2x.c:46:9`!;
79 state->ycxx . . $ $anonymous_type_f4553247582595af_0#y. = y;
80
81 state->zcxx . . $ $anonymous_type_f4553247582595af_0#z. = (state->xcxx . . $ $anonymous_type_f4553247582595af_0#x. > state->ycxx . . $ $anonymous_type_f4553247582595af_0#y.) ? (state->xcxx . . $ $anonymous_type_f4553247582595af_0#x. - state->ycxx . . $ $anonymous_type_f4553247582595af_0#y.) :
82 MMM_Fcxx . . $ `external/gsl/gsl_rng__fishman2x.c:40:9`! + state->xcxx . . $ $anonymous_type_f4553247582595af_0#x. - state->ycxx . . $ $anonymous_type_f4553247582595af_0#y.;
83
84 return state->zcxx . . $ $anonymous_type_f4553247582595af_0#z.;
85 }
86
87 static double
88 ran_get_doublecxx . . $ ran_get_double(a405b17f82753acc). (void *vstate)
89 {
90 ran_state_tcxx . . $ ran_state_t# *state = (ran_state_tcxx . . $ ran_state_t# *) vstate;
91
92 return ran_getcxx . . $ ran_get(751e5d26f8574c32). (state) / 2147483647.0;
93 }
94
95 static void
96 ran_setcxx . . $ ran_set(5500c4293b1bbef0). (void *vstate, unsigned long int s)
97 {
98 ran_state_tcxx . . $ ran_state_t# *state = (ran_state_tcxx . . $ ran_state_t# *) vstate;
99
100 if ((s % MMM_Fcxx . . $ `external/gsl/gsl_rng__fishman2x.c:40:9`!) == 0 || (s % MMM_Lcxx . . $ `external/gsl/gsl_rng__fishman2x.c:46:9`!) == 0)
101 s = 1; /* default seed is 1 */
102
103 state->xcxx . . $ $anonymous_type_f4553247582595af_0#x. = s % MMM_Fcxx . . $ `external/gsl/gsl_rng__fishman2x.c:40:9`!;
104 state->ycxx . . $ $anonymous_type_f4553247582595af_0#y. = s % MMM_Lcxx . . $ `external/gsl/gsl_rng__fishman2x.c:46:9`!;
105 state->zcxx . . $ $anonymous_type_f4553247582595af_0#z. = (state->xcxx . . $ $anonymous_type_f4553247582595af_0#x. > state->ycxx . . $ $anonymous_type_f4553247582595af_0#y.) ? (state->xcxx . . $ $anonymous_type_f4553247582595af_0#x. - state->ycxx . . $ $anonymous_type_f4553247582595af_0#y.) :
106 MMM_Fcxx . . $ `external/gsl/gsl_rng__fishman2x.c:40:9`! + state->xcxx . . $ $anonymous_type_f4553247582595af_0#x. - state->ycxx . . $ $anonymous_type_f4553247582595af_0#y.;
107
108 return;
109 }
110
111 static const gsl_rng_typecxx . . $ gsl_rng_type# ran_typecxx . . $ ran_type. = {
112 "fishman2x", /* name */
113 MMM_Fcxx . . $ `external/gsl/gsl_rng__fishman2x.c:40:9`! - 1, /* RAND_MAX */
114 0, /* RAND_MIN */
115 sizeof (ran_state_tcxx . . $ ran_state_t#),
116 &ran_setcxx . . $ ran_set(5500c4293b1bbef0).,
117 &ran_getcxx . . $ ran_get(751e5d26f8574c32).,
118 &ran_get_doublecxx . . $ ran_get_double(a405b17f82753acc).
119 };
120
121 const gsl_rng_typecxx . . $ gsl_rng_type# *gsl_rng_fishman2xcxx . . $ gsl_rng_fishman2x. = &ran_typecxx . . $ ran_type.;