16 integer(IK) :: ndim, npnt, nsam, isam
18 type(display_type) :: disp
22 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
23 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
24 call disp%show(
"! Compute the Mahalanobis distance squared for real-valued arguments.")
25 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
26 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
32 real(RKG),
allocatable :: point(:,:), mahalSq(:,:), mean(:,:), invCov(:,:,:)
34 call disp%show(
"ndim = 3; npnt = 5; nsam = 2")
35 ndim
= 3; npnt
= 5; nsam
= 2
36 call disp%show(
"point = getUnifRand(0., 1., ndim, npnt)")
40 call disp%show(
"call setResized(mean, [ndim, nsam])")
42 call disp%show(
"call setResized(invCov, [ndim, ndim, nsam])")
46 call disp%show(
"invCov(:,:,isam) = getCovRand(mold = 1., ndim = ndim)")
47 invCov(:,:,isam)
= getCovRand(
mold = 1., ndim
= ndim)
48 call disp%show(
"mean(:,isam) = getFilled(isam - 1, ndim)")
56 call disp%show(
"call setResized(mahalSq, [nsam, npnt])")
60 call disp%show(
"call setDisMahalSq(mahalSq, point, invCov) ! for a set of ndim-dimensional points against nsam independent samples centered at origin.")
64 call disp%show(
"call setDisMahalSq(mahalSq, point, invCov, mean) ! for a set of ndim-dimensional points against nsam independent samples centered at mean.")
69 call disp%show(
"call setDisMahalSq(mahalSq(1:nsam, 1), point(1:ndim, 1), invCov) ! for a single ndim-dimensional point against nsam independent samples centered at origin.")
70 call setDisMahalSq(mahalSq(
1:nsam,
1), point(
1:ndim,
1), invCov)
73 call disp%show(
"call setDisMahalSq(mahalSq(1:nsam, 1), point(1:ndim, 1), invCov, mean) ! for a single ndim-dimensional point against nsam independent samples centered at mean.")
74 call setDisMahalSq(mahalSq(
1:nsam,
1), point(
1:ndim,
1), invCov, mean)
79 call disp%show(
"call setDisMahalSq(mahalSq(1, 1:npnt), point, invCov(:,:,1)) ! for a set of ndim-dimensional points against one sample centered at origin.")
83 call disp%show(
"call setDisMahalSq(mahalSq(1, 1:npnt), point, invCov(:,:,1), mean(:,1)) ! for a set of ndim-dimensional points against one sample centered at mean.")
84 call setDisMahalSq(mahalSq(
1,
1:npnt), point, invCov(:,:,
1), mean(:,
1))
88 call disp%show(
"call setDisMahalSq(mahalSq(1, 1), point(1:ndim, 1), invCov(:,:,1)) ! for a single ndim-dimensional point one sample centered at origin.")
89 call setDisMahalSq(mahalSq(
1,
1), point(
1:ndim,
1), invCov(:,:,
1))
92 call disp%show(
"call setDisMahalSq(mahalSq(1, 1), point(1:ndim, 1), invCov(:,:,1), mean(:,1)) ! for a single ndim-dimensional point one sample centered at mean.")
93 call setDisMahalSq(mahalSq(
1,
1), point(
1:ndim,
1), invCov(:,:,
1), mean(:,
1))
98 call disp%show(
"call setDisMahalSq(mahalSq(1, 1:npnt), point(1, 1:npnt), invCov(1,1,1)) ! for a set of single-dimensional points against one sample centered at origin.")
99 call setDisMahalSq(mahalSq(
1,
1:npnt), point(
1,
1:npnt), invCov(
1,
1,
1))
100 call disp%show(
"mahalSq(1, 1:npnt)")
101 call disp%show( mahalSq(
1,
1:npnt) )
102 call disp%show(
"call setDisMahalSq(mahalSq(1, 1:npnt), point(1, 1:npnt), invCov(1,1,1), mean(1,1)) ! for a set of single-dimensional points against one sample centered at mean.")
103 call setDisMahalSq(mahalSq(
1,
1:npnt), point(
1,
1:npnt), invCov(
1,
1,
1), mean(
1,
1))
104 call disp%show(
"mahalSq(1, 1:npnt)")
105 call disp%show( mahalSq(
1,
1:npnt) )
107 call disp%show(
"call setDisMahalSq(mahalSq(1, 1), point(1, 1), invCov(1,1,1)) ! for a single single-dimensional point one sample centered at origin.")
108 call setDisMahalSq(mahalSq(
1,
1), point(
1,
1), invCov(
1,
1,
1))
111 call disp%show(
"call setDisMahalSq(mahalSq(1, 1), point(1, 1), invCov(1,1,1), mean(1,1)) ! for a single single-dimensional point one sample centered at mean.")
112 call setDisMahalSq(mahalSq(
1,
1), point(
1,
1), invCov(
1,
1,
1), mean(
1,
1))
119 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
120 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
121 call disp%show(
"! Compute the Mahalanobis distance squared for complex-valued arguments.")
122 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
123 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
129 complex(CKG),
allocatable :: point(:,:), mahalSq(:,:), mean(:,:), invCov(:,:,:)
131 call disp%show(
"ndim = 3; npnt = 5; nsam = 2")
132 ndim
= 3; npnt
= 5; nsam
= 2
133 call disp%show(
"point = getUnifRand(0., 1., ndim, npnt)")
137 call disp%show(
"call setResized(mean, [ndim, nsam])")
139 call disp%show(
"call setResized(invCov, [ndim, ndim, nsam])")
143 call disp%show(
"invCov(:,:,isam) = getCovRand(mold = (1., 1.), ndim = ndim)")
144 invCov(:,:,isam)
= getCovRand(
mold = (
1.,
1.), ndim
= ndim)
145 call disp%show(
"mean(:,isam) = getFilled(isam - 1, ndim)")
153 call disp%show(
"call setResized(mahalSq, [nsam, npnt])")
157 call disp%show(
"call setDisMahalSq(mahalSq, point, invCov) ! for a set of ndim-dimensional points against nsam independent samples centered at origin.")
161 call disp%show(
"call setDisMahalSq(mahalSq, point, invCov, mean) ! for a set of ndim-dimensional points against nsam independent samples centered at mean.")
166 call disp%show(
"call setDisMahalSq(mahalSq(1:nsam, 1), point(1:ndim, 1), invCov) ! for a single ndim-dimensional point against nsam independent samples centered at origin.")
167 call setDisMahalSq(mahalSq(
1:nsam,
1), point(
1:ndim,
1), invCov)
168 call disp%show(
"mahalSq(1:nsam, 1)")
169 call disp%show( mahalSq(
1:nsam,
1) )
170 call disp%show(
"call setDisMahalSq(mahalSq(1:nsam, 1), point(1:ndim, 1), invCov, mean) ! for a single ndim-dimensional point against nsam independent samples centered at mean.")
171 call setDisMahalSq(mahalSq(
1:nsam,
1), point(
1:ndim,
1), invCov, mean)
172 call disp%show(
"mahalSq(1:nsam, 1)")
173 call disp%show( mahalSq(
1:nsam,
1) )
176 call disp%show(
"call setDisMahalSq(mahalSq(1, 1:npnt), point, invCov(:,:,1)) ! for a set of ndim-dimensional points against one sample centered at origin.")
178 call disp%show(
"mahalSq(1, 1:npnt)")
179 call disp%show( mahalSq(
1,
1:npnt) )
180 call disp%show(
"call setDisMahalSq(mahalSq(1, 1:npnt), point, invCov(:,:,1), mean(:,1)) ! for a set of ndim-dimensional points against one sample centered at mean.")
181 call setDisMahalSq(mahalSq(
1,
1:npnt), point, invCov(:,:,
1), mean(:,
1))
182 call disp%show(
"mahalSq(1, 1:npnt)")
183 call disp%show( mahalSq(
1,
1:npnt) )
185 call disp%show(
"call setDisMahalSq(mahalSq(1, 1), point(1:ndim, 1), invCov(:,:,1)) ! for a single ndim-dimensional point one sample centered at origin.")
186 call setDisMahalSq(mahalSq(
1,
1), point(
1:ndim,
1), invCov(:,:,
1))
189 call disp%show(
"call setDisMahalSq(mahalSq(1, 1), point(1:ndim, 1), invCov(:,:,1), mean(:,1)) ! for a single ndim-dimensional point one sample centered at mean.")
190 call setDisMahalSq(mahalSq(
1,
1), point(
1:ndim,
1), invCov(:,:,
1), mean(:,
1))
195 call disp%show(
"call setDisMahalSq(mahalSq(1, 1:npnt), point(1, 1:npnt), invCov(1,1,1)) ! for a set of single-dimensional points against one sample centered at origin.")
196 call setDisMahalSq(mahalSq(
1,
1:npnt), point(
1,
1:npnt), invCov(
1,
1,
1))
197 call disp%show(
"mahalSq(1, 1:npnt)")
198 call disp%show( mahalSq(
1,
1:npnt) )
199 call disp%show(
"call setDisMahalSq(mahalSq(1, 1:npnt), point(1, 1:npnt), invCov(1,1,1), mean(1,1)) ! for a set of single-dimensional points against one sample centered at mean.")
200 call setDisMahalSq(mahalSq(
1,
1:npnt), point(
1,
1:npnt), invCov(
1,
1,
1), mean(
1,
1))
201 call disp%show(
"mahalSq(1, 1:npnt)")
202 call disp%show( mahalSq(
1,
1:npnt) )
204 call disp%show(
"call setDisMahalSq(mahalSq(1, 1), point(1, 1), invCov(1,1,1)) ! for a single single-dimensional point one sample centered at origin.")
205 call setDisMahalSq(mahalSq(
1,
1), point(
1,
1), invCov(
1,
1,
1))
208 call disp%show(
"call setDisMahalSq(mahalSq(1, 1), point(1, 1), invCov(1,1,1), mean(1,1)) ! for a single single-dimensional point one sample centered at mean.")
209 call setDisMahalSq(mahalSq(
1,
1), point(
1,
1), invCov(
1,
1,
1), mean(
1,
1))
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 a random positive-definite (correlation or covariance) matrix using the Gram meth...
Generate and return a scalar or a contiguous array of rank 1 of length s1 of randomly uniformly distr...
This is a generic method of the derived type display_type with pass attribute.
This is a generic method of the derived type display_type with pass attribute.
Generate and return a matrix of shape (shape(1), shape(2)) with the upper/lower triangle and the diag...
Generate a sample of shape (nsam), or (ndim, nsam) or (nsam, ndim) that is shifted by the specified i...
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 classes and procedures for generating random matrices distributed on the space o...
This module contains classes and procedures for computing various statistical quantities related to t...
This module contains classes and procedures for input/output (IO) or generic display operations on st...
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
integer, parameter CKS
The single-precision complex kind in Fortran mode. On most platforms, this is a 32-bit real kind.
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
integer, parameter RKS
The single-precision real kind in Fortran mode. On most platforms, this is an 32-bit real kind.
This module contains procedures and generic interfaces relevant to generating and initializing matric...
This module contains classes and procedures for shifting univariate or multivariate samples by arbitr...
Generate and return an object of type display_type.
8ndim
= 3; npnt
= 5; nsam
= 2
11+0.835272074,
+0.796761394,
+0.459395528,
+0.671597302,
+0.368171036
12+0.236638188,
+0.258552969,
+0.151653409,
+0.590562820,
+0.298194766
13+0.743508399,
+0.235556364,
+0.126902282,
+0.199743807,
+0.399491787E-1
17invCov(:,:,isam)
= getCovRand(
mold = 1., ndim
= ndim)
20invCov(:,:,isam)
= getCovRand(
mold = 1., ndim
= ndim)
25+1.00000000,
-0.840642035,
+0.925846934
26-0.840642035,
+1.00000000,
-0.982806623
27+0.925846934,
-0.982806623,
+1.00000000
29+1.00000000,
-0.979800761,
-0.853364825
30-0.979800761,
+1.00000000,
+0.794587135
31-0.853364825,
+0.794587135,
+1.00000000
33+0.00000000,
+1.00000000
34+0.00000000,
+1.00000000
35+0.00000000,
+1.00000000
39+1.77828979,
+0.638628900,
+0.203136116,
+0.189407110,
+0.453027040E-1
40+0.138822198,
+0.129941329,
+0.447083153E-1,
+0.209947173E-1,
+0.475628814E-2
43+1.77828979,
+0.638628900,
+0.203136116,
+0.189407110,
+0.453027040E-1
44+0.668272674,
+1.51570010,
+1.24703979,
+0.724569559,
+0.979962111
45call setDisMahalSq(mahalSq(
1:nsam,
1), point(
1:ndim,
1), invCov)
47+1.77828979,
+0.138822198
48call setDisMahalSq(mahalSq(
1:nsam,
1), point(
1:ndim,
1), invCov, mean)
50+1.77828979,
+0.668272674
53+1.77828979,
+0.638628900,
+0.203136116,
+0.189407110,
+0.453027040E-1
54call setDisMahalSq(mahalSq(
1,
1:npnt), point, invCov(:,:,
1), mean(:,
1))
56+1.77828979,
+0.638628900,
+0.203136116,
+0.189407110,
+0.453027040E-1
57call setDisMahalSq(mahalSq(
1,
1), point(
1:ndim,
1), invCov(:,:,
1))
60call setDisMahalSq(mahalSq(
1,
1), point(
1:ndim,
1), invCov(:,:,
1), mean(:,
1))
63call setDisMahalSq(mahalSq(
1,
1:npnt), point(
1,
1:npnt), invCov(
1,
1,
1))
65+0.697679460,
+0.634828746,
+0.211044252,
+0.451042950,
+0.135549918
66call setDisMahalSq(mahalSq(
1,
1:npnt), point(
1,
1:npnt), invCov(
1,
1,
1), mean(
1,
1))
68+0.697679460,
+0.634828746,
+0.211044252,
+0.451042950,
+0.135549918
72call setDisMahalSq(mahalSq(
1,
1), point(
1,
1), invCov(
1,
1,
1), mean(
1,
1))
82ndim
= 3; npnt
= 5; nsam
= 2
85(
+0.967890263,
+0.00000000), (
+0.755439997,
+0.00000000), (
+0.883986473,
+0.00000000), (
+0.118351460,
+0.00000000), (
+0.254824519,
+0.00000000)
86(
+0.376520872,
+0.00000000), (
+0.768587351,
+0.00000000), (
+0.917271554,
+0.00000000), (
+0.213246047,
+0.00000000), (
+0.548202217,
+0.00000000)
87(
+0.146884680,
+0.00000000), (
+0.537296176,
+0.00000000), (
+0.502424181,
+0.00000000), (
+0.606488168,
+0.00000000), (
+0.938515842,
+0.00000000)
91invCov(:,:,isam)
= getCovRand(
mold = (
1.,
1.), ndim
= ndim)
94invCov(:,:,isam)
= getCovRand(
mold = (
1.,
1.), ndim
= ndim)
99(
+1.00000000,
+0.00000000), (
+0.161698163,
-0.800305486), (
-0.807014555E-1,
-0.266456485)
100(
+0.161698163,
+0.800305486), (
+1.00000000,
+0.00000000), (
+0.334269911,
-0.438129187)
101(
-0.807014555E-1,
+0.266456485), (
+0.334269911,
+0.438129187), (
+1.00000000,
+0.00000000)
103(
+1.00000000,
+0.00000000), (
+0.407185405,
+0.194329068), (
-0.635440350,
-0.238404185)
104(
+0.407185405,
-0.194329068), (
+1.00000000,
+0.00000000), (
+0.126184583,
-0.178029388E-1)
105(
-0.635440350,
+0.238404185), (
+0.126184583,
+0.178029388E-1), (
+1.00000000,
+0.00000000)
107(
+0.00000000,
+0.00000000), (
+1.00000000,
+0.00000000)
108(
+0.00000000,
+0.00000000), (
+1.00000000,
+0.00000000)
109(
+0.00000000,
+0.00000000), (
+1.00000000,
+0.00000000)
113(
+1.23203754,
-0.372529030E-8), (
+1.84844100,
-0.298023224E-7), (
+2.37389517,
+0.00000000), (
+0.510348499,
+0.00000000), (
+1.59681106,
+0.00000000)
114(
+1.23021483,
+0.00000000), (
+1.51131856,
+0.00000000), (
+2.08744907,
+0.745058060E-8), (
+0.389278889,
+0.00000000), (
+1.18594027,
+0.00000000)
117(
+1.23203754,
-0.372529030E-8), (
+1.84844100,
-0.298023224E-7), (
+2.37389517,
+0.00000000), (
+0.510348499,
+0.00000000), (
+1.59681106,
+0.00000000)
118(
+1.23328793,
-0.186264515E-8), (
+0.256756127,
-0.186264515E-8), (
+0.212727040,
+0.931322575E-9), (
+1.75323248,
+0.00000000), (
+0.986144245,
-0.186264515E-8)
119call setDisMahalSq(mahalSq(
1:nsam,
1), point(
1:ndim,
1), invCov)
121(
+1.23203754,
-0.372529030E-8), (
+1.23021483,
+0.00000000)
122call setDisMahalSq(mahalSq(
1:nsam,
1), point(
1:ndim,
1), invCov, mean)
124(
+1.23203754,
-0.372529030E-8), (
+1.23328793,
-0.186264515E-8)
127(
+1.23203754,
-0.372529030E-8), (
+1.84844100,
-0.298023224E-7), (
+2.37389517,
+0.00000000), (
+0.510348499,
+0.00000000), (
+1.59681106,
+0.00000000)
128call setDisMahalSq(mahalSq(
1,
1:npnt), point, invCov(:,:,
1), mean(:,
1))
130(
+1.23203754,
-0.372529030E-8), (
+1.84844100,
-0.298023224E-7), (
+2.37389517,
+0.00000000), (
+0.510348499,
+0.00000000), (
+1.59681106,
+0.00000000)
131call setDisMahalSq(mahalSq(
1,
1), point(
1:ndim,
1), invCov(:,:,
1))
133(
+1.23203754,
-0.372529030E-8)
134call setDisMahalSq(mahalSq(
1,
1), point(
1:ndim,
1), invCov(:,:,
1), mean(:,
1))
136(
+1.23203754,
-0.372529030E-8)
137call setDisMahalSq(mahalSq(
1,
1:npnt), point(
1,
1:npnt), invCov(
1,
1,
1))
139(
+0.936811566,
+0.00000000), (
+0.570689559,
+0.00000000), (
+0.781432092,
+0.00000000), (
+0.140070682E-1,
+0.00000000), (
+0.649355352E-1,
+0.00000000)
140call setDisMahalSq(mahalSq(
1,
1:npnt), point(
1,
1:npnt), invCov(
1,
1,
1), mean(
1,
1))
142(
+0.936811566,
+0.00000000), (
+0.570689559,
+0.00000000), (
+0.781432092,
+0.00000000), (
+0.140070682E-1,
+0.00000000), (
+0.649355352E-1,
+0.00000000)
145(
+0.936811566,
+0.00000000)
146call setDisMahalSq(mahalSq(
1,
1), point(
1,
1), invCov(
1,
1,
1), mean(
1,
1))
148(
+0.936811566,
+0.00000000)