6 module subroutine create_r32_array(x, xmin, xmax)
8 real(real32),
intent(out) :: x(:)
9 real(real32),
intent(in),
optional :: xmin, xmax
12 real(real32),
parameter :: one = 1.0
13 real(real32),
parameter :: tol = 0.99
14 real(real32) :: low, high
17 if (
present(xmin))
then
22 if (
present(xmax))
then
28 x = tol * (low + (high + one - low) * x)
32 module subroutine create_r32_matrix(x, xmin, xmax)
34 real(real32),
intent(out) :: x(:,:)
35 real(real32),
intent(in),
optional :: xmin, xmax
38 real(real32),
parameter :: one = 1.0
39 real(real32),
parameter :: tol = 0.99
40 real(real32) :: low, high
43 if (
present(xmin))
then
48 if (
present(xmax))
then
54 x = tol * (low + (high + one - low) * x)
60 module subroutine create_r64_array(x, xmin, xmax)
62 real(real64),
intent(out) :: x(:)
63 real(real64),
intent(in),
optional :: xmin, xmax
66 real(real64),
parameter :: one = 1.0d0
67 real(real32),
parameter :: tol = 0.99d0
68 real(real64) :: low, high
71 if (
present(xmin))
then
76 if (
present(xmax))
then
82 x = tol * (low + (high + one - low) * x)
86 module subroutine create_r64_matrix(x, xmin, xmax)
88 real(real64),
intent(out) :: x(:,:)
89 real(real64),
intent(in),
optional :: xmin, xmax
92 real(real64),
parameter :: one = 1.0d0
93 real(real32),
parameter :: tol = 0.99d0
94 real(real64) :: low, high
97 if (
present(xmin))
then
102 if (
present(xmax))
then
107 call random_number(x)
108 x = tol * (low + (high + one - low) * x)
114 module subroutine create_c32_array(x, xmin, xmax)
116 complex(real32),
intent(out) :: x(:)
117 complex(real32),
intent(in),
optional :: xmin, xmax
120 complex(real32),
parameter :: one = (1.0, 0.0)
121 real(real32),
parameter :: tol = 0.99
122 complex(real32) :: low, high
123 real(real32),
allocatable,
dimension(:) :: xr, xi
130 if (
present(xmin))
then
135 if (
present(xmax))
then
140 call random_number(xr)
141 call random_number(xi)
142 x = tol * (low + (high + one - low) * cmplx(xr, xi, real32))
146 module subroutine create_c32_matrix(x, xmin, xmax)
148 complex(real32),
intent(out) :: x(:,:)
149 complex(real32),
intent(in),
optional :: xmin, xmax
152 complex(real32),
parameter :: one = (1.0, 0.0)
153 real(real32),
parameter :: tol = 0.99
154 complex(real32) :: low, high
155 real(real32),
allocatable,
dimension(:,:) :: xr, xi
156 integer(int32) :: m, n
163 if (
present(xmin))
then
168 if (
present(xmax))
then
173 call random_number(xr)
174 call random_number(xi)
175 x = tol * (low + (high + one - low) * cmplx(xr, xi, real32))
181 module subroutine create_i16_array(x, xmin, xmax)
183 integer(int16),
intent(out) :: x(:)
184 integer(int16),
intent(in),
optional :: xmin, xmax
187 integer(int16),
parameter :: one = 1
188 integer(int16) :: low, high
189 real(real64),
allocatable :: u(:)
192 if (
present(xmin))
then
197 if (
present(xmax))
then
203 call random_number(u)
204 x = low + floor((high + one - low) * u)
208 module subroutine create_i16_matrix(x, xmin, xmax)
210 integer(int16),
intent(out) :: x(:,:)
211 integer(int16),
intent(in),
optional :: xmin, xmax
214 integer(int16),
parameter :: one = 1
215 integer(int16) :: low, high
216 real(real64),
allocatable :: u(:,:)
219 if (
present(xmin))
then
224 if (
present(xmax))
then
229 allocate(u(
size(x, 1),
size(x, 2)))
230 call random_number(u)
231 x = low + floor((high + one - low) * u)
237 module subroutine create_i32_array(x, xmin, xmax)
239 integer(int32),
intent(out) :: x(:)
240 integer(int32),
intent(in),
optional :: xmin, xmax
243 integer(int32),
parameter :: one = 1
244 integer(int32) :: low, high
245 real(real64),
allocatable :: u(:)
248 if (
present(xmin))
then
253 if (
present(xmax))
then
259 call random_number(u)
260 x = low + floor((high + one - low) * u)
264 module subroutine create_i32_matrix(x, xmin, xmax)
266 integer(int32),
intent(out) :: x(:,:)
267 integer(int32),
intent(in),
optional :: xmin, xmax
270 integer(int32),
parameter :: one = 1
271 integer(int32) :: low, high
272 real(real64),
allocatable :: u(:,:)
275 if (
present(xmin))
then
280 if (
present(xmax))
then
285 allocate(u(
size(x, 1),
size(x, 2)))
286 call random_number(u)
287 x = low + floor((high + one - low) * u)
293 module subroutine create_i64_array(x, xmin, xmax)
295 integer(int64),
intent(out) :: x(:)
296 integer(int64),
intent(in),
optional :: xmin, xmax
299 integer(int64),
parameter :: one = 1
300 integer(int64) :: low, high
301 real(real64),
allocatable :: u(:)
304 if (
present(xmin))
then
309 if (
present(xmax))
then
315 call random_number(u)
316 x = low + floor((high + one - low) * u)
320 module subroutine create_i64_matrix(x, xmin, xmax)
322 integer(int64),
intent(out) :: x(:,:)
323 integer(int64),
intent(in),
optional :: xmin, xmax
326 integer(int64),
parameter :: one = 1
327 integer(int64) :: low, high
328 real(real64),
allocatable :: u(:,:)
331 if (
present(xmin))
then
336 if (
present(xmax))
then
341 allocate(u(
size(x, 1),
size(x, 2)))
342 call random_number(u)
343 x = low + floor((high + one - low) * u)
A collection of routines to assist in testing.