18 type(display_type) :: disp
22 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
23 call disp%show(
"!Compute the variance of a 1-D sample.")
24 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
28 real(TKG) :: var, mean
29 real(TKG),
allocatable :: sample(:)
30 call disp%show(
"sample = getLinSpace(1._TKG, 9._TKG, 5_IK)")
34 call disp%show(
"call setVarMean(var, mean, sample, meang = sample(1))")
35 call setVarMean(var, mean, sample, meang
= sample(
1))
38 call disp%show(
"getMean(sample) ! for comparison.")
42 call disp%show(
"getVar(sample) ! for comparison.")
44 call disp%show(
"call setVarMean(var, mean, sample, dim = 1_IK, meang = sample(1))")
45 call setVarMean(var, mean, sample,
dim = 1_IK, meang
= sample(
1))
48 call disp%show(
"getMean(sample, dim = 1_IK) ! for comparison.")
52 call disp%show(
"getVar(sample, dim = 1_IK) ! for comparison.")
60 complex(TKG),
allocatable :: sample(:)
61 call disp%show(
"sample = cmplx(getLinSpace(1., 9., 5_IK), -getLinSpace(1., 9., 5_IK), TKG)")
65 call disp%show(
"call setVarMean(var, mean, sample, meang = sample(1))")
66 call setVarMean(var, mean, sample, meang
= sample(
1))
69 call disp%show(
"getMean(sample) ! for comparison.")
73 call disp%show(
"getVar(sample) ! for comparison.")
75 call disp%show(
"call setVarMean(var, mean, sample, dim = 1_IK, meang = sample(1))")
76 call setVarMean(var, mean, sample,
dim = 1_IK, meang
= sample(
1))
79 call disp%show(
"getMean(sample, dim = 1_IK) ! for comparison.")
83 call disp%show(
"getVar(sample, dim = 1_IK) ! for comparison.")
89 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
90 call disp%show(
"!Compute the variance of a 1-D weighted sample.")
91 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
95 real(TKG) :: var, weisum
96 real(TKG),
allocatable :: weight(:)
97 real(TKG),
allocatable :: sample(:)
99 call disp%show(
"sample = getLinSpace(1._TKG, 9._TKG, 5_IK)")
103 call disp%show(
"weight = getLinSpace(1._TKG, 9._TKG, size(sample, kind = IK))")
104 weight
= getLinSpace(
1._TKG,
9._TKG,
size(sample,
kind = IK))
107 call disp%show(
"call setVarMean(var, mean, sample, weight, weisum, meang = sample(1))")
108 call setVarMean(var, mean, sample, weight, weisum, meang
= sample(
1))
111 call disp%show(
"getMean(sample, weight) ! for comparison.")
115 call disp%show(
"getVar(sample, weight) ! for comparison.")
117 call disp%show(
"call setVarMean(var, mean, sample, 1_IK, weight, weisum, meang = sample(1))")
118 call setVarMean(var, mean, sample,
1_IK, weight, weisum, meang
= sample(
1))
121 call disp%show(
"getMean(sample, 1_IK, weight) ! for comparison.")
125 call disp%show(
"getVar(sample, 1_IK, weight) ! for comparison.")
131 real(TKG) :: var, weisum
132 real(TKG),
allocatable :: weight(:)
133 complex(TKG),
allocatable :: sample(:)
135 call disp%show(
"sample = cmplx(getLinSpace(1., 9., 5_IK), -getLinSpace(1., 9., 5_IK), TKG)")
139 call disp%show(
"weight = getLinSpace(1._TKG, 9._TKG, size(sample, kind = IK))")
140 weight
= getLinSpace(
1._TKG,
9._TKG,
size(sample,
kind = IK))
143 call disp%show(
"call setVarMean(var, mean, sample, weight, weisum, meang = sample(1))")
144 call setVarMean(var, mean, sample, weight, weisum, meang
= sample(
1))
147 call disp%show(
"getMean(sample, weight) ! for comparison.")
151 call disp%show(
"getVar(sample, weight) ! for comparison.")
153 call disp%show(
"call setVarMean(var, mean, sample, 1_IK, weight, weisum, meang = sample(1))")
154 call setVarMean(var, mean, sample,
1_IK, weight, weisum, meang
= sample(
1))
157 call disp%show(
"getMean(sample, 1_IK, weight) ! for comparison.")
161 call disp%show(
"getVar(sample, 1_IK, weight) ! for comparison.")
167 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
168 call disp%show(
"!Compute the variance of a 2-D array.")
169 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
173 real(TKG),
allocatable :: var(:)
174 real(TKG),
allocatable :: meang(:), mean(:), sample(:,:)
176 call disp%show(
"sample = getUnifRand(1._TKG, 9._TKG, 4_IK, 5_IK)")
180 call disp%show(
"call setResized(var, 1_IK)")
182 call disp%show(
"call setResized(mean, 1_IK)")
184 call disp%show(
"call setVarMean(var(1), mean(1), sample, meang = sample(1,1))")
185 call setVarMean(var(
1), mean(
1), sample, meang
= sample(
1,
1))
188 call disp%show(
"getMean(sample) ! for comparison.")
192 call disp%show(
"getVar(sample) ! for comparison.")
196 call disp%show(
"dim ! The observations axis.")
198 call disp%show(
"sample = getUnifRand(1._TKG, 9._TKG, 4_IK, 5_IK)")
202 call disp%show(
"call setResized(var, size(sample, 3 - dim, IK))")
204 call disp%show(
"call setResized(mean, size(sample, 3 - dim, IK))")
206 call disp%show(
"if (dim == 1) then; meang = sample(1,:); else; meang = sample(:,1); end if")
207 if (dim
== 1)
then; meang
= sample(
1,:);
else; meang
= sample(:,
1);
end if
208 call disp%show(
"call setVarMean(var, mean, sample, dim, meang)")
209 call setVarMean(var, mean, sample, dim, meang)
212 call disp%show(
"getMean(sample, dim) ! for comparison.")
216 call disp%show(
"getVar(sample, dim) ! for comparison.")
223 real(TKG),
allocatable :: var(:)
224 complex(TKG),
allocatable :: meang(:), mean(:), sample(:,:)
226 call disp%show(
"sample = cmplx(getUnifRand(1., 9., 4_IK, 5_IK), -getUnifRand(1., 9., 4_IK, 5_IK), TKG)")
230 call disp%show(
"call setResized(var, 1_IK)")
232 call disp%show(
"call setResized(mean, 1_IK)")
234 call disp%show(
"call setVarMean(var(1), mean(1), sample, meang = sample(1,1))")
235 call setVarMean(var(
1), mean(
1), sample, meang
= sample(
1,
1))
238 call disp%show(
"getMean(sample) ! for comparison.")
242 call disp%show(
"getVar(sample) ! for comparison.")
246 call disp%show(
"dim ! The observations axis.")
248 call disp%show(
"sample = cmplx(getUnifRand(1., 9., 4_IK, 5_IK), -getUnifRand(1., 9., 4_IK, 5_IK), TKG)")
252 call disp%show(
"call setResized(var, size(sample, 3 - dim, IK))")
254 call disp%show(
"call setResized(mean, size(sample, 3 - dim, IK))")
256 call disp%show(
"if (dim == 1) then; meang = sample(1,:); else; meang = sample(:,1); end if")
257 if (dim
== 1)
then; meang
= sample(
1,:);
else; meang
= sample(:,
1);
end if
258 call disp%show(
"call setVarMean(var, mean, sample, dim, meang)")
259 call setVarMean(var, mean, sample, dim, meang)
262 call disp%show(
"getMean(sample, dim) ! for comparison.")
266 call disp%show(
"getVar(sample, dim) ! for comparison.")
273 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
274 call disp%show(
"!Compute the variance of a 2-D weighted sample.")
275 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
280 real(TKG),
allocatable :: var(:)
281 real(TKG),
allocatable :: rweight(:)
282 real(TKG),
allocatable :: meang(:), mean(:), sample(:,:)
283 integer(IK),
allocatable :: iweight(:)
284 integer(IK) :: iweisum
286 call disp%show(
"sample = getUnifRand(1._TKG, 9._TKG, 4_IK, 5_IK)")
290 call disp%show(
"iweight = getUnifRand(1, 9, size(sample, kind = IK))")
296 call disp%show(
"call setResized(var, 1_IK)")
298 call disp%show(
"call setResized(mean, 1_IK)")
300 call disp%show(
"call setVarMean(var(1), mean(1), sample, iweight, iweisum, meang = sample(1,1))")
301 call setVarMean(var(
1), mean(
1), sample, iweight, iweisum, meang
= sample(
1,
1))
304 call disp%show(
"getMean(sample, iweight) ! for comparison.")
308 call disp%show(
"getVar(sample, iweight) ! for comparison.")
310 call disp%show(
"[iweisum, sum(iweight)] ! for comparison.")
311 call disp%show( [iweisum,
sum(iweight)] )
312 call disp%show(
"call setVarMean(var(1), mean(1), sample, rweight, rweisum, meang = sample(1,1))")
313 call setVarMean(var(
1), mean(
1), sample, rweight, rweisum, meang
= sample(
1,
1))
316 call disp%show(
"getMean(sample, rweight) ! for comparison.")
320 call disp%show(
"getVar(sample, rweight) ! for comparison.")
322 call disp%show(
"[rweisum, sum(rweight)] ! for comparison.")
323 call disp%show( [rweisum,
sum(rweight)] )
326 call disp%show(
"dim ! The observations axis.")
328 call disp%show(
"sample = getUnifRand(1._TKG, 9._TKG, 4_IK, 5_IK)")
332 call disp%show(
"iweight = getUnifRand(1, 9, size(sample, dim, IK))")
336 call disp%show(
"call setResized(var, size(sample, 3 - dim, IK))")
338 call disp%show(
"call setResized(mean, size(sample, 3 - dim, IK))")
340 call disp%show(
"if (dim == 1) then; meang = sample(1,:); else; meang = sample(:,1); end if")
341 if (dim
== 1)
then; meang
= sample(
1,:);
else; meang
= sample(:,
1);
end if
342 call disp%show(
"call setVarMean(var, mean, sample, dim, iweight, iweisum, meang)")
343 call setVarMean(var, mean, sample, dim, iweight, iweisum, meang)
346 call disp%show(
"getMean(sample, dim, iweight) ! for comparison.")
350 call disp%show(
"getVar(sample, dim, iweight) ! for comparison.")
352 call disp%show(
"[iweisum, sum(iweight)] ! for comparison.")
353 call disp%show( [iweisum,
sum(iweight)] )
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 and return the (weighted) mean of an input sample of nsam observations with ndim = 1 or 2 at...
Generate a sample of shape (nsam), or (ndim, nsam) or (nsam, ndim) that is shifted by the specified i...
Generate and return the variance of the input sample of type complex or real of shape (nsam) or (ndim...
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 RK
The default real kind in the ParaMonte library: real64 in Fortran, c_double in C-Fortran Interoperati...
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 computing the properties related to the covariance ma...
This module contains classes and procedures for computing the first moment (i.e., the statistical mea...
This module contains classes and procedures for shifting univariate or multivariate samples by arbitr...
Generate and return an object of type display_type.
8+1.00000000,
+3.00000000,
+5.00000000,
+7.00000000,
+9.00000000
9call setVarMean(var, mean, sample, meang
= sample(
1))
18call setVarMean(var, mean, sample,
dim = 1_IK, meang
= sample(
1))
30(
+1.00000000,
-1.00000000), (
+3.00000000,
-3.00000000), (
+5.00000000,
-5.00000000), (
+7.00000000,
-7.00000000), (
+9.00000000,
-9.00000000)
31call setVarMean(var, mean, sample, meang
= sample(
1))
33(
+5.00000000,
-5.00000000)
35(
+5.00000000,
-5.00000000)
40call setVarMean(var, mean, sample,
dim = 1_IK, meang
= sample(
1))
42(
+5.00000000,
-5.00000000)
44(
+5.00000000,
-5.00000000)
57+1.00000000,
+3.00000000,
+5.00000000,
+7.00000000,
+9.00000000
60+1.00000000,
+3.00000000,
+5.00000000,
+7.00000000,
+9.00000000
61call setVarMean(var, mean, sample, weight, weisum, meang
= sample(
1))
70call setVarMean(var, mean, sample,
1_IK, weight, weisum, meang
= sample(
1))
77getVar(sample,
1_IK, weight)
82(
+1.00000000,
-1.00000000), (
+3.00000000,
-3.00000000), (
+5.00000000,
-5.00000000), (
+7.00000000,
-7.00000000), (
+9.00000000,
-9.00000000)
85+1.00000000,
+3.00000000,
+5.00000000,
+7.00000000,
+9.00000000
86call setVarMean(var, mean, sample, weight, weisum, meang
= sample(
1))
88(
+6.59999990,
-6.59999990)
90(
+6.59999990,
-6.59999990)
95call setVarMean(var, mean, sample,
1_IK, weight, weisum, meang
= sample(
1))
97(
+6.59999990,
-6.59999990)
99(
+6.59999990,
-6.59999990)
102getVar(sample,
1_IK, weight)
113+6.23101759,
+1.80139017,
+2.85529184,
+2.10455704,
+4.03061295
114+4.33758450,
+6.51584482,
+1.30442810,
+2.87540388,
+6.58009052
115+4.14842224,
+5.29646444,
+7.34088230,
+8.93565845,
+2.69979477
116+8.57904148,
+2.85514688,
+7.13377810,
+8.80456448,
+3.41684771
119call setVarMean(var(
1), mean(
1), sample, meang
= sample(
1,
1))
133+3.79013968,
+8.15100002,
+2.66874075,
+6.01550865,
+3.19957638
134+8.16963673,
+6.51185751,
+6.24838448,
+3.44625854,
+3.54126501
135+5.28146791,
+8.69198513,
+3.21732569,
+2.95255518,
+8.92523670
136+3.41177845,
+7.89192343,
+3.99417591,
+1.25755692,
+7.84615612
139if (dim
== 1)
then; meang
= sample(
1,:);
else; meang
= sample(:,
1);
end if
142+5.16325569,
+7.81169128,
+4.03215694,
+3.41796970,
+5.87805843
144+5.16325569,
+7.81169176,
+4.03215694,
+3.41796970,
+5.87805843
146+3.50135565,
+0.646513224,
+1.85899031,
+2.90799999,
+6.44839525
148+3.50135541,
+0.646513164,
+1.85899019,
+2.90800071,
+6.44839382
154+7.85388708,
+2.27132416,
+6.86721802,
+1.85558462,
+7.23191881
155+5.52287149,
+4.32797050,
+2.21704054,
+4.57380772,
+8.11474705
156+8.06937122,
+6.11389065,
+8.50014973,
+2.98059320,
+5.41113091
157+1.92430592,
+3.27564240,
+6.44183588,
+1.29872036,
+1.52788019
160if (dim
== 1)
then; meang
= sample(
1,:);
else; meang
= sample(:,
1);
end if
163+5.21598625,
+4.95128727,
+6.21502686,
+2.89367700
165+5.21598673,
+4.95128727,
+6.21502686,
+2.89367723
167+6.74247980,
+3.66826129,
+3.95568323,
+3.61685991
169+6.74248075,
+3.66826105,
+3.95568347,
+3.61685944
174(
+7.78232336,
-6.38262939), (
+7.63592100,
-4.75375175), (
+8.89669895,
-5.43110228), (
+4.19091511,
-8.67274570), (
+8.93950939,
-3.70274353)
175(
+1.91753387,
-3.11807156), (
+5.98391199,
-7.60711670), (
+5.77987242,
-4.52920341), (
+8.61166191,
-3.52403736), (
+2.85432100,
-2.22961092)
176(
+2.46021032,
-1.97570753), (
+1.84966040,
-6.35449171), (
+1.88943672,
-7.89821577), (
+1.22861147,
-3.57067823), (
+1.32866573,
-7.45364809)
177(
+6.60469580,
-1.57940865), (
+8.87889194,
-6.82808161), (
+8.97922993,
-7.95911503), (
+8.79323959,
-3.03248167), (
+8.04065800,
-1.89757729)
180call setVarMean(var(
1), mean(
1), sample, meang
= sample(
1,
1))
182(
+5.63229847,
-4.92502117)
184(
+5.63229847,
-4.92502117)
194(
+1.92973518,
-7.10630751), (
+2.06336451,
-7.86325741), (
+1.94000483,
-3.00183058), (
+5.54568148,
-6.57727957), (
+7.44238853,
-7.28280354)
195(
+6.33854723,
-7.94744062), (
+7.74714899,
-4.25402355), (
+7.52029705,
-3.73797369), (
+7.92195988,
-7.30547810), (
+6.15820885,
-4.61835337)
196(
+6.52675772,
-2.58185911), (
+6.05859995,
-8.34707832), (
+7.30071497,
-7.60633087), (
+2.96511412,
-6.70989084), (
+8.65090370,
-4.80329752)
197(
+4.87045765,
-5.78833961), (
+7.97797298,
-7.49458599), (
+1.54810143,
-1.22701502), (
+7.48719311,
-2.47973680), (
+5.79902887,
-5.73669624)
200if (dim
== 1)
then; meang
= sample(
1,:);
else; meang
= sample(:,
1);
end if
203(
+4.91637421,
-5.85598660), (
+5.96177149,
-6.98973656), (
+4.57727957,
-3.89328766), (
+5.97998714,
-5.76809645), (
+7.01263237,
-5.61028767)
205(
+4.91637421,
-5.85598660), (
+5.96177197,
-6.98973656), (
+4.57727957,
-3.89328766), (
+5.97998714,
-5.76809597), (
+7.01263237,
-5.61028767)
207+7.54999924,
+8.20100021,
+13.4810286,
+7.50990295,
+2.37998748
209+7.55000019,
+8.20100212,
+13.4810276,
+7.50990343,
+2.37998796
215(
+1.25199795,
-6.27884865), (
+5.68475628,
-6.30847120), (
+3.76309681,
-6.11957026), (
+8.16487122,
-5.28562069), (
+7.69224882,
-7.48434973)
216(
+7.33500957,
-5.06785727), (
+3.34104443,
-3.85906649), (
+1.62672853,
-6.53159666), (
+4.29207230,
-1.78148365), (
+8.96261024,
-1.53834772)
217(
+6.75989008,
-6.73386955), (
+1.08569288,
-1.45365524), (
+6.94705677,
-1.12162447), (
+6.62572098,
-2.23531008), (
+8.08164883,
-2.25543356)
218(
+8.65246201,
-4.72744513), (
+6.72593355,
-6.40350914), (
+5.56740379,
-3.28813028), (
+8.41146660,
-8.31492710), (
+2.95394373,
-1.24187660)
221if (dim
== 1)
then; meang
= sample(
1,:);
else; meang
= sample(:,
1);
end if
224(
+5.31139421,
-6.29537201), (
+5.11149311,
-3.75567031), (
+5.90000200,
-2.75997853), (
+6.46224213,
-4.79517746)
226(
+5.31139469,
-6.29537249), (
+5.11149311,
-3.75567055), (
+5.90000248,
-2.75997853), (
+6.46224213,
-4.79517794)
228+7.05814695,
+10.7953768,
+10.2023792,
+10.3304119
230+7.05814838,
+10.7953749,
+10.2023783,
+10.3304129
240+8.89806938,
+1.07575369,
+2.16644669,
+4.66418076,
+7.22673368
241+5.12503719,
+7.14868784,
+3.54351807,
+3.81741142,
+2.47923470
242+8.79406166,
+6.82515669,
+1.09592295,
+4.51031494,
+7.87915277
243+4.29261446,
+8.10224724,
+5.29211760,
+7.02474022,
+7.13483000
246+2,
+9,
+1,
+7,
+7,
+3,
+2,
+5,
+1,
+4,
+6,
+2,
+3,
+7,
+3,
+1,
+8,
+8,
+8,
+9
250call setVarMean(var(
1), mean(
1), sample, iweight, iweisum, meang
= sample(
1,
1))
259[iweisum,
sum(iweight)]
261call setVarMean(var(
1), mean(
1), sample, rweight, rweisum, meang
= sample(
1,
1))
270[rweisum,
sum(rweight)]
271+96.0000000,
+96.0000000
277+2.62256050,
+8.51588058,
+6.90235949,
+1.76822758,
+3.10969782
278+1.45672417,
+3.21343994,
+7.69671488,
+7.87379646,
+1.73079443
279+7.17184067,
+3.26621532,
+4.33842659,
+8.00684738,
+7.03410196
280+8.92055321,
+2.59056044,
+1.40899706,
+8.33997631,
+2.43560934
286if (dim
== 1)
then; meang
= sample(
1,:);
else; meang
= sample(:,
1);
end if
287call setVarMean(var, mean, sample, dim, iweight, iweisum, meang)
289+4.75146866,
+4.79677677,
+5.63279247,
+6.12530756,
+4.56619453
291+4.75146914,
+4.79677725,
+5.63279295,
+6.12530804,
+4.56619453
293+7.03599548,
+5.94845724,
+2.98144007,
+8.14501095,
+5.21203852
294getVar(sample, dim, iweight)
295+7.03599691,
+5.94845915,
+2.98144007,
+8.14501095,
+5.21203804
296[iweisum,
sum(iweight)]
303+5.98273134,
+8.06611633,
+4.58259869,
+6.16902781,
+8.13586140
304+8.51793289,
+6.72156143,
+5.95537281,
+6.54280615,
+2.61302185
305+3.50624990,
+2.01927042,
+1.12704802,
+5.71999645,
+3.34952784
306+1.84521151,
+2.45969009,
+6.81009054,
+5.38087606,
+7.71486521
312if (dim
== 1)
then; meang
= sample(
1,:);
else; meang
= sample(:,
1);
end if
313call setVarMean(var, mean, sample, dim, iweight, iweisum, meang)
315+6.32216311,
+5.90429878,
+3.05499029,
+5.32955265
317+6.32216263,
+5.90429878,
+3.05499029,
+5.32955265
319+1.97218025,
+3.56447172,
+2.74985290,
+4.87818813
320getVar(sample, dim, iweight)
321+1.97218025,
+3.56447196,
+2.74985290,
+4.87819004
322[iweisum,
sum(iweight)]