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+12.0000000,
+4.00000000,
+15.0000000,
+6.00000000,
+20.0000000,
+16.0000000,
+16.0000000,
+8.00000000,
+5.00000000,
+4.00000000
12+15.0000000,
+4.00000000,
+10.0000000,
+20.0000000,
+18.0000000,
+9.00000000,
+6.00000000,
+13.0000000,
+16.0000000,
+14.0000000
16call setCovMean(cov, uppDia, mean, sample, dim, meang)
18+10.6000004,
+12.5000000
20+31.4400005,
-1.89999998
21+0.00000000,
+24.0500011
25call setCovMean(cov, lowDia, mean, sample, dim, meang)
27+10.6000004,
+12.5000000
29+31.4400005,
+0.00000000
30-1.89999998,
+24.0500011
32'Compute the sample covariance along the first dimension.'
37call setCovMean(cov, uppDia, mean,
transpose(sample), dim, meang)
39+10.6000004,
+12.5000000
41+31.4400024,
-1.89999998
42+0.00000000,
+24.0500011
46call setCovMean(cov, lowDia, mean,
transpose(sample), dim, meang)
48+10.6000004,
+12.5000000
50+31.4400005,
+0.00000000
51-1.89999998,
+24.0500011
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.6000004,
+12.5000000
61+31.4400005,
-1.89999998
62-1.89999998,
+24.0500011
71ndim
= 2; nsam
= 10; dim
= 2
72sample
= reshape(
getUnifRand(
1,
20, ndim
* nsam), shape
= [ndim, nsam], order
= [
2,
1])
74+7.00000000,
+3.00000000,
+1.00000000,
+4.00000000,
+9.00000000,
+4.00000000,
+13.0000000,
+11.0000000,
+10.0000000,
+8.00000000
75+15.0000000,
+20.0000000,
+8.00000000,
+7.00000000,
+10.0000000,
+1.00000000,
+8.00000000,
+4.00000000,
+7.00000000,
+7.00000000
80+7,
+5,
+5,
+6,
+9,
+7,
+4,
+5,
+7,
+3
83+7,
+5,
+5,
+6,
+9,
+7,
+4,
+5,
+7,
+3
91call setCovMean(cov, uppDia, mean, sample, dim, iweight, iweisum, meang)
95+6.94827604,
+8.72413826
97+12.1180143,
-2.42806196
98+0.00000000,
+25.9928608
102call setCovMean(cov, lowDia, mean, sample, dim, iweight, iweisum, meang)
106+6.94827604,
+8.72413826
108+12.1180143,
+0.00000000
109-2.42806196,
+25.9928608
111'Compute the sample covariance along the first dimension.'
116call setCovMean(cov, uppDia, mean,
transpose(sample), dim, iweight, iweisum, meang)
120+6.94827604,
+8.72413826
122+12.1180143,
-2.42806196
123+0.00000000,
+25.9928608
127call setCovMean(cov, lowDia, mean,
transpose(sample), dim, iweight, iweisum, meang)
131+6.94827604,
+8.72413826
133+12.1180143,
+0.00000000
134-2.42806196,
+25.9928665
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+6.94827604,
+8.72413826
146+12.1180143,
-2.42806196
147-2.42806196,
+25.9928608
158call setCovMean(cov, uppDia, mean, sample, dim, rweight, rweisum, meang)
162+6.94827604,
+8.72413826
164+12.1180143,
-2.42806196
165+0.00000000,
+25.9928608
169call setCovMean(cov, lowDia, mean, sample, dim, rweight, rweisum, meang)
173+6.94827604,
+8.72413826
175+12.1180143,
+0.00000000
176-2.42806196,
+25.9928608
178'Compute the sample covariance along the first dimension.'
183call setCovMean(cov, uppDia, mean,
transpose(sample), dim, rweight, rweisum, meang)
187+6.94827604,
+8.72413826
189+12.1180143,
-2.42806196
190+0.00000000,
+25.9928608
194call setCovMean(cov, lowDia, mean,
transpose(sample), dim, rweight, rweisum, meang)
198+6.94827604,
+8.72413826
200+12.1180143,
+0.00000000
201-2.42806196,
+25.9928665
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+6.94827604,
+8.72413826
213+12.1180143,
-2.42806196
214-2.42806196,
+25.9928608