31 integer(IK) ,
parameter ::
lenRnd = 50_IK
85 ,
1.83388501459509_RK &
86 ,
-2.25884686100365_RK &
87 ,
0.862173320368121_RK &
88 ,
0.318765239858981_RK &
89 ,
-1.30768829630527_RK &
90 ,
-0.433592022305684_RK &
91 ,
0.342624466538650_RK &
92 ,
3.57839693972576_RK &
93 ,
2.76943702988488_RK &
94 ,
-1.34988694015652_RK &
95 ,
3.03492346633185_RK &
96 ,
0.725404224946106_RK &
97 ,
-0.0630548731896562_RK &
98 ,
0.714742903826096_RK &
99 ,
-0.204966058299775_RK &
100 ,
-0.124144348216312_RK &
101 ,
1.48969760778547_RK &
102 ,
1.40903448980048_RK &
103 ,
1.41719241342961_RK &
104 ,
0.671497133608081_RK &
105 ,
-1.20748692268504_RK &
106 ,
0.717238651328839_RK &
107 ,
1.63023528916473_RK &
108 ,
0.488893770311789_RK &
109 ,
1.03469300991786_RK &
110 ,
0.726885133383238_RK &
111 ,
-0.303440924786016_RK &
112 ,
0.293871467096658_RK &
113 ,
-0.787282803758638_RK &
114 ,
0.888395631757642_RK &
115 ,
-1.14707010696915_RK &
116 ,
-1.06887045816803_RK &
117 ,
-0.809498694424876_RK &
118 ,
-2.94428416199490_RK &
119 ,
1.43838029281510_RK &
120 ,
0.325190539456198_RK &
121 ,
-0.754928319169703_RK &
122 ,
1.37029854009523_RK &
123 ,
-1.71151641885370_RK &
124 ,
-0.102242446085491_RK &
125 ,
-0.241447041607358_RK &
126 ,
0.319206739165502_RK &
127 ,
0.312858596637428_RK &
128 ,
-0.864879917324457_RK &
129 ,
-0.0300512961962686_RK &
130 ,
-0.164879019209038_RK &
131 ,
0.627707287528727_RK &
132 ,
1.09326566903948_RK &
133 ,
1.10927329761440_RK ]
241 [
5.28935260000000_RK &
242 ,
5.50145870000000_RK &
243 ,
5.89022390000000_RK &
244 ,
5.06549460000000_RK &
245 ,
5.62128260000000_RK &
246 ,
4.49246930000000_RK &
247 ,
3.54559920000000_RK &
248 ,
4.17171310000000_RK &
249 ,
5.34432780000000_RK &
250 ,
4.30855910000000_RK &
251 ,
6.12466330000000_RK &
252 ,
4.45103540000000_RK &
253 ,
4.08259680000000_RK &
254 ,
7.64761290000000_RK &
255 ,
6.53095480000000_RK &
256 ,
6.07550490000000_RK &
257 ,
7.32100850000000_RK &
258 ,
5.82501650000000_RK &
259 ,
4.19347540000000_RK &
260 ,
4.89687790000000_RK &
261 ,
5.61290890000000_RK &
262 ,
5.70994940000000_RK &
263 ,
5.00047920000000_RK &
264 ,
5.47741520000000_RK &
265 ,
4.99151560000000_RK &
266 ,
5.08172850000000_RK &
267 ,
5.98773500000000_RK &
268 ,
6.97849360000000_RK &
269 ,
6.91612860000000_RK &
270 ,
4.90595890000000_RK &
271 ,
5.71852950000000_RK &
272 ,
4.12146660000000_RK &
273 ,
5.51241440000000_RK &
274 ,
5.26293780000000_RK &
275 ,
5.14932990000000_RK &
276 ,
4.14738170000000_RK &
277 ,
5.55786790000000_RK &
278 ,
7.08800450000000_RK &
279 ,
6.08987380000000_RK &
280 ,
4.73697940000000_RK &
281 ,
3.80934450000000_RK &
282 ,
6.03942270000000_RK &
283 ,
5.96600840000000_RK &
284 ,
6.06674510000000_RK &
285 ,
5.84361600000000_RK &
286 ,
6.19013970000000_RK &
287 ,
4.43891700000000_RK &
288 ,
4.45833300000000_RK &
289 ,
5.47659170000000_RK &
290 ,
4.65761920000000_RK ]
308 call test%summarize()
321 logical(
LK) :: assertion
322 integer(
IK) ,
parameter :: nq
= 9_IK
323 integer(
IK) ,
parameter :: Weight(
lenRnd)
= [
2_IK,
2_IK,
1_IK,
0_IK,
0_IK,
1_IK,
2_IK,
2_IK,
1_IK,
0_IK,
0_IK,
0_IK,
1_IK,
2_IK &
324 ,
2_IK,
1_IK,
0_IK,
0_IK,
1_IK,
2_IK,
2_IK,
1_IK,
0_IK,
0_IK,
1_IK,
2_IK,
2_IK,
1_IK &
325 ,
0_IK,
0_IK,
1_IK,
2_IK,
2_IK,
2_IK,
1_IK,
0_IK,
0_IK,
1_IK,
2_IK,
2_IK,
1_IK,
0_IK &
326 ,
0_IK,
1_IK,
2_IK,
2_IK,
1_IK,
0_IK,
0_IK,
1_IK ]
327 real(
RK) ,
parameter :: SortedQuantileProbability(nq)
= [
0._RK,
0.05_RK,
0.1_RK,
0.25_RK,
0.5_RK,
0.75_RK,
0.9_RK,
0.95_RK,
1._RK]
328 real(
RK) :: Quantile_ref(nq)
329 real(
RK) :: Quantile(nq)
330 real(
RK) :: Difference(nq)
334 call getQuantile( SortedQuantileProbability
= SortedQuantileProbability
&
336 , Quantile
= Quantile_ref
&
338 if (assertion)
return
339 assertion
= .not. assertion
343 call getQuantile( SortedQuantileProbability
= SortedQuantileProbability
&
346 , sumWeight
= sum(Weight)
&
347 , Quantile
= Quantile
&
349 if (assertion)
return
350 assertion
= .not. assertion
352 Difference
= (Quantile
- Quantile_ref)
353 assertion
= all(Difference
== 0._RK)
355 if (
test%traceable
.and. .not. assertion)
then
357 write(
test%disp
%unit,
"(*(g0,:,', '))")
358 write(
test%disp
%unit,
"(*(g0,:,', '))")
"Quantile_ref ", Quantile_ref
359 write(
test%disp
%unit,
"(*(g0,:,', '))")
"Quantile ", Quantile
360 write(
test%disp
%unit,
"(*(g0,:,', '))")
"difference ", Difference
361 write(
test%disp
%unit,
"(*(g0,:,', '))")
375 logical(
LK) :: assertion
376 integer(
IK) ,
parameter :: nq
= 9_IK
377 real(
RK) ,
parameter :: SortedQuantileProbability(nq)
= [
0._RK,
0.05_RK,
0.1_RK,
0.25_RK,
0.5_RK,
0.75_RK,
0.9_RK,
0.95_RK,
1._RK]
378 real(
RK) ,
parameter :: Quantile_ref(nq)
= [
-2.944284161994900_RK &
379 ,
-1.711516418853700_RK &
380 ,
-1.307688296305270_RK &
381 ,
-.
4335920223056840_RK &
382 ,
+.
3192067391655020_RK &
383 ,
+1.034693009917860_RK &
384 ,
+1.489697607785470_RK &
385 ,
+2.769437029884880_RK &
386 ,
+3.578396939725760_RK ]
387 real(
RK) :: Quantile(nq)
388 real(
RK) :: Difference(nq)
390 call getQuantile( SortedQuantileProbability
= SortedQuantileProbability
&
392 , Quantile
= Quantile
&
395 Difference
= (Quantile
- Quantile_ref)
396 assertion
= all(Difference
== 0._RK)
398 if (
test%traceable
.and. .not. assertion)
then
400 write(
test%disp
%unit,
"(*(g0,:,', '))")
401 write(
test%disp
%unit,
"(*(g0,:,', '))")
"Quantile_ref ", Quantile_ref
402 write(
test%disp
%unit,
"(*(g0,:,', '))")
"Quantile ", Quantile
403 write(
test%disp
%unit,
"(*(g0,:,', '))")
"difference ", Difference
404 write(
test%disp
%unit,
"(*(g0,:,', '))")
417 logical(LK) :: assertion
418 real(RK) ,
parameter :: median_ref
= 5.477003450000000_RK
423 assertion
= median
== median_ref
425 if (
test%traceable
.and. .not. assertion)
then
427 write(
test%disp
%unit,
"(*(g0,:,' '))")
428 write(
test%disp
%unit,
"(*(g0,:,' '))")
"median_ref =", median_ref
429 write(
test%disp
%unit,
"(*(g0,:,' '))")
"median =", median
430 write(
test%disp
%unit,
"(*(g0,:,' '))")
443 logical(LK) :: assertion
444 real(RK) ,
parameter :: median_ref
= 5.477415200000000_RK
449 assertion
= median
== median_ref
451 if (
test%traceable
.and. .not. assertion)
then
453 write(
test%disp
%unit,
"(*(g0,:,' '))")
454 write(
test%disp
%unit,
"(*(g0,:,' '))")
"median_ref =", median_ref
455 write(
test%disp
%unit,
"(*(g0,:,' '))")
"median =", median
456 write(
test%disp
%unit,
"(*(g0,:,' '))")
464end module test_pm_sampleQuan
Generate an equally-weighted (verbose or flattened) array of the input weighted array of rank 1 or 2.
This module contains procedures and generic interfaces for flattening (duplicating the elements of) a...
This module contains classes and procedures for reporting and handling errors.
character(*, SK), parameter MODULE_NAME
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
integer, parameter RK
The default real kind in the ParaMonte library: real64 in Fortran, c_double in C-Fortran Interoperati...
integer, parameter LK
The default logical kind in the ParaMonte library: kind(.true.) in Fortran, kind(....
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
This module contains procedures and data types for computing sample quantile.
This module contains a simple unit-testing framework for the Fortran libraries, including the ParaMon...
This module contains tests of the module pm_sampleQuan.
logical(LK) function test_getMedian_RK_1()
logical(LK) function test_getMedian_RK_2()
real(RK), dimension(ndata), parameter DataUnsorted_RK
real(RK), dimension(lenRnd) StdNormRnd1
logical(LK) function test_getQuantile_1()
integer(IK), parameter lenRnd
logical(LK) function test_getQuantile_2()
This is the derived type for generating objects to gracefully and verbosely handle runtime unexpected...
This is the derived type test_type for generating objects that facilitate testing of a series of proc...