Debian Codegraph @

Modules/ThirdParty/VNL/src/vxl/v3p/netlib/lapack/double/dlaruv.c

raw symbols SCIP
1 /* lapack/double/dlaruv.f -- translated by f2c (version 20090411).
2 You must link the resulting object file with libf2c:
3 on Microsoft Windows system, link with libf2c.lib;
4 on Linux or Unix systems, link with .../path/to/libf2c.a -lm
5 or, if you install libf2c.a in a standard place, with -lf2c -lm
6 -- in that order, at the end of the command line, as in
7 cc *.o -lf2c -lm
8 Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
9
10 http://www.netlib.org/f2c/libf2c.zip
11 */
12
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 #include "v3p_netlib.h"cxx . . $ `<file>/Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_netlib.h`/
17
18 /*< SUBROUTINE DLARUV( ISEED, N, X ) >*/
19 /* Subroutine */ int dlaruv_cxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_netlib_mangle.h:94:9`!(integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *iseed, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *n, doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! *x)
20 {
21 /* Initialized data */
22
23 static integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! mm[512] /* was [128][4] */ = { 494,2637,255,2008,1253,
24 3344,4084,1739,3143,3468,688,1657,1238,3166,1292,3422,1270,2016,
25 154,2862,697,1706,491,931,1444,444,3577,3944,2184,1661,3482,657,
26 3023,3618,1267,1828,164,3798,3087,2400,2870,3876,1905,1593,1797,
27 1234,3460,328,2861,1950,617,2070,3331,769,1558,2412,2800,189,287,
28 2045,1227,2838,209,2770,3654,3993,192,2253,3491,2889,2857,2094,
29 1818,688,1407,634,3231,815,3524,1914,516,164,303,2144,3480,119,
30 3357,837,2826,2332,2089,3780,1700,3712,150,2000,3375,1621,3090,
31 3765,1149,3146,33,3082,2741,359,3316,1749,185,2784,2202,2199,1364,
32 1244,2020,3160,2785,2772,1217,1822,1245,2252,3904,2774,997,2573,
33 1148,545,322,789,1440,752,2859,123,1848,643,2405,2638,2344,46,
34 3814,913,3649,339,3808,822,2832,3078,3633,2970,637,2249,2081,4019,
35 1478,242,481,2075,4058,622,3376,812,234,641,4005,1122,3135,2640,
36 2302,40,1832,2247,2034,2637,1287,1691,496,1597,2394,2584,1843,336,
37 1472,2407,433,2096,1761,2810,566,442,41,1238,1086,603,840,3168,
38 1499,1084,3438,2408,1589,2391,288,26,512,1456,171,1677,2657,2270,
39 2587,2961,1970,1817,676,1410,3723,2803,3185,184,663,499,3784,1631,
40 1925,3912,1398,1349,1441,2224,2411,1907,3192,2786,382,37,759,2948,
41 1862,3802,2423,2051,2295,1332,1832,2405,3638,3661,327,3660,716,
42 1842,3987,1368,1848,2366,2508,3754,1766,3572,2893,307,1297,3966,
43 758,2598,3406,2922,1038,2934,2091,2451,1580,1958,2055,1507,1078,
44 3273,17,854,2916,3971,2889,3831,2621,1541,893,736,3992,787,2125,
45 2364,2460,257,1574,3912,1216,3248,3401,2124,2762,149,2245,166,466,
46 4018,1399,190,2879,153,2320,18,712,2159,2318,2091,3443,1510,449,
47 1956,2201,3137,3399,1321,2271,3667,2703,629,2365,2431,1113,3922,
48 2554,184,2099,3228,4012,1921,3452,3901,572,3309,3171,817,3039,
49 1696,1256,3715,2077,3019,1497,1101,717,51,981,1978,1813,3881,76,
50 3846,3694,1682,124,1660,3997,479,1141,886,3514,1301,3604,1888,
51 1836,1990,2058,692,1194,20,3285,2046,2107,3508,3525,3801,2549,
52 1145,2253,305,3301,1065,3133,2913,3285,1241,1197,3729,2501,1673,
53 541,2753,949,2361,1165,4081,2725,3305,3069,3617,3733,409,2157,
54 1361,3973,1865,2525,1409,3445,3577,77,3761,2149,1449,3005,225,85,
55 3673,3117,3089,1349,2057,413,65,1845,697,3085,3441,1573,3689,2941,
56 929,533,2841,4077,721,2821,2249,2397,2817,245,1913,1997,3121,997,
57 1833,2877,1633,981,2009,941,2449,197,2441,285,1473,2741,3129,909,
58 2801,421,4073,2813,2337,1429,1177,1901,81,1669,2633,2269,129,1141,
59 249,3917,2481,3941,2217,2749,3041,1877,345,2861,1809,3141,2825,
60 157,2881,3637,1465,2829,2161,3365,361,2685,3745,2325,3609,3821,
61 3537,517,3017,2141,1537 };
62
63 /* System generated locals */
64 integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! i__1;
65
66 /* Local variables */
67 integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! i__, i1, i2, i3, i4, it1, it2, it3, it4;
68
69
70 /* -- LAPACK auxiliary routine (version 3.2) -- */
71 /* -- LAPACK is a software package provided by Univ. of Tennessee, -- */
72 /* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */
73 /* November 2006 */
74
75 /* .. Scalar Arguments .. */
76 /*< INTEGER N >*/
77 /* .. */
78 /* .. Array Arguments .. */
79 /*< INTEGER ISEED( 4 ) >*/
80 /*< DOUBLE PRECISION X( N ) >*/
81 /* .. */
82
83 /* Purpose */
84 /* ======= */
85
86 /* DLARUV returns a vector of n random real numbers from a uniform (0,1) */
87 /* distribution (n <= 128). */
88
89 /* This is an auxiliary routine called by DLARNV and ZLARNV. */
90
91 /* Arguments */
92 /* ========= */
93
94 /* ISEED (input/output) INTEGER array, dimension (4) */
95 /* On entry, the seed of the random number generator; the array */
96 /* elements must be between 0 and 4095, and ISEED(4) must be */
97 /* odd. */
98 /* On exit, the seed is updated. */
99
100 /* N (input) INTEGER */
101 /* The number of random numbers to be generated. N <= 128. */
102
103 /* X (output) DOUBLE PRECISION array, dimension (N) */
104 /* The generated random numbers. */
105
106 /* Further Details */
107 /* =============== */
108
109 /* This routine uses a multiplicative congruential method with modulus */
110 /* 2**48 and multiplier 33952834046453 (see G.S.Fishman, */
111 /* 'Multiplicative congruential random number generators with modulus */
112 /* 2**b: an exhaustive analysis for b = 32 and a partial analysis for */
113 /* b = 48', Math. Comp. 189, pp 331-344, 1990). */
114
115 /* 48-bit integers are stored in 4 integer array elements with 12 bits */
116 /* per element. Hence the routine is portable across machines with */
117 /* integers of 32 bits or more. */
118
119 /* ===================================================================== */
120
121 /* .. Parameters .. */
122 /*< DOUBLE PRECISION ONE >*/
123 /*< PARAMETER ( ONE = 1.0D0 ) >*/
124 /*< INTEGER LV, IPW2 >*/
125 /*< DOUBLE PRECISION R >*/
126 /*< PARAMETER ( LV = 128, IPW2 = 4096, R = ONE / IPW2 ) >*/
127 /* .. */
128 /* .. Local Scalars .. */
129 /*< INTEGER I, I1, I2, I3, I4, IT1, IT2, IT3, IT4, J >*/
130 /* .. */
131 /* .. Local Arrays .. */
132 /*< INTEGER MM( LV, 4 ) >*/
133 /* .. */
134 /* .. Intrinsic Functions .. */
135 /*< INTRINSIC DBLE, MIN, MOD >*/
136 /* .. */
137 /* .. Data statements .. */
138 /*< >*/
139 /* Parameter adjustments */
140 --iseed;
141 --x;
142
143 /* Function Body */
144 /*< >*/
145 /*< >*/
146 /*< >*/
147 /*< >*/
148 /*< >*/
149 /*< >*/
150 /*< >*/
151 /*< >*/
152 /*< >*/
153 /*< >*/
154 /*< >*/
155 /*< >*/
156 /*< >*/
157 /*< >*/
158 /*< >*/
159 /*< >*/
160 /*< >*/
161 /*< >*/
162 /*< >*/
163 /*< >*/
164 /*< >*/
165 /*< >*/
166 /*< >*/
167 /*< >*/
168 /*< >*/
169 /*< >*/
170 /*< >*/
171 /*< >*/
172 /*< >*/
173 /*< >*/
174 /*< >*/
175 /*< >*/
176 /*< >*/
177 /*< >*/
178 /*< >*/
179 /*< >*/
180 /*< >*/
181 /*< >*/
182 /*< >*/
183 /*< >*/
184 /*< >*/
185 /*< >*/
186 /*< >*/
187 /*< >*/
188 /*< >*/
189 /*< >*/
190 /*< >*/
191 /*< >*/
192 /*< >*/
193 /*< >*/
194 /*< >*/
195 /*< >*/
196 /*< >*/
197 /*< >*/
198 /*< >*/
199 /*< >*/
200 /*< >*/
201 /*< >*/
202 /*< >*/
203 /*< >*/
204 /*< >*/
205 /*< >*/
206 /*< >*/
207 /*< >*/
208 /*< >*/
209 /*< >*/
210 /*< >*/
211 /*< >*/
212 /*< >*/
213 /*< >*/
214 /*< >*/
215 /*< >*/
216 /*< >*/
217 /*< >*/
218 /*< >*/
219 /*< >*/
220 /*< >*/
221 /*< >*/
222 /*< >*/
223 /*< >*/
224 /*< >*/
225 /*< >*/
226 /*< >*/
227 /*< >*/
228 /*< >*/
229 /*< >*/
230 /*< >*/
231 /*< >*/
232 /*< >*/
233 /*< >*/
234 /*< >*/
235 /*< >*/
236 /*< >*/
237 /*< >*/
238 /*< >*/
239 /*< >*/
240 /*< >*/
241 /*< >*/
242 /*< >*/
243 /*< >*/
244 /*< >*/
245 /*< >*/
246 /*< >*/
247 /*< >*/
248 /*< >*/
249 /*< >*/
250 /*< >*/
251 /*< >*/
252 /*< >*/
253 /*< >*/
254 /*< >*/
255 /*< >*/
256 /*< >*/
257 /*< >*/
258 /*< >*/
259 /*< >*/
260 /*< >*/
261 /*< >*/
262 /*< >*/
263 /*< >*/
264 /*< >*/
265 /*< >*/
266 /*< >*/
267 /*< >*/
268 /*< >*/
269 /*< >*/
270 /*< >*/
271 /* .. */
272 /* .. Executable Statements .. */
273
274 /*< I1 = ISEED( 1 ) >*/
275 i1 = iseed[1];
276 /*< I2 = ISEED( 2 ) >*/
277 i2 = iseed[2];
278 /*< I3 = ISEED( 3 ) >*/
279 i3 = iseed[3];
280 /*< I4 = ISEED( 4 ) >*/
281 i4 = iseed[4];
282
283 /*< DO 10 I = 1, MIN( N, LV ) >*/
284 i__1 = mincxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_original.h:159:9`!(*n,128);
285 for (i__ = 1; i__ <= i__1; ++i__) {
286
287 /*< 20 CONTINUE >*/
288 L20:
289
290 /* Multiply the seed by i-th power of the multiplier modulo 2**48 */
291
292 /*< IT4 = I4*MM( I, 4 ) >*/
293 it4 = i4 * mm[i__ + 383];
294 /*< IT3 = IT4 / IPW2 >*/
295 it3 = it4 / 4096;
296 /*< IT4 = IT4 - IPW2*IT3 >*/
297 it4 -= it3 << 12;
298 /*< IT3 = IT3 + I3*MM( I, 4 ) + I4*MM( I, 3 ) >*/
299 it3 = it3 + i3 * mm[i__ + 383] + i4 * mm[i__ + 255];
300 /*< IT2 = IT3 / IPW2 >*/
301 it2 = it3 / 4096;
302 /*< IT3 = IT3 - IPW2*IT2 >*/
303 it3 -= it2 << 12;
304 /*< IT2 = IT2 + I2*MM( I, 4 ) + I3*MM( I, 3 ) + I4*MM( I, 2 ) >*/
305 it2 = it2 + i2 * mm[i__ + 383] + i3 * mm[i__ + 255] + i4 * mm[i__ +
306 127];
307 /*< IT1 = IT2 / IPW2 >*/
308 it1 = it2 / 4096;
309 /*< IT2 = IT2 - IPW2*IT1 >*/
310 it2 -= it1 << 12;
311 /*< >*/
312 it1 = it1 + i1 * mm[i__ + 383] + i2 * mm[i__ + 255] + i3 * mm[i__ +
313 127] + i4 * mm[i__ - 1];
314 /*< IT1 = MOD( IT1, IPW2 ) >*/
315 it1 %= 4096;
316
317 /* Convert 48-bit integer to a real number in the interval (0,1) */
318
319 /*< >*/
320 x[i__] = ((doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`!) it1 + ((doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`!) it2 + ((doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`!) it3 + (
321 doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`!) it4 * 2.44140625e-4) * 2.44140625e-4) *
322 2.44140625e-4) * 2.44140625e-4;
323
324 /*< IF (X( I ).EQ.1.0D0) THEN >*/
325 if (x[i__] == 1.) {
326 /* If a real number has n bits of precision, and the first */
327 /* n bits of the 48-bit integer above happen to be all 1 (which */
328 /* will occur about once every 2**n calls), then X( I ) will */
329 /* be rounded to exactly 1.0. */
330 /* Since X( I ) is not supposed to return exactly 0.0 or 1.0, */
331 /* the statistically correct thing to do in this situation is */
332 /* simply to iterate again. */
333 /* N.B. the case X( I ) = 0.0 should not be possible. */
334 /*< I1 = I1 + 2 >*/
335 i1 += 2;
336 /*< I2 = I2 + 2 >*/
337 i2 += 2;
338 /*< I3 = I3 + 2 >*/
339 i3 += 2;
340 /*< I4 = I4 + 2 >*/
341 i4 += 2;
342 /*< GOTO 20 >*/
343 goto L20;
344 /*< END IF >*/
345 }
346
347 /*< 10 CONTINUE >*/
348 /* L10: */
349 }
350
351 /* Return final value of seed */
352
353 /*< ISEED( 1 ) = IT1 >*/
354 // iseed[1] = it1;
355 /*< ISEED( 2 ) = IT2 >*/
356 iseed[2] = it2;
357 /*< ISEED( 3 ) = IT3 >*/
358 iseed[3] = it3;
359 /*< ISEED( 4 ) = IT4 >*/
360 iseed[4] = it4;
361 /*< RETURN >*/
362 return 0;
363
364 /* End of DLARUV */
365
366 /*< END >*/
367 } /* dlaruv_ */
368
369 #ifdef __cplusplus
370 }
371 #endif