ParaMonte Fortran 2.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
pm_distanceKolm::setDisKolm Interface Reference

Return the Kolmogorov distance of a sample1 of size nsam1 from another sample sample2 of size nsam2 or the CDF of the Uniform or a custom reference distribution.
More...

Detailed Description

Return the Kolmogorov distance of a sample1 of size nsam1 from another sample sample2 of size nsam2 or the CDF of the Uniform or a custom reference distribution.

See pm_distanceKolm for the mathematical definition of the Kolmogorov distance.

Parameters
[out]disKolm: The output scalar of the same type and kind as the input disKolm
  1. type real of kind any supported by the processor (e.g., RK, RK32, RK64, or RK128),
representing the Kolmogorov distance of sample1 from sample2.
[in,out]sample1: The input/output vector of size nsam1 of the same type and kind as the output disKolm, representing the first sample whose distance form the other sample must be computed.
  1. If the optional input argument order is set to ascending, then sample1 has intent(in).
  2. If the optional input argument order is missing, then sample1 has intent(inout).
    On output, the contents of sample1 are sorted in ascending order.
[in,out]weight1: The input/output vector of the same size as the size of sample1 of,
  1. type integer of default kind IK,
  2. type real of the same kind as that of the output disKolm of type real,
representing the weights of the corresponding elements of the input sample1.
  1. If the optional input argument order is set to ascending, then weight1 has intent(in).
  2. If the optional input argument order is missing, then weight1 has intent(inout).
    On output, the contents of weight1 are sorted in ascending order of sample1.
(optional. default = [(1, i = 1, size(sample1))]. It must be present if the input argument weight2 is also present.)
[in]weisum1: The input scalar of the same type and kind as the input weight1, containing the value sum(weight1).
(optional. It must be present if and only if the input argument weight1 is also present.)
[in]sample2: The input/output vector of size nsam2 of the same type and kind as the input disKolm, representing the second sample whose distance form the other sample must be computed.
  1. If the optional input argument order is set to ascending, then sample2 has intent(in).
  2. If the optional input argument order is missing, then sample2 has intent(inout).
    On output, the contents of sample2 are sorted in ascending order.
(optional, the default is the Uniform distribution. It must be present if and only if the input argument getCDF is missing.)
[in]weight2: The input vector of the same size as the size of sample2 of,
  1. type integer of default kind IK,
  2. type real of the same kind as that of the output disKolm of type real,
representing the weights of the corresponding elements of the input sample2.
  1. If the optional input argument order is set to ascending, then weight2 has intent(in).
  2. If the optional input argument order is missing, then weight2 has intent(inout).
    On output, the contents of weight2 are sorted in ascending order of sample2.
(optional. default = [(1, i = 1, size(sample2))]. It can be present only if the input argument wieght1 and sample2 are also present.)
[in]weisum2: The input scalar of the same type and kind as the input weight2, containing the value sum(weight2).
(optional. It must be present if and only if the input argument weight2 is also present.)
getCDF: The external user-specified function that takes one input scalar argument of the same type and kind as the output disKolm.
It returns a scalar of same type and kind as the output disKolm, representing the Cumulative Distribution Function (CDF) of the continuous distribution whose Kolmogorov distance with respect to the input sample1 must be measured.
The following illustrates the generic interface of getCDF(),
function getCDF(x) result(cdf)
real(RKG), intent(in) :: x
real(RKG) :: cdf
end function
where RKG refers to the kind type parameter of the output disKolm.
(optional, the default is the CDF of the Uniform distribution. It must be present if and only if the input argument sample2 is missing.)
[in]order: The input scalar that can be,
  1. the constant ascending or an object of type ascending_type, implying that the input samples are both sorted in ascending order.
(optional. If missing, the samples will be sorted in ascending order before computing the distance.)


Possible calling interfaces

use pm_distanceKolm, only: setDisKolm, ascending
! unweighted sample against uniform distribution.
call setDisKolm(disKolm, sample1(:))
call setDisKolm(disKolm, sample1(:), order)
! weighted sample against uniform distribution.
call setDisKolm(disKolm, sample1(:), weight1(:), weisum1)
call setDisKolm(disKolm, sample1(:), weight1(:), weisum1, order)
! unweighted sample against custom distribution CDF.
call setDisKolm(disKolm, sample1(:), getCDF)
call setDisKolm(disKolm, sample1(:), getCDF, order)
! weighted sample against custom distribution CDF.
call setDisKolm(disKolm, sample1(:), weight1(:), weisum1, getCDF)
call setDisKolm(disKolm, sample1(:), weight1(:), weisum1, getCDF, order)
! unweighted samples.
call setDisKolm(disKolm, sample1(:), sample2(:))
call setDisKolm(disKolm, sample1(:), sample2(:), order)
! one weighted sample.
call setDisKolm(disKolm, sample1(:), weight1(:), weisum1, sample2(:))
call setDisKolm(disKolm, sample1(:), weight1(:), weisum1, sample2(:), order)
! two weighted samples.
call setDisKolm(disKolm, sample1(:), weight1(:), weisum1, sample2(:), weight2(:), weisum2)
call setDisKolm(disKolm, sample1(:), weight1(:), weisum1, sample2(:), weight2(:), weisum2, order)
Return the Kolmogorov distance of a sample1 of size nsam1 from another sample sample2 of size nsam2 o...
This module contains classes and procedures for computing the Kolmogorov statistical distance.
Warning
The condition all(0 <= weight1) must hold for the corresponding input arguments.
The condition all(0 <= weight2) must hold for the corresponding input arguments.
The condition weisum1 == sum(weight1) must hold for the corresponding input arguments.
The condition weisum2 == sum(weight2) must hold for the corresponding input arguments.
The condition size(sample1) == size(weight1) must hold for the corresponding input arguments.
The condition size(sample2) == size(weight2) must hold for the corresponding input arguments.
The condition isAscending(sample1) .or. .not. same_type_as(order, ascending) must hold for the corresponding input arguments.
The condition isAscending(sample2) .or. .not. same_type_as(order, ascending) must hold for the corresponding input arguments.
The condition all(0 <= sample1) .and. all(sample1 <= 1) .or. present(sample2) must hold for the corresponding input arguments.
The condition all(0 <= sample1) .and. all(sample1 <= 1) must hold for the corresponding input arguments when the input arguments getCDF and sample2 are both missing.
The condition 0 <= getCDF(x) <= 1 must hold for the corresponding input arguments.
These conditions are verified only if the library is built with the preprocessor macro CHECK_ENABLED=1.
The returned distance is 0 if any of the two samples are empty.
The pure procedure(s) documented herein become impure when the ParaMonte library is compiled with preprocessor macro CHECK_ENABLED=1.
By default, these procedures are pure in release build and impure in debug and testing builds.


Example usage

1program example
2
3 use pm_kind, only: SK, IK
4 use pm_distUnif, only: getUnifRand
6 use pm_distanceKolm, only: ascending
9 use pm_arraySort, only: getSorted
10 use pm_arrayFill, only: getFilled
11 use pm_io, only: display_type
12
13 implicit none
14
15 type(display_type) :: disp
16 integer(IK) :: nsam1, nsam2
17 integer(IK) :: itry, ntry = 10
18 disp = display_type(file = "main.out.F90")
19
20 call disp%skip()
21 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
22 call disp%show("! Compute the Kolmogorov distance of two unweighted samples.")
23 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
24 call disp%skip()
25
26 block
27 use pm_kind, only: TKG => RKS ! all other real kinds are also supported.
28 integer(IK), allocatable :: iweight1(:), iweight2(:)
29 real(TKG), allocatable :: rweight1(:), rweight2(:)
30 real(TKG), allocatable :: sample1(:), sample2(:)
31 real(TKG) :: disKolm
32 do itry = 1, ntry
33 call disp%show("nsam1 = getUnifRand(0, 10); nsam2 = getUnifRand(0, 10)")
34 nsam1 = getUnifRand(0, 10); nsam2 = getUnifRand(0, 10)
35 call disp%show("sample1 = getUnifRand(0., 1., nsam1)")
36 sample1 = getUnifRand(0., 1., nsam1)
37 call disp%show("sample1")
38 call disp%show( sample1 )
39 call disp%show("sample2 = getUnifRand(0., 1., nsam2)")
40 sample2 = getUnifRand(0., 1., nsam2)
41 call disp%show("sample2")
42 call disp%show( sample2 )
43 call disp%show("call setDisKolm(disKolm, sample1, sample2)")
44 call setDisKolm(disKolm, sample1, sample2)
45 call disp%show("sample1")
46 call disp%show( sample1 )
47 call disp%show("sample2")
48 call disp%show( sample2 )
49 call disp%show("disKolm")
50 call disp%show( disKolm )
51 call disp%show("call setDisKolm(disKolm, getSorted(sample1), getSorted(sample2), ascending)")
52 call setDisKolm(disKolm, getSorted(sample1), getSorted(sample2), ascending)
53 call disp%show("disKolm")
54 call disp%show( disKolm )
55 call disp%skip()
56 call disp%show("iweight1 = getUnifRand(0, 9, nsam1)")
57 iweight1 = getUnifRand(0, 9, nsam1)
58 call disp%show("iweight1")
59 call disp%show( iweight1 )
60 call disp%show("rweight1 = iweight1")
61 rweight1 = iweight1
62 call disp%show("call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(sample2), ascending)")
63 call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(sample2), ascending)
64 call disp%show("disKolm")
65 call disp%show( disKolm )
66 call disp%show("call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2)")
67 call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2)
68 call disp%show("disKolm")
69 call disp%show( disKolm )
70 call disp%show("call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2)")
71 call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2)
72 call disp%show("disKolm")
73 call disp%show( disKolm )
74 call disp%skip()
75 call disp%show("iweight1 = getUnifRand(0, 9, nsam1)")
76 iweight1 = getUnifRand(0, 9, nsam1)
77 call disp%show("iweight1")
78 call disp%show( iweight1 )
79 call disp%show("iweight2 = getUnifRand(0, 9, nsam2)")
80 iweight2 = getUnifRand(0, 9, nsam2)
81 call disp%show("iweight2")
82 call disp%show( iweight2 )
83 call disp%show("rweight1 = iweight1; rweight2 = iweight2")
84 rweight1 = iweight1; rweight2 = iweight2
85 call disp%show("call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(getVerbose(sample2, iweight2, sum(iweight2))), ascending)")
86 call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(getVerbose(sample2, iweight2, sum(iweight2))), ascending)
87 call disp%show("disKolm")
88 call disp%show( disKolm )
89 call disp%show("call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2, iweight2, sum(iweight2))")
90 call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2, iweight2, sum(iweight2))
91 call disp%show("disKolm")
92 call disp%show( disKolm )
93 call disp%show("call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2, rweight2, sum(rweight2))")
94 call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2, rweight2, sum(rweight2))
95 call disp%show("disKolm")
96 call disp%show( disKolm )
97 call disp%skip()
98 end do
99 end block
100
101end program example
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 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.
Definition: pm_io.F90:11726
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11508
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...
Definition: pm_io.F90:252
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
Definition: pm_io.F90:11393
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
Definition: pm_kind.F90:268
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
Definition: pm_kind.F90:540
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
Definition: pm_kind.F90:539
integer, parameter RKS
The single-precision real kind in Fortran mode. On most platforms, this is an 32-bit real kind.
Definition: pm_kind.F90:567
Generate and return an object of type display_type.
Definition: pm_io.F90:10282

Example Unix compile command via Intel ifort compiler
1#!/usr/bin/env sh
2rm main.exe
3ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example Windows Batch compile command via Intel ifort compiler
1del main.exe
2set PATH=..\..\..\lib;%PATH%
3ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
4main.exe

Example Unix / MinGW compile command via GNU gfortran compiler
1#!/usr/bin/env sh
2rm main.exe
3gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example output
1
2!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3! Compute the Kolmogorov distance of two unweighted samples.
4!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5
6nsam1 = getUnifRand(0, 10); nsam2 = getUnifRand(0, 10)
7sample1 = getUnifRand(0., 1., nsam1)
8sample1
9+0.931571484, +0.110995531
10sample2 = getUnifRand(0., 1., nsam2)
11sample2
12+0.457399786, +0.167605162, +0.287622333, +0.813541412, +0.735735536, +0.284389138, +0.165165663, +0.102227449, +0.831871629E-1, +0.584797621
13call setDisKolm(disKolm, sample1, sample2)
14sample1
15+0.110995531, +0.931571484
16sample2
17+0.831871629E-1, +0.102227449, +0.165165663, +0.167605162, +0.284389138, +0.287622333, +0.457399786, +0.584797621, +0.735735536, +0.813541412
18disKolm
19+0.500000000
20call setDisKolm(disKolm, getSorted(sample1), getSorted(sample2), ascending)
21disKolm
22+0.500000000
23
24iweight1 = getUnifRand(0, 9, nsam1)
25iweight1
26+4, +7
27rweight1 = iweight1
28call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(sample2), ascending)
29disKolm
30+0.636363626
31call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2)
32disKolm
33+0.636363626
34call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2)
35disKolm
36+0.636363626
37
38iweight1 = getUnifRand(0, 9, nsam1)
39iweight1
40+4, +5
41iweight2 = getUnifRand(0, 9, nsam2)
42iweight2
43+3, +4, +4, +6, +4, +4, +1, +1, +3, +8
44rweight1 = iweight1; rweight2 = iweight2
45call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(getVerbose(sample2, iweight2, sum(iweight2))), ascending)
46disKolm
47+0.555555582
48call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2, iweight2, sum(iweight2))
49disKolm
50+0.555555582
51call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2, rweight2, sum(rweight2))
52disKolm
53+0.555555582
54
55nsam1 = getUnifRand(0, 10); nsam2 = getUnifRand(0, 10)
56sample1 = getUnifRand(0., 1., nsam1)
57sample1
58+0.216701448, +0.411540270, +0.603947580
59sample2 = getUnifRand(0., 1., nsam2)
60sample2
61+0.602208734
62call setDisKolm(disKolm, sample1, sample2)
63sample1
64+0.216701448, +0.411540270, +0.603947580
65sample2
66+0.602208734
67disKolm
68+0.666666687
69call setDisKolm(disKolm, getSorted(sample1), getSorted(sample2), ascending)
70disKolm
71+0.666666687
72
73iweight1 = getUnifRand(0, 9, nsam1)
74iweight1
75+4, +3, +5
76rweight1 = iweight1
77call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(sample2), ascending)
78disKolm
79+0.583333373
80call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2)
81disKolm
82+0.583333373
83call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2)
84disKolm
85+0.583333373
86
87iweight1 = getUnifRand(0, 9, nsam1)
88iweight1
89+3, +2, +5
90iweight2 = getUnifRand(0, 9, nsam2)
91iweight2
92+6
93rweight1 = iweight1; rweight2 = iweight2
94call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(getVerbose(sample2, iweight2, sum(iweight2))), ascending)
95disKolm
96+0.500000000
97call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2, iweight2, sum(iweight2))
98disKolm
99+0.500000000
100call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2, rweight2, sum(rweight2))
101disKolm
102+0.500000000
103
104nsam1 = getUnifRand(0, 10); nsam2 = getUnifRand(0, 10)
105sample1 = getUnifRand(0., 1., nsam1)
106sample1
107+0.161184549, +0.875498533, +0.636004627, +0.143107593, +0.130053163, +0.867653549, +0.844846964
108sample2 = getUnifRand(0., 1., nsam2)
109sample2
110+0.198523223, +0.333143950, +0.383027673, +0.137604952, +0.843168497, +0.692062199, +0.988395095, +0.987976074, +0.237512648, +0.970388055E-1
111call setDisKolm(disKolm, sample1, sample2)
112sample1
113+0.130053163, +0.143107593, +0.161184549, +0.636004627, +0.844846964, +0.867653549, +0.875498533
114sample2
115+0.970388055E-1, +0.137604952, +0.198523223, +0.237512648, +0.333143950, +0.383027673, +0.692062199, +0.843168497, +0.987976074, +0.988395095
116disKolm
117+0.228571460
118call setDisKolm(disKolm, getSorted(sample1), getSorted(sample2), ascending)
119disKolm
120+0.228571460
121
122iweight1 = getUnifRand(0, 9, nsam1)
123iweight1
124+1, +5, +4, +7, +5, +2, +6
125rweight1 = iweight1
126call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(sample2), ascending)
127disKolm
128+0.266666681
129call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2)
130disKolm
131+0.266666681
132call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2)
133disKolm
134+0.266666681
135
136iweight1 = getUnifRand(0, 9, nsam1)
137iweight1
138+7, +2, +0, +8, +0, +9, +1
139iweight2 = getUnifRand(0, 9, nsam2)
140iweight2
141+7, +4, +3, +8, +7, +9, +7, +4, +6, +2
142rweight1 = iweight1; rweight2 = iweight2
143call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(getVerbose(sample2, iweight2, sum(iweight2))), ascending)
144disKolm
145+0.333333343
146call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2, iweight2, sum(iweight2))
147disKolm
148+0.333333373
149call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2, rweight2, sum(rweight2))
150disKolm
151+0.333333373
152
153nsam1 = getUnifRand(0, 10); nsam2 = getUnifRand(0, 10)
154sample1 = getUnifRand(0., 1., nsam1)
155sample1
156+0.823514402, +0.209821463E-1, +0.418656349
157sample2 = getUnifRand(0., 1., nsam2)
158sample2
159+0.767507792, +0.267899692, +0.624346375, +0.296286941, +0.350709081, +0.396015644
160call setDisKolm(disKolm, sample1, sample2)
161sample1
162+0.209821463E-1, +0.418656349, +0.823514402
163sample2
164+0.267899692, +0.296286941, +0.350709081, +0.396015644, +0.624346375, +0.767507792
165disKolm
166+0.333333343
167call setDisKolm(disKolm, getSorted(sample1), getSorted(sample2), ascending)
168disKolm
169+0.333333343
170
171iweight1 = getUnifRand(0, 9, nsam1)
172iweight1
173+5, +5, +8
174rweight1 = iweight1
175call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(sample2), ascending)
176disKolm
177+0.444444418
178call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2)
179disKolm
180+0.444444418
181call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2)
182disKolm
183+0.444444418
184
185iweight1 = getUnifRand(0, 9, nsam1)
186iweight1
187+6, +0, +1
188iweight2 = getUnifRand(0, 9, nsam2)
189iweight2
190+2, +5, +4, +5, +4, +5
191rweight1 = iweight1; rweight2 = iweight2
192call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(getVerbose(sample2, iweight2, sum(iweight2))), ascending)
193disKolm
194+0.857142925
195call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2, iweight2, sum(iweight2))
196disKolm
197+0.857142925
198call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2, rweight2, sum(rweight2))
199disKolm
200+0.857142925
201
202nsam1 = getUnifRand(0, 10); nsam2 = getUnifRand(0, 10)
203sample1 = getUnifRand(0., 1., nsam1)
204sample1
205+0.875822783, +0.560038149
206sample2 = getUnifRand(0., 1., nsam2)
207sample2
208+0.158343613, +0.435239375, +0.561090529, +0.489927530E-1, +0.640377164
209call setDisKolm(disKolm, sample1, sample2)
210sample1
211+0.560038149, +0.875822783
212sample2
213+0.489927530E-1, +0.158343613, +0.435239375, +0.561090529, +0.640377164
214disKolm
215+0.600000024
216call setDisKolm(disKolm, getSorted(sample1), getSorted(sample2), ascending)
217disKolm
218+0.600000024
219
220iweight1 = getUnifRand(0, 9, nsam1)
221iweight1
222+1, +7
223rweight1 = iweight1
224call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(sample2), ascending)
225disKolm
226+0.875000000
227call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2)
228disKolm
229+0.875000000
230call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2)
231disKolm
232+0.875000000
233
234iweight1 = getUnifRand(0, 9, nsam1)
235iweight1
236+7, +4
237iweight2 = getUnifRand(0, 9, nsam2)
238iweight2
239+3, +4, +5, +7, +4
240rweight1 = iweight1; rweight2 = iweight2
241call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(getVerbose(sample2, iweight2, sum(iweight2))), ascending)
242disKolm
243+0.521739125
244call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2, iweight2, sum(iweight2))
245disKolm
246+0.521739125
247call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2, rweight2, sum(rweight2))
248disKolm
249+0.521739125
250
251nsam1 = getUnifRand(0, 10); nsam2 = getUnifRand(0, 10)
252sample1 = getUnifRand(0., 1., nsam1)
253sample1
254+0.395731807, +0.803265333, +0.436752379, +0.165841103, +0.134208202E-1, +0.376550555, +0.332787275, +0.979622841, +0.415675938
255sample2 = getUnifRand(0., 1., nsam2)
256sample2
257+0.543866992
258call setDisKolm(disKolm, sample1, sample2)
259sample1
260+0.134208202E-1, +0.165841103, +0.332787275, +0.376550555, +0.395731807, +0.415675938, +0.436752379, +0.803265333, +0.979622841
261sample2
262+0.543866992
263disKolm
264+0.777777791
265call setDisKolm(disKolm, getSorted(sample1), getSorted(sample2), ascending)
266disKolm
267+0.777777791
268
269iweight1 = getUnifRand(0, 9, nsam1)
270iweight1
271+9, +9, +8, +0, +6, +3, +6, +9, +0
272rweight1 = iweight1
273call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(sample2), ascending)
274disKolm
275+0.819999993
276call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2)
277disKolm
278+0.819999993
279call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2)
280disKolm
281+0.819999993
282
283iweight1 = getUnifRand(0, 9, nsam1)
284iweight1
285+3, +2, +2, +5, +9, +2, +7, +6, +2
286iweight2 = getUnifRand(0, 9, nsam2)
287iweight2
288+7
289rweight1 = iweight1; rweight2 = iweight2
290call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(getVerbose(sample2, iweight2, sum(iweight2))), ascending)
291disKolm
292+0.789473712
293call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2, iweight2, sum(iweight2))
294disKolm
295+0.789473712
296call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2, rweight2, sum(rweight2))
297disKolm
298+0.789473712
299
300nsam1 = getUnifRand(0, 10); nsam2 = getUnifRand(0, 10)
301sample1 = getUnifRand(0., 1., nsam1)
302sample1
303+0.621028125, +0.402078450, +0.542143404, +0.882892311, +0.490416467, +0.459867895, +0.356163919, +0.447853208, +0.444199860
304sample2 = getUnifRand(0., 1., nsam2)
305sample2
306+0.241751194, +0.139997661, +0.777944505, +0.916078627, +0.689117253, +0.636398673, +0.706976771, +0.755873442, +0.622131288, +0.474320233
307call setDisKolm(disKolm, sample1, sample2)
308sample1
309+0.356163919, +0.402078450, +0.444199860, +0.447853208, +0.459867895, +0.490416467, +0.542143404, +0.621028125, +0.882892311
310sample2
311+0.139997661, +0.241751194, +0.474320233, +0.622131288, +0.636398673, +0.689117253, +0.706976771, +0.755873442, +0.777944505, +0.916078627
312disKolm
313+0.588888884
314call setDisKolm(disKolm, getSorted(sample1), getSorted(sample2), ascending)
315disKolm
316+0.588888884
317
318iweight1 = getUnifRand(0, 9, nsam1)
319iweight1
320+7, +8, +5, +3, +3, +7, +8, +3, +8
321rweight1 = iweight1
322call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(sample2), ascending)
323disKolm
324+0.546153843
325call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2)
326disKolm
327+0.546153843
328call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2)
329disKolm
330+0.546153843
331
332iweight1 = getUnifRand(0, 9, nsam1)
333iweight1
334+6, +4, +1, +2, +6, +7, +9, +7, +5
335iweight2 = getUnifRand(0, 9, nsam2)
336iweight2
337+5, +3, +5, +5, +2, +3, +8, +1, +6, +6
338rweight1 = iweight1; rweight2 = iweight2
339call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(getVerbose(sample2, iweight2, sum(iweight2))), ascending)
340disKolm
341+0.598162413
342call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2, iweight2, sum(iweight2))
343disKolm
344+0.598162413
345call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2, rweight2, sum(rweight2))
346disKolm
347+0.598162413
348
349nsam1 = getUnifRand(0, 10); nsam2 = getUnifRand(0, 10)
350sample1 = getUnifRand(0., 1., nsam1)
351sample1
352+0.224194467, +0.809150815, +0.312964559
353sample2 = getUnifRand(0., 1., nsam2)
354sample2
355+0.644271076, +0.230276108, +0.182045102E-1, +0.631263137, +0.634949207E-1, +0.187657356, +0.553981483
356call setDisKolm(disKolm, sample1, sample2)
357sample1
358+0.224194467, +0.312964559, +0.809150815
359sample2
360+0.182045102E-1, +0.634949207E-1, +0.187657356, +0.230276108, +0.553981483, +0.631263137, +0.644271076
361disKolm
362+0.428571463
363call setDisKolm(disKolm, getSorted(sample1), getSorted(sample2), ascending)
364disKolm
365+0.428571463
366
367iweight1 = getUnifRand(0, 9, nsam1)
368iweight1
369+7, +8, +5
370rweight1 = iweight1
371call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(sample2), ascending)
372disKolm
373+0.428571463
374call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2)
375disKolm
376+0.428571463
377call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2)
378disKolm
379+0.428571463
380
381iweight1 = getUnifRand(0, 9, nsam1)
382iweight1
383+0, +0, +6
384iweight2 = getUnifRand(0, 9, nsam2)
385iweight2
386+6, +2, +7, +7, +9, +7, +1
387rweight1 = iweight1; rweight2 = iweight2
388call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(getVerbose(sample2, iweight2, sum(iweight2))), ascending)
389disKolm
390+1.00000000
391call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2, iweight2, sum(iweight2))
392disKolm
393+1.00000000
394call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2, rweight2, sum(rweight2))
395disKolm
396+1.00000000
397
398nsam1 = getUnifRand(0, 10); nsam2 = getUnifRand(0, 10)
399sample1 = getUnifRand(0., 1., nsam1)
400sample1
401+0.274898529, +0.456859052, +0.158884287, +0.299056828, +0.608505368, +0.290375054, +0.666317225, +0.772555709, +0.787933826, +0.350369394
402sample2 = getUnifRand(0., 1., nsam2)
403sample2
404+0.800112009, +0.917383194, +0.771958768, +0.174848855, +0.228327572, +0.438504159
405call setDisKolm(disKolm, sample1, sample2)
406sample1
407+0.158884287, +0.274898529, +0.290375054, +0.299056828, +0.350369394, +0.456859052, +0.608505368, +0.666317225, +0.772555709, +0.787933826
408sample2
409+0.174848855, +0.228327572, +0.438504159, +0.771958768, +0.800112009, +0.917383194
410disKolm
411+0.333333313
412call setDisKolm(disKolm, getSorted(sample1), getSorted(sample2), ascending)
413disKolm
414+0.333333313
415
416iweight1 = getUnifRand(0, 9, nsam1)
417iweight1
418+9, +3, +5, +1, +9, +8, +1, +2, +7, +4
419rweight1 = iweight1
420call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(sample2), ascending)
421disKolm
422+0.333333313
423call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2)
424disKolm
425+0.333333254
426call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2)
427disKolm
428+0.333333254
429
430iweight1 = getUnifRand(0, 9, nsam1)
431iweight1
432+8, +5, +0, +0, +5, +5, +8, +1, +4, +3
433iweight2 = getUnifRand(0, 9, nsam2)
434iweight2
435+4, +2, +6, +0, +7, +3
436rweight1 = iweight1; rweight2 = iweight2
437call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(getVerbose(sample2, iweight2, sum(iweight2))), ascending)
438disKolm
439+0.454545438
440call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2, iweight2, sum(iweight2))
441disKolm
442+0.454545438
443call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2, rweight2, sum(rweight2))
444disKolm
445+0.454545438
446
447nsam1 = getUnifRand(0, 10); nsam2 = getUnifRand(0, 10)
448sample1 = getUnifRand(0., 1., nsam1)
449sample1
450+0.414434731, +0.575833321, +0.838903487, +0.245039105, +0.816662908E-1, +0.239277720, +0.797441602
451sample2 = getUnifRand(0., 1., nsam2)
452sample2
453
454call setDisKolm(disKolm, sample1, sample2)
455sample1
456+0.816662908E-1, +0.239277720, +0.245039105, +0.414434731, +0.575833321, +0.797441602, +0.838903487
457sample2
458
459disKolm
460+0.00000000
461call setDisKolm(disKolm, getSorted(sample1), getSorted(sample2), ascending)
462disKolm
463+0.00000000
464
465iweight1 = getUnifRand(0, 9, nsam1)
466iweight1
467+6, +1, +5, +6, +5, +8, +9
468rweight1 = iweight1
469call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(sample2), ascending)
470disKolm
471+0.00000000
472call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2)
473disKolm
474+0.00000000
475call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2)
476disKolm
477+0.00000000
478
479iweight1 = getUnifRand(0, 9, nsam1)
480iweight1
481+0, +1, +6, +7, +7, +8, +2
482iweight2 = getUnifRand(0, 9, nsam2)
483iweight2
484
485rweight1 = iweight1; rweight2 = iweight2
486call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(getVerbose(sample2, iweight2, sum(iweight2))), ascending)
487disKolm
488+0.00000000
489call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2, iweight2, sum(iweight2))
490disKolm
491+0.00000000
492call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2, rweight2, sum(rweight2))
493disKolm
494+0.00000000
495
496
Test:
test_pm_distanceKolm
Internal naming convention:
The following illustrates the internal naming convention used for the procedures within this generic interface.
setDisKolmSSD_WDD_D1_RK5()
||| ||| || |||
||| ||| || |||
||| ||| || |||
||| ||| || |The Kind of the output.
||| ||| The rank of the input sample(s).
||| The sample weight types: WDD => default(unweighted) / default(unweighted), WID => integer-weighted, default, WRD => real-weighted, default., WII => integer-weighted, integer-weighted, WRR => real-weighted, real-weighted.
||The order of the input samples: D => default(unordered), O => ordered.
The entities in the distance computation, S => sample, X => default(uniform) distribution, C => custom user-specified CDF.


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Amir Shahmoradi, Monday March 6, 2017, 3:22 pm, Institute for Computational Engineering and Sciences (ICES), The University of Texas at Austin.

Definition at line 2118 of file pm_distanceKolm.F90.


The documentation for this interface was generated from the following file: