@@ -115,7 +115,8 @@ contains
115
115
#:elif k1 == "int64"
116
116
${t1}$, parameter :: ans(15) = [76, 45, 43, 75, 76, 15, 25, 24, 114, &
117
117
113, 94, 29, 109, 93, 89]
118
- #:elif t1[0] == "r" #! for real type
118
+ #:elif t1[0] == "r"
119
+ #! for real type
119
120
${t1}$, parameter :: ans(15) = &
120
121
[0.914826628538749186958511927514337003_${k1}$, &
121
122
0.367330098664966409049981166390352882_${k1}$, &
@@ -132,7 +133,8 @@ contains
132
133
-0.901660046141515819639877804547722917_${k1}$, &
133
134
-0.164090614147737401395943379611708224_${k1}$, &
134
135
-0.333886718190384290672056977200554684_${k1}$]
135
- #:else #! for complex type
136
+ #:else
137
+ #! for complex type
136
138
${t1}$, parameter :: ans(15) = &
137
139
[(0.457413314269374593479255963757168502_${k1}$, &
138
140
0.183665049332483204524990583195176441_${k1}$), &
@@ -169,11 +171,14 @@ contains
169
171
print *, "Test rvs_uniform_${t1[0]}$${k1}$"
170
172
seed = 258147369; k = 5
171
173
call random_seed(seed, get)
172
- #:if t1[0] == "i" #! for integer type
174
+ #:if t1[0] == "i"
175
+ #! for integer type
173
176
loc = 15_${k1}$; scale = 100_${k1}$
174
- #:elif t1[0] == "r" #! for real type
177
+ #:elif t1[0] == "r"
178
+ #! for real type
175
179
loc = -1.0_${k1}$; scale = 2.0_${k1}$
176
- #:else #! for complex type
180
+ #:else
181
+ #! for complex type
177
182
loc = (-0.5_${k1}$,0.5_${k1}$); scale = (1.0_${k1}$, 1.0_${k1}$)
178
183
#:endif
179
184
do i = 1, 5
@@ -183,10 +188,12 @@ contains
183
188
res(i) = uni_rvs(loc, scale) ! 2 dummies
184
189
end do
185
190
res(11:15) = uni_rvs(loc, scale, k) ! 3 dummies
186
- #:if t1[0] == "i" #! for integer type
191
+ #:if t1[0] == "i"
192
+ #! for integer type
187
193
call check(all(res == ans), &
188
194
msg="rvs_uniform_${t1[0]}$${k1}$ failed", warn=warn)
189
- #:else #! for real and complex types
195
+ #:else
196
+ #! for real and complex types
190
197
call check(all(abs(res - ans) < ${k1}$tol), &
191
198
msg="rvs_uniform_${t1[0]}$${k1}$ failed", warn=warn)
192
199
#:endif
@@ -201,22 +208,28 @@ contains
201
208
${t1}$ :: x1, x2(3,4), loc, scale
202
209
integer :: seed, get, i
203
210
real :: res(3,5)
204
- #:if t1[0] == "i" #! for integer type
211
+ #:if t1[0] == "i"
212
+ #! for integer type
205
213
real, parameter :: ans(15) = [(1.96078438E-02, i=1,15)]
206
- #:elif t1[0] == "r" #! for real type
214
+ #:elif t1[0] == "r"
215
+ #! for real type
207
216
real, parameter :: ans(15) = [(0.5, i=1,15)]
208
- #:else #! for complex type
217
+ #:else
218
+ #! for complex type
209
219
real, parameter :: ans(15) = [(1.0, i=1,15)]
210
220
#:endif
211
221
212
222
print *, "Test pdf_uniform_${t1[0]}$${k1}$"
213
223
seed = 147258639
214
224
call random_seed(seed, get)
215
- #:if t1[0] == "i" #! for integer type
225
+ #:if t1[0] == "i"
226
+ #! for integer type
216
227
loc = 0_${k1}$; scale = 50_${k1}$
217
- #:elif t1[0] == "r" #! for real type
228
+ #:elif t1[0] == "r"
229
+ #! for real type
218
230
loc = 0.0_${k1}$; scale = 2.0_${k1}$
219
- #:else #! for complex type
231
+ #:else
232
+ #! for complex type
220
233
loc = (-0.5_${k1}$, 0.5_${k1}$); scale = (1.0_${k1}$, 1.0_${k1}$)
221
234
#:endif
222
235
x1 = uni_rvs(loc, scale)
@@ -260,13 +273,15 @@ contains
260
273
0.851485133, 0.623762369, 5.94059415E-02,&
261
274
0.693069279, 0.544554472, 0.207920790, &
262
275
0.306930691, 0.356435657, 0.128712878]
263
- #:elif t1[0] == "r" #! for real type
276
+ #:elif t1[0] == "r"
277
+ #! for real type
264
278
real, parameter :: ans(15) = [0.170192942, 0.170192942, 0.170192942, &
265
279
0.276106149, 0.754930079, 0.406620681, &
266
280
0.187742814, 0.651605546, 0.934733927, &
267
281
0.151271492, 0.987674534, 0.130533904, &
268
282
0.106271908, 9.27578658E-02, 0.203399420]
269
- #:else #! for complex type
283
+ #:else
284
+ #! for complex type
270
285
real, parameter :: ans(15) = [4.69913185E-02, 4.69913185E-02, &
271
286
4.69913185E-02, 0.306970179, 0.122334257,&
272
287
0.141398594, 0.128925011, 9.85755492E-03,&
@@ -278,11 +293,14 @@ contains
278
293
print *, "Test cdf_uniform_${t1[0]}$${k1}$"
279
294
seed = 369147258
280
295
call random_seed(seed, get)
281
- #:if t1[0] == "i" #! for integer type
296
+ #:if t1[0] == "i"
297
+ #! for integer type
282
298
loc = 14_${k1}$; scale = 100_${k1}$
283
- #:elif t1[0] == "r" #! for real type
299
+ #:elif t1[0] == "r"
300
+ #! for real type
284
301
loc = 0.0_${k1}$; scale = 2.0_${k1}$
285
- #:else #! for complex type
302
+ #:else
303
+ #! for complex type
286
304
loc = (-0.5_${k1}$, -0.5_${k1}$); scale = (1.0_${k1}$, 1.0_${k1}$)
287
305
#:endif
288
306
x1 = uni_rvs(loc, scale)
0 commit comments