GNU Octave 10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
setall.f
Go to the documentation of this file.
1 SUBROUTINE setall(iseed1,iseed2)
2C**********************************************************************
3C
4C SUBROUTINE SETALL(ISEED1,ISEED2)
5C SET ALL random number generators
6C
7C Sets the initial seed of generator 1 to ISEED1 and ISEED2. The
8C initial seeds of the other generators are set accordingly, and
9C all generators states are set to these seeds.
10C
11C This is a transcription from Pascal to Fortran of routine
12C Set_Initial_Seed from the paper
13C
14C L'Ecuyer, P. and Cote, S. "Implementing a Random Number Package
15C with Splitting Facilities." ACM Transactions on Mathematical
16C Software, 17:98-111 (1991)
17C
18C
19C Arguments
20C
21C
22C ISEED1 -> First of two integer seeds
23C INTEGER ISEED1
24C
25C ISEED2 -> Second of two integer seeds
26C INTEGER ISEED1
27C
28C**********************************************************************
29C .. Parameters ..
30 INTEGER*4 numg
31 parameter(numg=32)
32C ..
33C .. Scalar Arguments ..
34 INTEGER*4 iseed1,iseed2
35 LOGICAL qssd
36C ..
37C .. Scalars in Common ..
38 INTEGER*4 a1,a1vw,a1w,a2,a2vw,a2w,m1,m2
39C ..
40C .. Arrays in Common ..
41 INTEGER*4 cg1(numg),cg2(numg),ig1(numg),ig2(numg),lg1(numg),
42 + lg2(numg)
43 LOGICAL qanti(numg)
44C ..
45C .. Local Scalars ..
46 INTEGER*4 g,ocgn
47 LOGICAL qqssd
48C ..
49C .. External Functions ..
50 INTEGER*4 mltmod
51 LOGICAL qrgnin
52 EXTERNAL mltmod,qrgnin
53C ..
54C .. External Subroutines ..
55 EXTERNAL getcgn,initgn,inrgcm,setcgn
56C ..
57C .. Common blocks ..
58 COMMON /globe/m1,m2,a1,a2,a1w,a2w,a1vw,a2vw,ig1,ig2,lg1,lg2,cg1,
59 + cg2,qanti
60C ..
61C .. Save statement ..
62 SAVE /globe/,qqssd
63C ..
64C .. Data statements ..
65 DATA qqssd/.false./
66C ..
67C .. Executable Statements ..
68C
69C TELL IGNLGI, THE ACTUAL NUMBER GENERATOR, THAT THIS ROUTINE
70C HAS BEEN CALLED.
71C
72 qqssd = .true.
73 CALL getcgn(ocgn)
74C
75C Initialize Common Block if Necessary
76C
77 IF (.NOT. (qrgnin())) CALL inrgcm()
78 ig1(1) = iseed1
79 ig2(1) = iseed2
80 CALL initgn(-1)
81 DO 10,g = 2,numg
82 ig1(g) = mltmod(a1vw,ig1(g-1),m1)
83 ig2(g) = mltmod(a2vw,ig2(g-1),m2)
84 CALL setcgn(g)
85 CALL initgn(-1)
86 10 CONTINUE
87 CALL setcgn(ocgn)
88 RETURN
89
90 entry rgnqsd(qssd)
91C**********************************************************************
92C
93C SUBROUTINE RGNQSD
94C Random Number Generator Query SeeD set?
95C
96C Returns (LOGICAL) QSSD as .TRUE. if SETALL has been invoked,
97C otherwise returns .FALSE.
98C
99C**********************************************************************
100 qssd = qqssd
101 RETURN
102
103 END
subroutine getcgn(g)
Definition getcgn.f:2
subroutine initgn(isdtyp)
Definition initgn.f:2
subroutine inrgcm()
Definition inrgcm.f:2
subroutine setall(iseed1, iseed2)
Definition setall.f:2