@@ -42,7 +42,8 @@ Module stdlib_stats_distribution_uniform
42
42
interface uniform_distribution_pdf
43
43
!! Version experiment
44
44
!!
45
- !! Get uniform distribution probability density (pdf) for integer, real and complex variables
45
+ !! Get uniform distribution probability density (pdf) for integer, real and
46
+ !! complex variables
46
47
!! ([Specification](../page/specs/stdlib_stats_distribution_uniform.html#
47
48
!! description))
48
49
@@ -54,7 +55,8 @@ Module stdlib_stats_distribution_uniform
54
55
interface uniform_distribution_cdf
55
56
!! Version experimental
56
57
!!
57
- !! Get uniform distribution cumulative distribution function (cdf) for integer, real and complex variables
58
+ !! Get uniform distribution cumulative distribution function (cdf) for
59
+ !! integer, real and complex variables
58
60
!! ([Specification](../page/specs/stdlib_stats_distribution_uniform.html#
59
61
!! description))
60
62
!!
@@ -66,7 +68,8 @@ Module stdlib_stats_distribution_uniform
66
68
interface shuffle
67
69
!! Version experimental
68
70
!!
69
- !! Fisher-Yates shuffle algorithm for a rank one array of integer, real and complex variables
71
+ !! Fisher-Yates shuffle algorithm for a rank one array of integer, real and
72
+ !! complex variables
70
73
!! ([Specification](../page/specs/stdlib_stats_distribution_uniform.html#
71
74
!! description))
72
75
!!
@@ -85,13 +88,14 @@ Module stdlib_stats_distribution_uniform
85
88
! https://www.pcg-random.org/posts/bounded-rands.html
86
89
!
87
90
! Fortran 90 translated from c by Jim-215-fisher
91
+ !
88
92
${t1}$, intent(in) :: scale
89
93
${t1}$ :: res, u, mask, n
90
94
integer :: zeros, bits_left, bits
91
95
92
96
n = scale
93
- if(n <= 0_${k1}$) call error_stop("Error: Uniform distribution scale" &
94
- //" parameter must be positive")
97
+ if(n <= 0_${k1}$) call error_stop("Error(unif_dist_rvs_1) : Uniform" &
98
+ //" distribution scale parameter must be positive")
95
99
zeros = leadz(n)
96
100
bits = bit_size(n) - zeros
97
101
mask = shiftr(not(0_${k1}$), zeros)
@@ -121,8 +125,8 @@ Module stdlib_stats_distribution_uniform
121
125
${t1}$, intent(in) :: loc, scale
122
126
${t1}$ :: res
123
127
124
- if(scale == 0_${k1}$) call error_stop("Error: Uniform distribution" &
125
- //" scale parameter must be non-zero ")
128
+ if(scale <= 0_${k1}$) call error_stop("Error(unif_dist_rvs) : Uniform" &
129
+ //" distribution scale parameter must be positive ")
126
130
res = loc + unif_dist_rvs_1_${t1[0]}$${k1}$(scale)
127
131
return
128
132
end function unif_dist_rvs_${t1[0]}$${k1}$
@@ -153,8 +157,8 @@ Module stdlib_stats_distribution_uniform
153
157
${t1}$, intent(in) :: scale
154
158
${t1}$ :: res
155
159
156
- if(scale == 0._${k1}$) call error_stop("Error: Uniform distribution" &
157
- //" scale parameter must be non-zero")
160
+ if(scale == 0._${k1}$) call error_stop("Error(unif_dist_rvs_1): " &
161
+ //"Uniform distribution scale parameter must be non-zero")
158
162
res = scale * unif_dist_rvs_0_${t1[0]}$${k1}$( )
159
163
return
160
164
end function unif_dist_rvs_1_${t1[0]}$${k1}$
@@ -169,8 +173,8 @@ Module stdlib_stats_distribution_uniform
169
173
${t1}$, intent(in) :: loc, scale
170
174
${t1}$ :: res
171
175
172
- if(scale == 0._${k1}$) call error_stop("Error: Uniform distribution" &
173
- //" scale parameter must be non-zero")
176
+ if(scale == 0._${k1}$) call error_stop("Error(unif_dist_rvs): " &
177
+ //"Uniform distribution scale parameter must be non-zero")
174
178
res = loc + scale * unif_dist_rvs_0_${t1[0]}$${k1}$( )
175
179
return
176
180
end function unif_dist_rvs_${t1[0]}$${k1}$
@@ -187,8 +191,8 @@ Module stdlib_stats_distribution_uniform
187
191
${t1}$ :: res
188
192
real(${k1}$) :: r1, r2, tr, ti
189
193
190
- if(scale == (0.0_${k1}$, 0.0_${k1}$)) call error_stop("Error: Uniform" &
191
- //" distribution scale parameter must be non-zero")
194
+ if(scale == (0.0_${k1}$, 0.0_${k1}$)) call error_stop("Error(uni_dist_" &
195
+ //"rvs_1): Uniform distribution scale parameter must be non-zero")
192
196
r1 = unif_dist_rvs_0_r${k1}$( )
193
197
if(real(scale) == 0.0_${k1}$) then
194
198
ti = aimag(scale) * r1
@@ -219,8 +223,8 @@ Module stdlib_stats_distribution_uniform
219
223
${t1}$ :: res
220
224
real(${k1}$) :: r1, r2, tr, ti
221
225
222
- if(scale == (0.0_${k1}$, 0.0_${k1}$)) call error_stop("Error: Uniform" &
223
- //" distribution scale parameter must be non-zero")
226
+ if(scale == (0.0_${k1}$, 0.0_${k1}$)) call error_stop("Error(uni_dist_" &
227
+ //"rvs): Uniform distribution scale parameter must be non-zero")
224
228
r1 = unif_dist_rvs_0_r${k1}$( )
225
229
if(real(scale) == 0.0_${k1}$) then
226
230
tr = real(loc)
@@ -249,8 +253,8 @@ Module stdlib_stats_distribution_uniform
249
253
integer :: i, zeros, bits_left, bits
250
254
251
255
n = scale
252
- if(n == 0_${k1}$) call error_stop("Error: Uniform distribution" &
253
- //" scale parameter must be non-zero")
256
+ if(n == 0_${k1}$) call error_stop("Error(unif_dist_rvs_array) : Uniform" &
257
+ //" distribution scale parameter must be non-zero")
254
258
allocate(res(array_size))
255
259
zeros = leadz(n)
256
260
bits = bit_size(n) - zeros
@@ -287,8 +291,8 @@ Module stdlib_stats_distribution_uniform
287
291
integer :: i
288
292
289
293
290
- if(scale == 0._${k1}$) call error_stop("Error: Uniform distribution " &
291
- //" scale parameter must be non-zero")
294
+ if(scale == 0._${k1}$) call error_stop("Error(unif_dist_rvs_array): " &
295
+ //" Uniform distribution scale parameter must be non-zero")
292
296
allocate(res(array_size))
293
297
do i = 1, array_size
294
298
tmp = shiftr(dist_rand(INT_ONE), 11)
@@ -311,8 +315,8 @@ Module stdlib_stats_distribution_uniform
311
315
integer :: i
312
316
313
317
314
- if(scale == (0.0_${k1}$, 0.0_${k1}$)) call error_stop("Error: Uniform" &
315
- //" distribution scale parameter must be non-zero")
318
+ if(scale == (0.0_${k1}$, 0.0_${k1}$)) call error_stop("Error(unif_dist_" &
319
+ //"rvs_array): Uniform distribution scale parameter must be non-zero")
316
320
allocate(res(array_size))
317
321
do i = 1, array_size
318
322
tmp = shiftr(dist_rand(INT_ONE), 11)
0 commit comments