Skip to content

Commit 8bf15dc

Browse files
authored
parameters over values + misc change
1 parent 08ec3b8 commit 8bf15dc

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

test/stats/test_distribution_beta.fypp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,12 @@ contains
105105
#:for k1, t1 in RC_KINDS_TYPES
106106
subroutine test_beta_pdf_${t1[0]}$${k1}$
107107
${t1}$ :: x1, x2(3,4), ba, bb, loc
108+
integer, parameter :: n = 15
108109
integer :: i
109-
real(${k1}$) :: res(15)
110+
real(${k1}$) :: res(n)
110111
#:if t1[0] == "r"
111112
#! for real type
112-
real(${k1}$), parameter :: ans(15) = &
113+
real(${k1}$), parameter :: ans(*) = &
113114
[2.45759999999999978E+00_${k1}$, &
114115
2.45759999999999978E+00_${k1}$, &
115116
2.45759999999999978E+00_${k1}$, &
@@ -127,7 +128,7 @@ contains
127128
3.83999999999999897E-02_${k1}$]
128129
#:else
129130
#! for complex type
130-
real(${k1}$), parameter :: ans(15) = &
131+
real(${k1}$), parameter :: ans(*) = &
131132
[2.77620563793055197E+00_${k1}$, &
132133
2.77620563793055197E+00_${k1}$, &
133134
2.77620563793055197E+00_${k1}$, &
@@ -147,13 +148,17 @@ contains
147148

148149
print *, "Test beta_distribution_pdf_${t1[0]}$${k1}$"
149150
#:if t1[0] == "r"
150-
ba = 2.0_${k1}$; bb = 5.0_${k1}$; loc = 0._${k1}$
151+
ba = 2.0_${k1}$
152+
bb = 5.0_${k1}$
153+
loc = 0._${k1}$
151154
x1 = 0.2_${k1}$
152155
x2 = reshape([0.05_${k1}$, 0.1_${k1}$, 0.15_${k1}$, 0.25_${k1}$, &
153156
0.3_${k1}$, 0.35_${k1}$, 0.4_${k1}$, 0.45_${k1}$, &
154157
0.5_${k1}$, 0.6_${k1}$, 0.7_${k1}$, 0.8_${k1}$], [3,4])
155158
#:else
156-
ba = (2.0_${k1}$, 0.7_${k1}$); bb = (5.0_${k1}$, 3.0_${k1}$); loc = (0._${k1}$, 0._${k1}$)
159+
ba = (2.0_${k1}$, 0.7_${k1}$)
160+
bb = (5.0_${k1}$, 3.0_${k1}$)
161+
loc = (0._${k1}$, 0._${k1}$)
157162
x1 = (0.2_${k1}$, 0.3_${k1}$)
158163
x2 = reshape([(0.05_${k1}$, 0.05_${k1}$), (0.1_${k1}$, 0.1_${k1}$), &
159164
(0.15_${k1}$, 0.2_${k1}$), (0.25_${k1}$, 0.25_${k1}$), &
@@ -166,7 +171,7 @@ contains
166171
res(1:3) = beta_pdf(x1, ba, bb, loc)
167172
res(4:15) = reshape(beta_pdf(x2, ba, bb, loc), [12])
168173

169-
do i = 1, 15
174+
do i = 1, n
170175
call check(abs(res(i) - ans(i)) < max(${k1}$tol, 1.0e-11_${k1}$), &
171176
msg="beta_distribution_pdf_${t1[0]}$${k1}$ failed", &
172177
warn=warn)

0 commit comments

Comments
 (0)