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.646962404, +0.532547116, +0.166158497, +0.287272453, +0.133619487, +0.604416907
10sample2 = getUnifRand(0., 1., nsam2)
11sample2
12+0.662925482, +0.842895091
13call setDisKolm(disKolm, sample1, sample2)
14sample1
15+0.133619487, +0.166158497, +0.287272453, +0.532547116, +0.604416907, +0.646962404
16sample2
17+0.662925482, +0.842895091
18disKolm
19+1.00000000
20call setDisKolm(disKolm, getSorted(sample1), getSorted(sample2), ascending)
21disKolm
22+1.00000000
23
24iweight1 = getUnifRand(0, 9, nsam1)
25iweight1
26+9, +9, +7, +2, +5, +8
27rweight1 = iweight1
28call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(sample2), ascending)
29disKolm
30+1.00000000
31call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2)
32disKolm
33+1.00000000
34call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2)
35disKolm
36+1.00000000
37
38iweight1 = getUnifRand(0, 9, nsam1)
39iweight1
40+9, +0, +0, +5, +3, +5
41iweight2 = getUnifRand(0, 9, nsam2)
42iweight2
43+0, +2
44rweight1 = iweight1; rweight2 = iweight2
45call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(getVerbose(sample2, iweight2, sum(iweight2))), ascending)
46disKolm
47+1.00000000
48call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2, iweight2, sum(iweight2))
49disKolm
50+1.00000000
51call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2, rweight2, sum(rweight2))
52disKolm
53+1.00000000
54
55nsam1 = getUnifRand(0, 10); nsam2 = getUnifRand(0, 10)
56sample1 = getUnifRand(0., 1., nsam1)
57sample1
58+0.889413357E-1, +0.557361722, +0.170154750, +0.456446409, +0.766615629
59sample2 = getUnifRand(0., 1., nsam2)
60sample2
61+0.196615338, +0.194720805, +0.137082815, +0.687444568, +0.765978515, +0.195795655, +0.847779691, +0.808939517, +0.166318715, +0.939104915
62call setDisKolm(disKolm, sample1, sample2)
63sample1
64+0.889413357E-1, +0.170154750, +0.456446409, +0.557361722, +0.766615629
65sample2
66+0.137082815, +0.166318715, +0.194720805, +0.195795655, +0.196615338, +0.687444568, +0.765978515, +0.808939517, +0.847779691, +0.939104915
67disKolm
68+0.300000012
69call setDisKolm(disKolm, getSorted(sample1), getSorted(sample2), ascending)
70disKolm
71+0.300000012
72
73iweight1 = getUnifRand(0, 9, nsam1)
74iweight1
75+1, +1, +9, +2, +5
76rweight1 = iweight1
77call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(sample2), ascending)
78disKolm
79+0.388888896
80call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2)
81disKolm
82+0.388888896
83call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2)
84disKolm
85+0.388888896
86
87iweight1 = getUnifRand(0, 9, nsam1)
88iweight1
89+1, +7, +4, +1, +0
90iweight2 = getUnifRand(0, 9, nsam2)
91iweight2
92+1, +2, +6, +7, +2, +4, +8, +0, +0, +4
93rweight1 = iweight1; rweight2 = iweight2
94call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(getVerbose(sample2, iweight2, sum(iweight2))), ascending)
95disKolm
96+0.527149320
97call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2, iweight2, sum(iweight2))
98disKolm
99+0.527149320
100call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2, rweight2, sum(rweight2))
101disKolm
102+0.527149320
103
104nsam1 = getUnifRand(0, 10); nsam2 = getUnifRand(0, 10)
105sample1 = getUnifRand(0., 1., nsam1)
106sample1
107+0.611419976, +0.366717160, +0.767365992, +0.637306511
108sample2 = getUnifRand(0., 1., nsam2)
109sample2
110+0.938903689E-1, +0.706426084
111call setDisKolm(disKolm, sample1, sample2)
112sample1
113+0.366717160, +0.611419976, +0.637306511, +0.767365992
114sample2
115+0.938903689E-1, +0.706426084
116disKolm
117+0.500000000
118call setDisKolm(disKolm, getSorted(sample1), getSorted(sample2), ascending)
119disKolm
120+0.500000000
121
122iweight1 = getUnifRand(0, 9, nsam1)
123iweight1
124+5, +4, +3, +6
125rweight1 = iweight1
126call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(sample2), ascending)
127disKolm
128+0.500000000
129call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2)
130disKolm
131+0.500000000
132call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2)
133disKolm
134+0.500000000
135
136iweight1 = getUnifRand(0, 9, nsam1)
137iweight1
138+1, +8, +5, +7
139iweight2 = getUnifRand(0, 9, nsam2)
140iweight2
141+1, +3
142rweight1 = iweight1; rweight2 = iweight2
143call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(getVerbose(sample2, iweight2, sum(iweight2))), ascending)
144disKolm
145+0.416666687
146call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2, iweight2, sum(iweight2))
147disKolm
148+0.416666687
149call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2, rweight2, sum(rweight2))
150disKolm
151+0.416666687
152
153nsam1 = getUnifRand(0, 10); nsam2 = getUnifRand(0, 10)
154sample1 = getUnifRand(0., 1., nsam1)
155sample1
156+0.876878500E-1, +0.774091482E-2, +0.968798816
157sample2 = getUnifRand(0., 1., nsam2)
158sample2
159+0.656497419, +0.475148141, +0.118892074, +0.580197513, +0.508554995, +0.828858197, +0.708992600
160call setDisKolm(disKolm, sample1, sample2)
161sample1
162+0.774091482E-2, +0.876878500E-1, +0.968798816
163sample2
164+0.118892074, +0.475148141, +0.508554995, +0.580197513, +0.656497419, +0.708992600, +0.828858197
165disKolm
166+0.666666687
167call setDisKolm(disKolm, getSorted(sample1), getSorted(sample2), ascending)
168disKolm
169+0.666666687
170
171iweight1 = getUnifRand(0, 9, nsam1)
172iweight1
173+9, +5, +3
174rweight1 = iweight1
175call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(sample2), ascending)
176disKolm
177+0.823529422
178call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2)
179disKolm
180+0.823529482
181call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2)
182disKolm
183+0.823529482
184
185iweight1 = getUnifRand(0, 9, nsam1)
186iweight1
187+0, +7, +9
188iweight2 = getUnifRand(0, 9, nsam2)
189iweight2
190+3, +5, +6, +8, +9, +4, +7
191rweight1 = iweight1; rweight2 = iweight2
192call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(getVerbose(sample2, iweight2, sum(iweight2))), ascending)
193disKolm
194+0.562500000
195call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2, iweight2, sum(iweight2))
196disKolm
197+0.562500000
198call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2, rweight2, sum(rweight2))
199disKolm
200+0.562500000
201
202nsam1 = getUnifRand(0, 10); nsam2 = getUnifRand(0, 10)
203sample1 = getUnifRand(0., 1., nsam1)
204sample1
205+0.792912126, +0.323796153, +0.297530890E-1, +0.611464322, +0.435986161, +0.753435194, +0.993133664
206sample2 = getUnifRand(0., 1., nsam2)
207sample2
208+0.868039131E-1, +0.197582841E-1, +0.833022475, +0.226267338, +0.665632844
209call setDisKolm(disKolm, sample1, sample2)
210sample1
211+0.297530890E-1, +0.323796153, +0.435986161, +0.611464322, +0.753435194, +0.792912126, +0.993133664
212sample2
213+0.197582841E-1, +0.868039131E-1, +0.226267338, +0.665632844, +0.833022475
214disKolm
215+0.457142889
216call setDisKolm(disKolm, getSorted(sample1), getSorted(sample2), ascending)
217disKolm
218+0.457142889
219
220iweight1 = getUnifRand(0, 9, nsam1)
221iweight1
222+6, +0, +9, +5, +7, +1, +8
223rweight1 = iweight1
224call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(sample2), ascending)
225disKolm
226+0.433333337
227call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2)
228disKolm
229+0.433333337
230call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2)
231disKolm
232+0.433333337
233
234iweight1 = getUnifRand(0, 9, nsam1)
235iweight1
236+5, +9, +1, +9, +8, +1, +8
237iweight2 = getUnifRand(0, 9, nsam2)
238iweight2
239+6, +9, +5, +5, +6
240rweight1 = iweight1; rweight2 = iweight2
241call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(getVerbose(sample2, iweight2, sum(iweight2))), ascending)
242disKolm
243+0.523210049
244call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2, iweight2, sum(iweight2))
245disKolm
246+0.523210049
247call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2, rweight2, sum(rweight2))
248disKolm
249+0.523210049
250
251nsam1 = getUnifRand(0, 10); nsam2 = getUnifRand(0, 10)
252sample1 = getUnifRand(0., 1., nsam1)
253sample1
254+0.132691383, +0.993322790, +0.587872028, +0.129377723, +0.384717226, +0.670644283
255sample2 = getUnifRand(0., 1., nsam2)
256sample2
257
258call setDisKolm(disKolm, sample1, sample2)
259sample1
260+0.129377723, +0.132691383, +0.384717226, +0.587872028, +0.670644283, +0.993322790
261sample2
262
263disKolm
264+0.00000000
265call setDisKolm(disKolm, getSorted(sample1), getSorted(sample2), ascending)
266disKolm
267+0.00000000
268
269iweight1 = getUnifRand(0, 9, nsam1)
270iweight1
271+8, +1, +5, +5, +1, +7
272rweight1 = iweight1
273call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(sample2), ascending)
274disKolm
275+0.00000000
276call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2)
277disKolm
278+0.00000000
279call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2)
280disKolm
281+0.00000000
282
283iweight1 = getUnifRand(0, 9, nsam1)
284iweight1
285+0, +8, +6, +0, +5, +0
286iweight2 = getUnifRand(0, 9, nsam2)
287iweight2
288
289rweight1 = iweight1; rweight2 = iweight2
290call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(getVerbose(sample2, iweight2, sum(iweight2))), ascending)
291disKolm
292+0.00000000
293call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2, iweight2, sum(iweight2))
294disKolm
295+0.00000000
296call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2, rweight2, sum(rweight2))
297disKolm
298+0.00000000
299
300nsam1 = getUnifRand(0, 10); nsam2 = getUnifRand(0, 10)
301sample1 = getUnifRand(0., 1., nsam1)
302sample1
303+0.859667063
304sample2 = getUnifRand(0., 1., nsam2)
305sample2
306+0.682873011
307call setDisKolm(disKolm, sample1, sample2)
308sample1
309+0.859667063
310sample2
311+0.682873011
312disKolm
313+1.00000000
314call setDisKolm(disKolm, getSorted(sample1), getSorted(sample2), ascending)
315disKolm
316+1.00000000
317
318iweight1 = getUnifRand(0, 9, nsam1)
319iweight1
320+7
321rweight1 = iweight1
322call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(sample2), ascending)
323disKolm
324+1.00000000
325call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2)
326disKolm
327+1.00000000
328call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2)
329disKolm
330+1.00000000
331
332iweight1 = getUnifRand(0, 9, nsam1)
333iweight1
334+0
335iweight2 = getUnifRand(0, 9, nsam2)
336iweight2
337+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+1.00000000
345call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2, rweight2, sum(rweight2))
346disKolm
347+1.00000000
348
349nsam1 = getUnifRand(0, 10); nsam2 = getUnifRand(0, 10)
350sample1 = getUnifRand(0., 1., nsam1)
351sample1
352
353sample2 = getUnifRand(0., 1., nsam2)
354sample2
355+0.791043103, +0.510438442, +0.307160199, +0.465624332, +0.539878309, +0.253050029, +0.887461066, +0.637003183, +0.651825666E-1, +0.375136077
356call setDisKolm(disKolm, sample1, sample2)
357sample1
358
359sample2
360+0.651825666E-1, +0.253050029, +0.307160199, +0.375136077, +0.465624332, +0.510438442, +0.539878309, +0.637003183, +0.791043103, +0.887461066
361disKolm
362+0.00000000
363call setDisKolm(disKolm, getSorted(sample1), getSorted(sample2), ascending)
364disKolm
365+0.00000000
366
367iweight1 = getUnifRand(0, 9, nsam1)
368iweight1
369
370rweight1 = iweight1
371call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(sample2), ascending)
372disKolm
373+0.00000000
374call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2)
375disKolm
376+0.00000000
377call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2)
378disKolm
379+0.00000000
380
381iweight1 = getUnifRand(0, 9, nsam1)
382iweight1
383
384iweight2 = getUnifRand(0, 9, nsam2)
385iweight2
386+3, +9, +2, +6, +7, +5, +9, +2, +8, +9
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.00000000
394call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2, rweight2, sum(rweight2))
395disKolm
396+0.00000000
397
398nsam1 = getUnifRand(0, 10); nsam2 = getUnifRand(0, 10)
399sample1 = getUnifRand(0., 1., nsam1)
400sample1
401+0.234306574, +0.680121958, +0.288484275, +0.794596732, +0.448454440
402sample2 = getUnifRand(0., 1., nsam2)
403sample2
404
405call setDisKolm(disKolm, sample1, sample2)
406sample1
407+0.234306574, +0.288484275, +0.448454440, +0.680121958, +0.794596732
408sample2
409
410disKolm
411+0.00000000
412call setDisKolm(disKolm, getSorted(sample1), getSorted(sample2), ascending)
413disKolm
414+0.00000000
415
416iweight1 = getUnifRand(0, 9, nsam1)
417iweight1
418+5, +0, +4, +4, +1
419rweight1 = iweight1
420call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(sample2), ascending)
421disKolm
422+0.00000000
423call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2)
424disKolm
425+0.00000000
426call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2)
427disKolm
428+0.00000000
429
430iweight1 = getUnifRand(0, 9, nsam1)
431iweight1
432+9, +6, +9, +7, +9
433iweight2 = getUnifRand(0, 9, nsam2)
434iweight2
435
436rweight1 = iweight1; rweight2 = iweight2
437call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(getVerbose(sample2, iweight2, sum(iweight2))), ascending)
438disKolm
439+0.00000000
440call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2, iweight2, sum(iweight2))
441disKolm
442+0.00000000
443call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2, rweight2, sum(rweight2))
444disKolm
445+0.00000000
446
447nsam1 = getUnifRand(0, 10); nsam2 = getUnifRand(0, 10)
448sample1 = getUnifRand(0., 1., nsam1)
449sample1
450+0.918694615, +0.990277946, +0.941745400, +0.414191008
451sample2 = getUnifRand(0., 1., nsam2)
452sample2
453+0.667069733, +0.278551996, +0.950680375E-1, +0.639434516, +0.828531444, +0.779883265E-1, +0.314169228
454call setDisKolm(disKolm, sample1, sample2)
455sample1
456+0.414191008, +0.918694615, +0.941745400, +0.990277946
457sample2
458+0.779883265E-1, +0.950680375E-1, +0.278551996, +0.314169228, +0.639434516, +0.667069733, +0.828531444
459disKolm
460+0.750000000
461call setDisKolm(disKolm, getSorted(sample1), getSorted(sample2), ascending)
462disKolm
463+0.750000000
464
465iweight1 = getUnifRand(0, 9, nsam1)
466iweight1
467+6, +7, +4, +2
468rweight1 = iweight1
469call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(sample2), ascending)
470disKolm
471+0.684210539
472call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2)
473disKolm
474+0.684210539
475call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2)
476disKolm
477+0.684210539
478
479iweight1 = getUnifRand(0, 9, nsam1)
480iweight1
481+6, +8, +2, +1
482iweight2 = getUnifRand(0, 9, nsam2)
483iweight2
484+0, +8, +3, +7, +0, +7, +5
485rweight1 = iweight1; rweight2 = iweight2
486call setDisKolm(disKolm, getSorted(getVerbose(sample1, iweight1, sum(iweight1))), getSorted(getVerbose(sample2, iweight2, sum(iweight2))), ascending)
487disKolm
488+0.647058845
489call setDisKolm(disKolm, sample1, iweight1, sum(iweight1), sample2, iweight2, sum(iweight2))
490disKolm
491+0.647058845
492call setDisKolm(disKolm, sample1, rweight1, sum(rweight1), sample2, rweight2, sum(rweight2))
493disKolm
494+0.647058845
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: