15 type(display_type) :: disp
16 integer(IK) :: nsam1, nsam2
17 integer(IK) :: itry, ntry
= 10
21 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
22 call disp%show(
"! Compute the Kolmogorov distance of one sample w.r.t. Uniform or arbitrary distribution.")
23 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
28 integer(IK),
allocatable :: iweight1(:)
29 real(TKG),
allocatable :: rweight1(:)
30 real(TKG),
allocatable :: sample1(:)
33 call disp%show(
"nsam1 = getUnifRand(0, 10)")
35 call disp%show(
"sample1 = getUnifRand(0., 1., nsam1)")
39 call disp%show(
"disKolm = getDisKolm(sample1) ! assuming unweighted samples.")
43 call disp%show(
"disKolm = getDisKolm(sample1, getUnifCDF_RKS) ! assuming unweighted samples.")
47 call disp%show(
"disKolm = getDisKolm(getSorted(sample1), ascending) ! assuming unweighted samples.")
51 call disp%show(
"disKolm = getDisKolm(getSorted(sample1), getUnifCDF_RKS, ascending) ! assuming unweighted samples.")
56 call disp%show(
"iweight1 = getUnifRand(0, 9, nsam1)")
60 call disp%show(
"rweight1 = iweight1")
62 call disp%show(
"disKolm = getDisKolm(getVerbose(sample1, iweight1, sum(iweight1)))")
66 call disp%show(
"disKolm = getDisKolm(getVerbose(sample1, iweight1, sum(iweight1)), getUnifCDF_RKS)")
70 call disp%show(
"disKolm = getDisKolm(sample1, iweight1, sum(iweight1))")
71 disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1))
74 call disp%show(
"disKolm = getDisKolm(sample1, iweight1, sum(iweight1), getUnifCDF_RKS)")
75 disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1), getUnifCDF_RKS)
78 call disp%show(
"disKolm = getDisKolm(sample1, rweight1, sum(rweight1))")
79 disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1))
82 call disp%show(
"disKolm = getDisKolm(sample1, rweight1, sum(rweight1), getUnifCDF_RKS)")
83 disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1), getUnifCDF_RKS)
91 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
92 call disp%show(
"! Compute the Kolmogorov distance of two samples.")
93 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
98 integer(IK),
allocatable :: iweight1(:), iweight2(:)
99 real(TKG),
allocatable :: rweight1(:), rweight2(:)
100 real(TKG),
allocatable :: sample1(:), sample2(:)
103 call disp%show(
"nsam1 = getUnifRand(0, 10); nsam2 = getUnifRand(0, 10)")
105 call disp%show(
"sample1 = getUnifRand(0., 1., nsam1)")
109 call disp%show(
"sample2 = getUnifRand(0., 1., nsam2)")
113 call disp%show(
"disKolm = getDisKolm(sample1, sample2) ! assuming unweighted samples.")
117 call disp%show(
"disKolm = getDisKolm(getSorted(sample1), getSorted(sample2), ascending) ! assuming unweighted samples.")
122 call disp%show(
"iweight1 = getUnifRand(0, 9, nsam1)")
126 call disp%show(
"rweight1 = iweight1")
128 call disp%show(
"disKolm = getDisKolm(getVerbose(sample1, iweight1, sum(iweight1)), sample2)")
132 call disp%show(
"disKolm = getDisKolm(sample1, iweight1, sum(iweight1), sample2)")
133 disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1), sample2)
136 call disp%show(
"disKolm = getDisKolm(sample1, rweight1, sum(rweight1), sample2)")
137 disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1), sample2)
141 call disp%show(
"iweight2 = getUnifRand(0, 9, nsam2)")
145 call disp%show(
"rweight2 = iweight2")
147 call disp%show(
"disKolm = getDisKolm(getVerbose(sample1, iweight1, sum(iweight1)), getVerbose(sample2, iweight2, sum(iweight2)))")
151 call disp%show(
"disKolm = getDisKolm(sample1, iweight1, sum(iweight1), sample2, iweight2, sum(iweight2))")
152 disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1), sample2, iweight2,
sum(iweight2))
155 call disp%show(
"disKolm = getDisKolm(sample1, rweight1, sum(rweight1), sample2, rweight2, sum(rweight2))")
156 disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1), sample2, rweight2,
sum(rweight2))
165 function getUnifCDF_RKS(x)
result(cdf)
168 real(RKG),
intent(in) :: x
Generate and return an array of the specified rank and shape of arbitrary intrinsic type and kind wit...
Allocate or resize (shrink or expand) an input allocatable scalar string or array of rank 1....
Generate and return the sorted elements of the input scalar string or contiguous vector in ascending ...
Generate an equally-weighted (verbose or flattened) array of the input weighted array of rank 1 or 2.
Generate and return the Cumulative Distribution Function (CDF) of a univariate Standard Uniform distr...
Generate and return a scalar or a contiguous array of rank 1 of length s1 of randomly uniformly distr...
This is a generic method of the derived type display_type with pass attribute.
This is a generic method of the derived type display_type with pass attribute.
This module contains procedures and generic interfaces for convenient allocation and filling of array...
This module contains procedures and generic interfaces for resizing allocatable arrays of various typ...
This module contains procedures and generic interfaces for various sorting tasks.
This module contains procedures and generic interfaces for flattening (duplicating the elements of) a...
This module contains classes and procedures for computing various statistical quantities related to t...
This module contains classes and procedures for input/output (IO) or generic display operations on st...
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
integer, parameter RKS
The single-precision real kind in Fortran mode. On most platforms, this is an 32-bit real kind.
Generate and return an object of type display_type.
6nsam1
= getUnifRand(
0,
10)
7sample1
= getUnifRand(
0.,
1., nsam1)
23iweight1
= getUnifRand(
0,
9, nsam1)
33disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1))
36disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1), getUnifCDF_RKS)
39disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1))
42disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1), getUnifCDF_RKS)
46nsam1
= getUnifRand(
0,
10)
47sample1
= getUnifRand(
0.,
1., nsam1)
49+0.545369804,
+0.140653133
63iweight1
= getUnifRand(
0,
9, nsam1)
73disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1))
76disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1), getUnifCDF_RKS)
79disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1))
82disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1), getUnifCDF_RKS)
86nsam1
= getUnifRand(
0,
10)
87sample1
= getUnifRand(
0.,
1., nsam1)
89+0.190912664,
+0.834628999,
+0.150775015,
+0.144199193,
+0.590845406,
+0.857549489,
+0.469593167,
+0.945006430,
+0.626998365,
+0.987677157
103iweight1
= getUnifRand(
0,
9, nsam1)
105+4,
+5,
+9,
+3,
+2,
+6,
+3,
+7,
+3,
+4
113disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1))
116disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1), getUnifCDF_RKS)
119disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1))
122disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1), getUnifCDF_RKS)
126nsam1
= getUnifRand(
0,
10)
127sample1
= getUnifRand(
0.,
1., nsam1)
129+0.880253792,
+0.631350219
143iweight1
= getUnifRand(
0,
9, nsam1)
153disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1))
156disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1), getUnifCDF_RKS)
159disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1))
162disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1), getUnifCDF_RKS)
166nsam1
= getUnifRand(
0,
10)
167sample1
= getUnifRand(
0.,
1., nsam1)
183iweight1
= getUnifRand(
0,
9, nsam1)
193disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1))
196disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1), getUnifCDF_RKS)
199disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1))
202disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1), getUnifCDF_RKS)
206nsam1
= getUnifRand(
0,
10)
207sample1
= getUnifRand(
0.,
1., nsam1)
223iweight1
= getUnifRand(
0,
9, nsam1)
233disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1))
236disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1), getUnifCDF_RKS)
239disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1))
242disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1), getUnifCDF_RKS)
246nsam1
= getUnifRand(
0,
10)
247sample1
= getUnifRand(
0.,
1., nsam1)
263iweight1
= getUnifRand(
0,
9, nsam1)
273disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1))
276disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1), getUnifCDF_RKS)
279disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1))
282disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1), getUnifCDF_RKS)
286nsam1
= getUnifRand(
0,
10)
287sample1
= getUnifRand(
0.,
1., nsam1)
289+0.441453099,
+0.434049487,
+0.448442817,
+0.622417331E-1,
+0.228081524,
+0.126357734,
+0.328559339,
+0.991577804,
+0.391845405,
+0.744467795
303iweight1
= getUnifRand(
0,
9, nsam1)
305+1,
+7,
+6,
+9,
+8,
+7,
+9,
+5,
+1,
+7
313disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1))
316disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1), getUnifCDF_RKS)
319disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1))
322disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1), getUnifCDF_RKS)
326nsam1
= getUnifRand(
0,
10)
327sample1
= getUnifRand(
0.,
1., nsam1)
329+0.337683737,
+0.999534667,
+0.712515473,
+0.573265731,
+0.730983138,
+0.582617462,
+0.658146858,
+0.319438398,
+0.740698159,
+0.625544250
343iweight1
= getUnifRand(
0,
9, nsam1)
345+2,
+9,
+2,
+2,
+6,
+4,
+1,
+5,
+8,
+6
353disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1))
356disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1), getUnifCDF_RKS)
359disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1))
362disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1), getUnifCDF_RKS)
366nsam1
= getUnifRand(
0,
10)
367sample1
= getUnifRand(
0.,
1., nsam1)
369+0.630301297,
+0.670536816,
+0.715096951,
+0.109203219,
+0.582411468,
+0.129118264
383iweight1
= getUnifRand(
0,
9, nsam1)
385+8,
+5,
+1,
+1,
+2,
+5
393disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1))
396disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1), getUnifCDF_RKS)
399disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1))
402disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1), getUnifCDF_RKS)
411nsam1
= getUnifRand(
0,
10); nsam2
= getUnifRand(
0,
10)
412sample1
= getUnifRand(
0.,
1., nsam1)
414+0.168564260,
+0.549820065E-1
415sample2
= getUnifRand(
0.,
1., nsam2)
417+0.430936217E-1,
+0.255195260,
+0.514090896,
+0.355111361E-1,
+0.519169927,
+0.887716413
425iweight1
= getUnifRand(
0,
9, nsam1)
432disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1), sample2)
435disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1), sample2)
439iweight2
= getUnifRand(
0,
9, nsam2)
441+1,
+9,
+1,
+7,
+0,
+8
446disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1), sample2, iweight2,
sum(iweight2))
449disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1), sample2, rweight2,
sum(rweight2))
453nsam1
= getUnifRand(
0,
10); nsam2
= getUnifRand(
0,
10)
454sample1
= getUnifRand(
0.,
1., nsam1)
456+0.551009178E-2,
+0.845844924,
+0.199587941E-1,
+0.243314981,
+0.467586756
457sample2
= getUnifRand(
0.,
1., nsam2)
467iweight1
= getUnifRand(
0,
9, nsam1)
474disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1), sample2)
477disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1), sample2)
481iweight2
= getUnifRand(
0,
9, nsam2)
488disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1), sample2, iweight2,
sum(iweight2))
491disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1), sample2, rweight2,
sum(rweight2))
495nsam1
= getUnifRand(
0,
10); nsam2
= getUnifRand(
0,
10)
496sample1
= getUnifRand(
0.,
1., nsam1)
498+0.968986869,
+0.892931283,
+0.649444222,
+0.350683331,
+0.168000519,
+0.788962305,
+0.689557016
499sample2
= getUnifRand(
0.,
1., nsam2)
501+0.984813869,
+0.672165096,
+0.870108485
509iweight1
= getUnifRand(
0,
9, nsam1)
511+9,
+5,
+6,
+8,
+6,
+6,
+5
516disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1), sample2)
519disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1), sample2)
523iweight2
= getUnifRand(
0,
9, nsam2)
530disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1), sample2, iweight2,
sum(iweight2))
533disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1), sample2, rweight2,
sum(rweight2))
537nsam1
= getUnifRand(
0,
10); nsam2
= getUnifRand(
0,
10)
538sample1
= getUnifRand(
0.,
1., nsam1)
541sample2
= getUnifRand(
0.,
1., nsam2)
543+0.258402228E-1,
+0.812570453E-1,
+0.934010744E-2,
+0.465916872,
+0.211183190,
+0.160584450
551iweight1
= getUnifRand(
0,
9, nsam1)
558disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1), sample2)
561disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1), sample2)
565iweight2
= getUnifRand(
0,
9, nsam2)
567+9,
+8,
+2,
+1,
+5,
+4
572disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1), sample2, iweight2,
sum(iweight2))
575disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1), sample2, rweight2,
sum(rweight2))
579nsam1
= getUnifRand(
0,
10); nsam2
= getUnifRand(
0,
10)
580sample1
= getUnifRand(
0.,
1., nsam1)
582+0.840878904,
+0.445194244E-1,
+0.738602459,
+0.640565872,
+0.615369141,
+0.233224154,
+0.215224266
583sample2
= getUnifRand(
0.,
1., nsam2)
585+0.889613152,
+0.535015821
593iweight1
= getUnifRand(
0,
9, nsam1)
595+7,
+8,
+3,
+1,
+5,
+7,
+0
600disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1), sample2)
603disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1), sample2)
607iweight2
= getUnifRand(
0,
9, nsam2)
614disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1), sample2, iweight2,
sum(iweight2))
617disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1), sample2, rweight2,
sum(rweight2))
621nsam1
= getUnifRand(
0,
10); nsam2
= getUnifRand(
0,
10)
622sample1
= getUnifRand(
0.,
1., nsam1)
624+0.516687870,
+0.517131209,
+0.249935150,
+0.571817279,
+0.348438025E-1,
+0.293173969,
+0.922803283
625sample2
= getUnifRand(
0.,
1., nsam2)
627+0.695454121,
+0.517437041,
+0.850062490,
+0.586457372,
+0.730632424,
+0.454817712
635iweight1
= getUnifRand(
0,
9, nsam1)
637+0,
+9,
+7,
+1,
+1,
+5,
+3
642disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1), sample2)
645disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1), sample2)
649iweight2
= getUnifRand(
0,
9, nsam2)
651+7,
+3,
+5,
+1,
+0,
+2
656disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1), sample2, iweight2,
sum(iweight2))
659disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1), sample2, rweight2,
sum(rweight2))
663nsam1
= getUnifRand(
0,
10); nsam2
= getUnifRand(
0,
10)
664sample1
= getUnifRand(
0.,
1., nsam1)
666+0.409337640,
+0.486655056,
+0.673640907,
+0.284386933,
+0.700790823,
+0.143620551
667sample2
= getUnifRand(
0.,
1., nsam2)
669+0.981227636,
+0.727312505,
+0.637786865,
+0.233378410E-1,
+0.990249157,
+0.913604677,
+0.897146285,
+0.237520874,
+0.821852088E-1
677iweight1
= getUnifRand(
0,
9, nsam1)
679+8,
+9,
+8,
+3,
+0,
+1
684disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1), sample2)
687disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1), sample2)
691iweight2
= getUnifRand(
0,
9, nsam2)
693+9,
+1,
+5,
+9,
+5,
+3,
+6,
+4,
+7
698disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1), sample2, iweight2,
sum(iweight2))
701disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1), sample2, rweight2,
sum(rweight2))
705nsam1
= getUnifRand(
0,
10); nsam2
= getUnifRand(
0,
10)
706sample1
= getUnifRand(
0.,
1., nsam1)
708+0.568476915,
+0.706542611,
+0.770734072,
+0.240142703,
+0.890774131E-1,
+0.389372945,
+0.377652586,
+0.441982448
709sample2
= getUnifRand(
0.,
1., nsam2)
711+0.596845925,
+0.766611695,
+0.541405261,
+0.443778396,
+0.224542439
719iweight1
= getUnifRand(
0,
9, nsam1)
721+6,
+1,
+7,
+7,
+4,
+9,
+4,
+5
726disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1), sample2)
729disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1), sample2)
733iweight2
= getUnifRand(
0,
9, nsam2)
740disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1), sample2, iweight2,
sum(iweight2))
743disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1), sample2, rweight2,
sum(rweight2))
747nsam1
= getUnifRand(
0,
10); nsam2
= getUnifRand(
0,
10)
748sample1
= getUnifRand(
0.,
1., nsam1)
750+0.169377804,
+0.182534456E-1,
+0.146766424
751sample2
= getUnifRand(
0.,
1., nsam2)
753+0.700174689,
+0.644448459,
+0.820686638,
+0.637253225,
+0.216747820,
+0.122719526
761iweight1
= getUnifRand(
0,
9, nsam1)
768disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1), sample2)
771disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1), sample2)
775iweight2
= getUnifRand(
0,
9, nsam2)
777+6,
+9,
+8,
+5,
+5,
+8
782disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1), sample2, iweight2,
sum(iweight2))
785disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1), sample2, rweight2,
sum(rweight2))
789nsam1
= getUnifRand(
0,
10); nsam2
= getUnifRand(
0,
10)
790sample1
= getUnifRand(
0.,
1., nsam1)
793sample2
= getUnifRand(
0.,
1., nsam2)
795+0.131634533,
+0.174845815,
+0.167965651,
+0.182466149,
+0.971214771,
+0.355251074,
+0.665331423,
+0.952193439,
+0.242585123,
+0.152673066
803iweight1
= getUnifRand(
0,
9, nsam1)
810disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1), sample2)
813disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1), sample2)
817iweight2
= getUnifRand(
0,
9, nsam2)
819+2,
+4,
+4,
+4,
+1,
+2,
+1,
+3,
+3,
+0
824disKolm
= getDisKolm(sample1, iweight1,
sum(iweight1), sample2, iweight2,
sum(iweight2))
827disKolm
= getDisKolm(sample1, rweight1,
sum(rweight1), sample2, rweight2,
sum(rweight2))