GNU Octave 10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
advnst.f
Go to the documentation of this file.
1 SUBROUTINE advnst(k)
2C**********************************************************************
3C
4C SUBROUTINE ADVNST(K)
5C ADV-a-N-ce ST-ate
6C
7C Advances the state of the current generator by 2^K values and
8C resets the initial seed to that value.
9C
10C This is a transcription from Pascal to Fortran of routine
11C Advance_State from the paper
12C
13C L'Ecuyer, P. and Cote, S. "Implementing a Random Number Package
14C with Splitting Facilities." ACM Transactions on Mathematical
15C Software, 17:98-111 (1991)
16C
17C
18C Arguments
19C
20C
21C K -> The generator is advanced by2^K values
22C INTEGER K
23C
24C**********************************************************************
25C .. Parameters ..
26 INTEGER*4 numg
27 parameter(numg=32)
28C ..
29C .. Scalar Arguments ..
30 INTEGER*4 k
31C ..
32C .. Scalars in Common ..
33 INTEGER*4 a1,a1vw,a1w,a2,a2vw,a2w,m1,m2
34C ..
35C .. Arrays in Common ..
36 INTEGER*4 cg1(numg),cg2(numg),ig1(numg),ig2(numg),lg1(numg),
37 + lg2(numg)
38 LOGICAL qanti(numg)
39C ..
40C .. Local Scalars ..
41 INTEGER*4 g,i,ib1,ib2
42C ..
43C .. External Functions ..
44 INTEGER*4 mltmod
45 LOGICAL qrgnin
46 EXTERNAL mltmod,qrgnin
47C ..
48C .. External Subroutines ..
49 EXTERNAL getcgn,setsd
50C ..
51C .. Common blocks ..
52 COMMON /globe/m1,m2,a1,a2,a1w,a2w,a1vw,a2vw,ig1,ig2,lg1,lg2,cg1,
53 + cg2,qanti
54C ..
55C .. Save statement ..
56 SAVE /globe/
57C ..
58C .. Executable Statements ..
59C Abort unless random number generator initialized
60 IF (qrgnin()) GO TO 10
61 WRITE (*,*) ' ADVNST called before random number generator ',
62 + ' initialized -- abort!'
63 CALL xstopx
64 + (' ADVNST called before random number generator initialized')
65
66 10 CALL getcgn(g)
67C
68 ib1 = a1
69 ib2 = a2
70 DO 20,i = 1,k
71 ib1 = mltmod(ib1,ib1,m1)
72 ib2 = mltmod(ib2,ib2,m2)
73 20 CONTINUE
74 CALL setsd(mltmod(ib1,cg1(g),m1),mltmod(ib2,cg2(g),m2))
75C
76C NOW, IB1 = A1**K AND IB2 = A2**K
77C
78 RETURN
79
80 END
subroutine advnst(k)
Definition advnst.f:2
subroutine getcgn(g)
Definition getcgn.f:2
subroutine setsd(iseed1, iseed2)
Definition setsd.f:2