17 integer(IK) :: itry, ntry
= 10
18 type(display_type) :: disp
19 character(:),
allocatable :: format
23 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
24 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
25 call disp%show(
"!Compute the covariance matrix of a 2-D sample.")
26 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
27 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
32 real(TKG),
allocatable :: sample(:,:), cov(:,:), mean(:), meang(:)
33 integer(IK) :: ndim, nsam, dim
34 call disp%show(
"ndim = 2; nsam = 10; dim = 2")
35 ndim
= 2; nsam
= 10; dim
= 2
36 call disp%show(
"sample = reshape(getUnifRand(1, 20, ndim * nsam), shape = [ndim, nsam], order = [2, 1])")
37 sample
= reshape(
getUnifRand(
1,
20, ndim
* nsam), shape
= [ndim, nsam], order
= [
2,
1])
40 call disp%show(
"meang = sample(:,1)")
42 call disp%show(
"mean = getFilled(0., ndim)")
44 call disp%show(
"cov = getFilled(0., ndim, ndim)")
46 call disp%show(
"call setCovMean(cov, uppDia, mean, sample, dim, meang)")
47 call setCovMean(cov, uppDia, mean, sample, dim, meang)
53 call disp%show(
"mean = getFilled(0., ndim)")
55 call disp%show(
"cov = getFilled(0., ndim, ndim)")
57 call disp%show(
"call setCovMean(cov, lowDia, mean, sample, dim, meang)")
58 call setCovMean(cov, lowDia, mean, sample, dim, meang)
64 call disp%show(
"Compute the sample covariance along the first dimension.", deliml
= SK_
'''')
68 call disp%show(
"mean = getFilled(0., ndim)")
70 call disp%show(
"cov = getFilled(0., ndim, ndim)")
72 call disp%show(
"call setCovMean(cov, uppDia, mean, transpose(sample), dim, meang)")
73 call setCovMean(cov, uppDia, mean,
transpose(sample), dim, meang)
79 call disp%show(
"mean = getFilled(0., ndim)")
81 call disp%show(
"cov = getFilled(0., ndim, ndim)")
83 call disp%show(
"call setCovMean(cov, lowDia, mean, transpose(sample), dim, meang)")
84 call setCovMean(cov, lowDia, mean,
transpose(sample), dim, meang)
90 call disp%show(
"Compute the full sample covariance for a pair of time series.", deliml
= SK_
'''')
92 call disp%show(
"mean = getFilled(0., ndim)")
94 call disp%show(
"cov = getFilled(0., ndim, ndim)")
96 call disp%show(
"call setCovMean(cov, mean, sample(1,:), sample(2,:), meang = sample(1:2,1))")
97 call setCovMean(cov, mean, sample(
1,:), sample(
2,:), meang
= sample(
1:
2,
1))
106 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
107 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
108 call disp%show(
"!Compute the biased covariance matrix of a weighted 2-D sample.")
109 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
110 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
116 integer(IK) :: iweisum
117 real(TKG),
allocatable :: rweight(:)
118 integer(IK),
allocatable :: iweight(:)
119 real(TKG),
allocatable :: sample(:,:), cov(:,:), mean(:), meang(:)
120 integer(IK) :: ndim, nsam, dim
121 call disp%show(
"ndim = 2; nsam = 10; dim = 2")
122 ndim
= 2; nsam
= 10; dim
= 2
123 call disp%show(
"sample = reshape(getUnifRand(1, 20, ndim * nsam), shape = [ndim, nsam], order = [2, 1])")
124 sample
= reshape(
getUnifRand(
1,
20, ndim
* nsam), shape
= [ndim, nsam], order
= [
2,
1])
127 call disp%show(
"meang = sample(:,1)")
129 call disp%show(
"call setResized(mean, ndim)")
131 call disp%show(
"iweight = getUnifRand(1, 10, nsam) ! integer-valued weights.")
135 call disp%show(
"rweight = iweight ! or real-valued weights.")
141 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
142 call disp%show(
"!Compute the covariance matrix integer weights.")
143 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
146 call disp%show(
"mean = getFilled(0., ndim)")
148 call disp%show(
"cov = getFilled(0., ndim, ndim)")
150 call disp%show(
"call setCovMean(cov, uppDia, mean, sample, dim, iweight, iweisum, meang)")
151 call setCovMean(cov, uppDia, mean, sample, dim, iweight, iweisum, meang)
159 call disp%show(
"mean = getFilled(0., ndim)")
161 call disp%show(
"cov = getFilled(0., ndim, ndim)")
163 call disp%show(
"call setCovMean(cov, lowDia, mean, sample, dim, iweight, iweisum, meang)")
164 call setCovMean(cov, lowDia, mean, sample, dim, iweight, iweisum, meang)
172 call disp%show(
"Compute the sample covariance along the first dimension.", deliml
= SK_
'''')
176 call disp%show(
"mean = getFilled(0., ndim)")
178 call disp%show(
"cov = getFilled(0., ndim, ndim)")
180 call disp%show(
"call setCovMean(cov, uppDia, mean, transpose(sample), dim, iweight, iweisum, meang)")
181 call setCovMean(cov, uppDia, mean,
transpose(sample), dim, iweight, iweisum, meang)
189 call disp%show(
"mean = getFilled(0., ndim)")
191 call disp%show(
"cov = getFilled(0., ndim, ndim)")
193 call disp%show(
"call setCovMean(cov, lowDia, mean, transpose(sample), dim, iweight, iweisum, meang)")
194 call setCovMean(cov, lowDia, mean,
transpose(sample), dim, iweight, iweisum, meang)
202 call disp%show(
"Compute the full sample covariance for a pair of time series.", deliml
= SK_
'''')
204 call disp%show(
"mean = getFilled(0., ndim)")
206 call disp%show(
"cov = getFilled(0., ndim, ndim)")
208 call disp%show(
"call setCovMean(cov, mean, sample(1,:), sample(2,:), iweight, iweisum, meang = sample(1:2,1))")
209 call setCovMean(cov, mean, sample(
1,:), sample(
2,:), iweight, iweisum, meang
= sample(
1:
2,
1))
219 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
220 call disp%show(
"!Compute the covariance matrix real weights.")
221 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
226 call disp%show(
"meang = sample(:,1)")
228 call disp%show(
"mean = getFilled(0., ndim)")
230 call disp%show(
"cov = getFilled(0., ndim, ndim)")
232 call disp%show(
"call setCovMean(cov, uppDia, mean, sample, dim, rweight, rweisum, meang)")
233 call setCovMean(cov, uppDia, mean, sample, dim, rweight, rweisum, meang)
241 call disp%show(
"mean = getFilled(0., ndim)")
243 call disp%show(
"cov = getFilled(0., ndim, ndim)")
245 call disp%show(
"call setCovMean(cov, lowDia, mean, sample, dim, rweight, rweisum, meang)")
246 call setCovMean(cov, lowDia, mean, sample, dim, rweight, rweisum, meang)
254 call disp%show(
"Compute the sample covariance along the first dimension.", deliml
= SK_
'''')
258 call disp%show(
"mean = getFilled(0., ndim)")
260 call disp%show(
"cov = getFilled(0., ndim, ndim)")
262 call disp%show(
"call setCovMean(cov, uppDia, mean, transpose(sample), dim, rweight, rweisum, meang)")
263 call setCovMean(cov, uppDia, mean,
transpose(sample), dim, rweight, rweisum, meang)
271 call disp%show(
"mean = getFilled(0., ndim)")
273 call disp%show(
"cov = getFilled(0., ndim, ndim)")
275 call disp%show(
"call setCovMean(cov, lowDia, mean, transpose(sample), dim, rweight, rweisum, meang)")
276 call setCovMean(cov, lowDia, mean,
transpose(sample), dim, rweight, rweisum, meang)
284 call disp%show(
"Compute the full sample covariance for a pair of time series.", deliml
= SK_
'''')
286 call disp%show(
"mean = getFilled(0., ndim)")
288 call disp%show(
"cov = getFilled(0., ndim, ndim)")
290 call disp%show(
"call setCovMean(cov, mean, sample(1,:), sample(2,:), rweight, rweisum, meang = sample(1:2,1))")
291 call setCovMean(cov, mean, sample(
1,:), sample(
2,:), rweight, rweisum, meang
= sample(
1:
2,
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 count evenly spaced points over the interval [x1, x2] if x1 < x2, or [x2,...
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 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 procedures and generic interfaces for generating arrays with linear or logarithm...
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 LK
The default logical kind in the ParaMonte library: kind(.true.) in Fortran, 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 classes and procedures for shifting univariate or multivariate samples by arbitr...
Generate and return an object of type display_type.
8ndim
= 2; nsam
= 10; dim
= 2
9sample
= reshape(
getUnifRand(
1,
20, ndim
* nsam), shape
= [ndim, nsam], order
= [
2,
1])
11+4.00000000,
+13.0000000,
+18.0000000,
+7.00000000,
+14.0000000,
+1.00000000,
+6.00000000,
+15.0000000,
+14.0000000,
+16.0000000
12+14.0000000,
+13.0000000,
+6.00000000,
+19.0000000,
+5.00000000,
+1.00000000,
+18.0000000,
+10.0000000,
+10.0000000,
+16.0000000
16call setCovMean(cov, uppDia, mean, sample, dim, meang)
18+10.8000002,
+11.1999998
20+30.1599979,
-1.85999906
21+0.00000000,
+31.3600006
25call setCovMean(cov, lowDia, mean, sample, dim, meang)
27+10.8000002,
+11.1999998
29+30.1599979,
+0.00000000
30-1.85999906,
+31.3600006
32'Compute the sample covariance along the first dimension.'
37call setCovMean(cov, uppDia, mean,
transpose(sample), dim, meang)
39+10.8000002,
+11.1999998
41+30.1599979,
-1.85999906
42+0.00000000,
+31.3600006
46call setCovMean(cov, lowDia, mean,
transpose(sample), dim, meang)
48+10.8000002,
+11.1999998
50+30.1599979,
+0.00000000
51-1.85999906,
+31.3600006
53'Compute the full sample covariance for a pair of time series.'
57call setCovMean(cov, mean, sample(
1,:), sample(
2,:), meang
= sample(
1:
2,
1))
59+10.8000002,
+11.1999998
61+30.1599979,
-1.85999906
62-1.85999906,
+31.3600006
71ndim
= 2; nsam
= 10; dim
= 2
72sample
= reshape(
getUnifRand(
1,
20, ndim
* nsam), shape
= [ndim, nsam], order
= [
2,
1])
74+11.0000000,
+4.00000000,
+16.0000000,
+5.00000000,
+10.0000000,
+5.00000000,
+4.00000000,
+16.0000000,
+7.00000000,
+15.0000000
75+12.0000000,
+9.00000000,
+18.0000000,
+2.00000000,
+17.0000000,
+12.0000000,
+13.0000000,
+5.00000000,
+14.0000000,
+4.00000000
80+7,
+8,
+7,
+3,
+4,
+10,
+8,
+8,
+6,
+4
83+7,
+8,
+7,
+3,
+4,
+10,
+8,
+8,
+6,
+4
91call setCovMean(cov, uppDia, mean, sample, dim, iweight, iweisum, meang)
95+9.04615402,
+11.0769234
97+23.7363319,
-1.40355027
98+0.00000000,
+20.7479286
102call setCovMean(cov, lowDia, mean, sample, dim, iweight, iweisum, meang)
106+9.04615402,
+11.0769234
108+23.7363319,
+0.00000000
109-1.40355027,
+20.7479286
111'Compute the sample covariance along the first dimension.'
116call setCovMean(cov, uppDia, mean,
transpose(sample), dim, iweight, iweisum, meang)
120+9.04615402,
+11.0769234
122+23.7363300,
-1.40355027
123+0.00000000,
+20.7479286
127call setCovMean(cov, lowDia, mean,
transpose(sample), dim, iweight, iweisum, meang)
131+9.04615402,
+11.0769234
133+23.7363319,
+0.00000000
134-1.40355027,
+20.7479305
136'Compute the full sample covariance for a pair of time series.'
140call setCovMean(cov, mean, sample(
1,:), sample(
2,:), iweight, iweisum, meang
= sample(
1:
2,
1))
144+9.04615402,
+11.0769234
146+23.7363319,
-1.40355027
147-1.40355027,
+20.7479286
158call setCovMean(cov, uppDia, mean, sample, dim, rweight, rweisum, meang)
162+9.04615402,
+11.0769234
164+23.7363319,
-1.40355027
165+0.00000000,
+20.7479286
169call setCovMean(cov, lowDia, mean, sample, dim, rweight, rweisum, meang)
173+9.04615402,
+11.0769234
175+23.7363319,
+0.00000000
176-1.40355027,
+20.7479286
178'Compute the sample covariance along the first dimension.'
183call setCovMean(cov, uppDia, mean,
transpose(sample), dim, rweight, rweisum, meang)
187+9.04615402,
+11.0769234
189+23.7363300,
-1.40355027
190+0.00000000,
+20.7479286
194call setCovMean(cov, lowDia, mean,
transpose(sample), dim, rweight, rweisum, meang)
198+9.04615402,
+11.0769234
200+23.7363319,
+0.00000000
201-1.40355027,
+20.7479305
203'Compute the full sample covariance for a pair of time series.'
207call setCovMean(cov, mean, sample(
1,:), sample(
2,:), rweight, rweisum, meang
= sample(
1:
2,
1))
211+9.04615402,
+11.0769234
213+23.7363319,
-1.40355027
214-1.40355027,
+20.7479286