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