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
10sample2 = getUnifRand(0., 1., nsam2)
11sample2
12+0.506276608, +0.904466510, +0.174141526E-1, +0.720825315
13call setDisKolm(disKolm, sample1, sample2)
14sample1
15
16sample2
17+0.174141526E-1, +0.506276608, +0.720825315, +0.904466510
18disKolm
19+0.00000000
20call setDisKolm(disKolm, getSorted(sample1), getSorted(sample2), ascending)
21disKolm
22+0.00000000
23
24iweight1 = getUnifRand(0, 9, nsam1)
25iweight1
26
27rweight1 = iweight1
28call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(sample2), ascending)
29disKolm
30+0.00000000
31call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2)
32disKolm
33+0.00000000
34call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2)
35disKolm
36+0.00000000
37
38iweight1 = getUnifRand(0, 9, nsam1)
39iweight1
40
41iweight2 = getUnifRand(0, 9, nsam2)
42iweight2
43+2, +3, +1, +0
44rweight1 = iweight1; rweight2 = iweight2
45call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(getVerbose(sample2, iweight2, sum(iweight2))), ascending)
46disKolm
47+0.00000000
48call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2, iweight2, sum(iweight2))
49disKolm
50+0.00000000
51call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2, rweight2, sum(rweight2))
52disKolm
53+0.00000000
54
55nsam1 = getUnifRand(0, 10); nsam2 = getUnifRand(0, 10)
56sample1 = getUnifRand(0., 1., nsam1)
57sample1
58+0.759455085, +0.317955911, +0.370210290, +0.689345777, +0.173469484
59sample2 = getUnifRand(0., 1., nsam2)
60sample2
61+0.517851770, +0.997505546, +0.466262221, +0.245645583
62call setDisKolm(disKolm, sample1, sample2)
63sample1
64+0.173469484, +0.317955911, +0.370210290, +0.689345777, +0.759455085
65sample2
66+0.245645583, +0.466262221, +0.517851770, +0.997505546
67disKolm
68+0.350000024
69call setDisKolm(disKolm, getSorted(sample1), getSorted(sample2), ascending)
70disKolm
71+0.350000024
72
73iweight1 = getUnifRand(0, 9, nsam1)
74iweight1
75+0, +9, +6, +1, +0
76rweight1 = iweight1
77call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(sample2), ascending)
78disKolm
79+0.687500000
80call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2)
81disKolm
82+0.687500000
83call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2)
84disKolm
85+0.687500000
86
87iweight1 = getUnifRand(0, 9, nsam1)
88iweight1
89+4, +7, +3, +6, +2
90iweight2 = getUnifRand(0, 9, nsam2)
91iweight2
92+8, +5, +9, +0
93rweight1 = iweight1; rweight2 = iweight2
94call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(getVerbose(sample2, iweight2, sum(iweight2))), ascending)
95disKolm
96+0.363636374
97call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2, iweight2, sum(iweight2))
98disKolm
99+0.363636374
100call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2, rweight2, sum(rweight2))
101disKolm
102+0.363636374
103
104nsam1 = getUnifRand(0, 10); nsam2 = getUnifRand(0, 10)
105sample1 = getUnifRand(0., 1., nsam1)
106sample1
107+0.284973323, +0.895584226E-1, +0.237379432, +0.663371086, +0.519163132, +0.361023962, +0.163232625, +0.777269602, +0.414930463, +0.693484604
108sample2 = getUnifRand(0., 1., nsam2)
109sample2
110+0.904472232, +0.346213281, +0.738006115, +0.565335035, +0.802344322, +0.296145499, +0.122817755
111call setDisKolm(disKolm, sample1, sample2)
112sample1
113+0.895584226E-1, +0.163232625, +0.237379432, +0.284973323, +0.361023962, +0.414930463, +0.519163132, +0.663371086, +0.693484604, +0.777269602
114sample2
115+0.122817755, +0.296145499, +0.346213281, +0.565335035, +0.738006115, +0.802344322, +0.904472232
116disKolm
117+0.328571439
118call setDisKolm(disKolm, getSorted(sample1), getSorted(sample2), ascending)
119disKolm
120+0.328571439
121
122iweight1 = getUnifRand(0, 9, nsam1)
123iweight1
124+3, +9, +1, +5, +0, +1, +8, +4, +5, +8
125rweight1 = iweight1
126call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(sample2), ascending)
127disKolm
128+0.285714269
129call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2)
130disKolm
131+0.285714269
132call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2)
133disKolm
134+0.285714269
135
136iweight1 = getUnifRand(0, 9, nsam1)
137iweight1
138+3, +4, +9, +8, +7, +6, +4, +1, +4, +0
139iweight2 = getUnifRand(0, 9, nsam2)
140iweight2
141+2, +4, +5, +5, +8, +7, +0
142rweight1 = iweight1; rweight2 = iweight2
143call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(getVerbose(sample2, iweight2, sum(iweight2))), ascending)
144disKolm
145+0.536465645
146call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2, iweight2, sum(iweight2))
147disKolm
148+0.536465645
149call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2, rweight2, sum(rweight2))
150disKolm
151+0.536465645
152
153nsam1 = getUnifRand(0, 10); nsam2 = getUnifRand(0, 10)
154sample1 = getUnifRand(0., 1., nsam1)
155sample1
156+0.206715286
157sample2 = getUnifRand(0., 1., nsam2)
158sample2
159+0.784408450E-1, +0.573151112E-1, +0.195407748, +0.769647658, +0.152818203
160call setDisKolm(disKolm, sample1, sample2)
161sample1
162+0.206715286
163sample2
164+0.573151112E-1, +0.784408450E-1, +0.152818203, +0.195407748, +0.769647658
165disKolm
166+0.800000012
167call setDisKolm(disKolm, getSorted(sample1), getSorted(sample2), ascending)
168disKolm
169+0.800000012
170
171iweight1 = getUnifRand(0, 9, nsam1)
172iweight1
173+5
174rweight1 = iweight1
175call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(sample2), ascending)
176disKolm
177+0.800000012
178call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2)
179disKolm
180+0.800000012
181call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2)
182disKolm
183+0.800000012
184
185iweight1 = getUnifRand(0, 9, nsam1)
186iweight1
187+6
188iweight2 = getUnifRand(0, 9, nsam2)
189iweight2
190+4, +6, +0, +1, +2
191rweight1 = iweight1; rweight2 = iweight2
192call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(getVerbose(sample2, iweight2, sum(iweight2))), ascending)
193disKolm
194+0.846153855
195call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2, iweight2, sum(iweight2))
196disKolm
197+0.846153915
198call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2, rweight2, sum(rweight2))
199disKolm
200+0.846153915
201
202nsam1 = getUnifRand(0, 10); nsam2 = getUnifRand(0, 10)
203sample1 = getUnifRand(0., 1., nsam1)
204sample1
205+0.590680003, +0.569251001, +0.328027010, +0.560507178, +0.672720075E-1, +0.539453268, +0.946638227, +0.796156108
206sample2 = getUnifRand(0., 1., nsam2)
207sample2
208+0.721222103
209call setDisKolm(disKolm, sample1, sample2)
210sample1
211+0.672720075E-1, +0.328027010, +0.539453268, +0.560507178, +0.569251001, +0.590680003, +0.796156108, +0.946638227
212sample2
213+0.721222103
214disKolm
215+0.750000000
216call setDisKolm(disKolm, getSorted(sample1), getSorted(sample2), ascending)
217disKolm
218+0.750000000
219
220iweight1 = getUnifRand(0, 9, nsam1)
221iweight1
222+9, +6, +6, +7, +1, +8, +8, +2
223rweight1 = iweight1
224call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(sample2), ascending)
225disKolm
226+0.787234008
227call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2)
228disKolm
229+0.787234008
230call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2)
231disKolm
232+0.787234008
233
234iweight1 = getUnifRand(0, 9, nsam1)
235iweight1
236+7, +3, +5, +0, +2, +6, +0, +5
237iweight2 = getUnifRand(0, 9, nsam2)
238iweight2
239+7
240rweight1 = iweight1; rweight2 = iweight2
241call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(getVerbose(sample2, iweight2, sum(iweight2))), ascending)
242disKolm
243+0.821428597
244call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2, iweight2, sum(iweight2))
245disKolm
246+0.821428597
247call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2, rweight2, sum(rweight2))
248disKolm
249+0.821428597
250
251nsam1 = getUnifRand(0, 10); nsam2 = getUnifRand(0, 10)
252sample1 = getUnifRand(0., 1., nsam1)
253sample1
254+0.342114866, +0.139738441, +0.437746048, +0.802290678
255sample2 = getUnifRand(0., 1., nsam2)
256sample2
257+0.275553524, +0.450110435, +0.603605568, +0.689404547, +0.336297929
258call setDisKolm(disKolm, sample1, sample2)
259sample1
260+0.139738441, +0.342114866, +0.437746048, +0.802290678
261sample2
262+0.275553524, +0.336297929, +0.450110435, +0.603605568, +0.689404547
263disKolm
264+0.349999994
265call setDisKolm(disKolm, getSorted(sample1), getSorted(sample2), ascending)
266disKolm
267+0.349999994
268
269iweight1 = getUnifRand(0, 9, nsam1)
270iweight1
271+2, +6, +8, +5
272rweight1 = iweight1
273call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(sample2), ascending)
274disKolm
275+0.361904770
276call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2)
277disKolm
278+0.361904770
279call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2)
280disKolm
281+0.361904770
282
283iweight1 = getUnifRand(0, 9, nsam1)
284iweight1
285+2, +7, +3, +0
286iweight2 = getUnifRand(0, 9, nsam2)
287iweight2
288+8, +7, +5, +4, +7
289rweight1 = iweight1; rweight2 = iweight2
290call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(getVerbose(sample2, iweight2, sum(iweight2))), ascending)
291disKolm
292+0.516129017
293call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2, iweight2, sum(iweight2))
294disKolm
295+0.516129017
296call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2, rweight2, sum(rweight2))
297disKolm
298+0.516129017
299
300nsam1 = getUnifRand(0, 10); nsam2 = getUnifRand(0, 10)
301sample1 = getUnifRand(0., 1., nsam1)
302sample1
303
304sample2 = getUnifRand(0., 1., nsam2)
305sample2
306+0.733051360, +0.146679282, +0.839495301
307call setDisKolm(disKolm, sample1, sample2)
308sample1
309
310sample2
311+0.146679282, +0.733051360, +0.839495301
312disKolm
313+0.00000000
314call setDisKolm(disKolm, getSorted(sample1), getSorted(sample2), ascending)
315disKolm
316+0.00000000
317
318iweight1 = getUnifRand(0, 9, nsam1)
319iweight1
320
321rweight1 = iweight1
322call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(sample2), ascending)
323disKolm
324+0.00000000
325call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2)
326disKolm
327+0.00000000
328call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2)
329disKolm
330+0.00000000
331
332iweight1 = getUnifRand(0, 9, nsam1)
333iweight1
334
335iweight2 = getUnifRand(0, 9, nsam2)
336iweight2
337+2, +5, +7
338rweight1 = iweight1; rweight2 = iweight2
339call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(getVerbose(sample2, iweight2, sum(iweight2))), ascending)
340disKolm
341+0.00000000
342call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2, iweight2, sum(iweight2))
343disKolm
344+0.00000000
345call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2, rweight2, sum(rweight2))
346disKolm
347+0.00000000
348
349nsam1 = getUnifRand(0, 10); nsam2 = getUnifRand(0, 10)
350sample1 = getUnifRand(0., 1., nsam1)
351sample1
352+0.604888439
353sample2 = getUnifRand(0., 1., nsam2)
354sample2
355+0.728859782, +0.899196267E-1, +0.719026923, +0.126819372, +0.994304597
356call setDisKolm(disKolm, sample1, sample2)
357sample1
358+0.604888439
359sample2
360+0.899196267E-1, +0.126819372, +0.719026923, +0.728859782, +0.994304597
361disKolm
362+0.600000024
363call setDisKolm(disKolm, getSorted(sample1), getSorted(sample2), ascending)
364disKolm
365+0.600000024
366
367iweight1 = getUnifRand(0, 9, nsam1)
368iweight1
369+8
370rweight1 = iweight1
371call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(sample2), ascending)
372disKolm
373+0.600000024
374call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2)
375disKolm
376+0.600000024
377call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2)
378disKolm
379+0.600000024
380
381iweight1 = getUnifRand(0, 9, nsam1)
382iweight1
383+0
384iweight2 = getUnifRand(0, 9, nsam2)
385iweight2
386+4, +6, +6, +2, +0
387rweight1 = iweight1; rweight2 = iweight2
388call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(getVerbose(sample2, iweight2, sum(iweight2))), ascending)
389disKolm
390+0.00000000
391call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2, iweight2, sum(iweight2))
392disKolm
393+0.555555582
394call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2, rweight2, sum(rweight2))
395disKolm
396+0.555555582
397
398nsam1 = getUnifRand(0, 10); nsam2 = getUnifRand(0, 10)
399sample1 = getUnifRand(0., 1., nsam1)
400sample1
401+0.490652442, +0.209086478, +0.679594815, +0.126007199
402sample2 = getUnifRand(0., 1., nsam2)
403sample2
404+0.122089922, +0.512970805, +0.785736203, +0.853662074, +0.410287201
405call setDisKolm(disKolm, sample1, sample2)
406sample1
407+0.126007199, +0.209086478, +0.490652442, +0.679594815
408sample2
409+0.122089922, +0.410287201, +0.512970805, +0.785736203, +0.853662074
410disKolm
411+0.399999976
412call setDisKolm(disKolm, getSorted(sample1), getSorted(sample2), ascending)
413disKolm
414+0.399999976
415
416iweight1 = getUnifRand(0, 9, nsam1)
417iweight1
418+0, +6, +7, +8
419rweight1 = iweight1
420call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(sample2), ascending)
421disKolm
422+0.399999976
423call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2)
424disKolm
425+0.399999976
426call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2)
427disKolm
428+0.399999976
429
430iweight1 = getUnifRand(0, 9, nsam1)
431iweight1
432+1, +2, +3, +7
433iweight2 = getUnifRand(0, 9, nsam2)
434iweight2
435+7, +2, +9, +5, +8
436rweight1 = iweight1; rweight2 = iweight2
437call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(getVerbose(sample2, iweight2, sum(iweight2))), ascending)
438disKolm
439+0.419354856
440call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2, iweight2, sum(iweight2))
441disKolm
442+0.419354856
443call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2, rweight2, sum(rweight2))
444disKolm
445+0.419354856
446
447nsam1 = getUnifRand(0, 10); nsam2 = getUnifRand(0, 10)
448sample1 = getUnifRand(0., 1., nsam1)
449sample1
450+0.436012328, +0.116264999, +0.772891581, +0.186793625, +0.477569342, +0.398063481, +0.894284844E-1, +0.311541080
451sample2 = getUnifRand(0., 1., nsam2)
452sample2
453+0.931537390, +0.843002856, +0.775899172, +0.761004686, +0.450457811, +0.948933661, +0.588690817, +0.222899318, +0.618991613, +0.609270036
454call setDisKolm(disKolm, sample1, sample2)
455sample1
456+0.894284844E-1, +0.116264999, +0.186793625, +0.311541080, +0.398063481, +0.436012328, +0.477569342, +0.772891581
457sample2
458+0.222899318, +0.450457811, +0.588690817, +0.609270036, +0.618991613, +0.761004686, +0.775899172, +0.843002856, +0.931537390, +0.948933661
459disKolm
460+0.675000012
461call setDisKolm(disKolm, getSorted(sample1), getSorted(sample2), ascending)
462disKolm
463+0.675000012
464
465iweight1 = getUnifRand(0, 9, nsam1)
466iweight1
467+7, +2, +3, +1, +9, +9, +3, +5
468rweight1 = iweight1
469call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(sample2), ascending)
470disKolm
471+0.694871783
472call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2)
473disKolm
474+0.694871783
475call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2)
476disKolm
477+0.694871783
478
479iweight1 = getUnifRand(0, 9, nsam1)
480iweight1
481+4, +0, +9, +6, +2, +3, +3, +4
482iweight2 = getUnifRand(0, 9, nsam2)
483iweight2
484+4, +6, +8, +9, +3, +0, +7, +1, +8, +7
485rweight1 = iweight1; rweight2 = iweight2
486call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(getVerbose(sample2, iweight2, sum(iweight2))), ascending)
487disKolm
488+0.698721826
489call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2, iweight2, sum(iweight2))
490disKolm
491+0.698721826
492call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2, rweight2, sum(rweight2))
493disKolm
494+0.698721826
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: