ParaMonte Fortran 2.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
pm_sampleVar::setVarMeanMerged Interface Reference

Return the (weighted) merged variance and mean of a complex or real sample resulting from the merger of two separate (weighted) samples \(A\) and \(B\).
More...

Detailed Description

Return the (weighted) merged variance and mean of a complex or real sample resulting from the merger of two separate (weighted) samples \(A\) and \(B\).

See the documentation of pm_sampleVar and pm_sampleMean for more information and definition online updating of sample variance and mean.

Note
The input and output variances of this generic interface are all biased variances.
A biased variance can be readily unbiased by multiplying it with the appropriate bias-correction factors detailed in the documentation of pm_sampleVar.
Parameters
[out]varMerged: The output object of the same type and kind and rank and shape as meanA, containing the biased variance of the sample resulting form the merger of the two samples.
(optional. If missing, the resulting merged variance will be written to the argument varB.)
[out]meanMerged: The output object of the same type and kind and rank and shape as meanA, containing the mean of the sample resulting form the merger of the two samples.
(optional. If missing, the resulting merged mean will be written to the argument meanB.)
[in,out]varB: The input or input/output object of type real of the same kind and rank and shape as the input argument meanA, containing the biased variance of the second sample that must be merged with the first sample.
If the input argument varMerged is missing, then varB contains the updated biased variance of the merged sample on return.
Otherwise, the contents of varB remain intact upon return.
[in,out]meanB: The input or input/output object of the same type and kind and rank and shape as the input argument meanA, containing the mean of the second sample that must be merged with the first sample.
If the input argument meanMerged is missing, then meanB contains the updated mean of the merged sample on return.
Otherwise, the contents of meanB remain intact upon return.
[in]varA: The input scalar or contiguous vector of shape (1:ndim) of type real of the same kind as the kind of the input argument meanA, containing the biased variance of the first sample that must be merged with the second sample.
[in]meanA: The input scalar or contiguous vector of shape (1:ndim) of,
  1. type complex of kind any supported by the processor (e.g., CK, CK32, CK64, or CK128),
  2. type real of kind any supported by the processor (e.g., RK, RK32, RK64, or RK128),
containing the mean of the first sample that must be merged with the second sample.
[in]fracA: The input scalar of type real of the same kind as kind of varA, containing the ratio of the sum of the weights of all points in sample \(A\) to sum of weights of all points in the merged sample.
If the sample is unweighted, then fracA is simply size(sampleA) / (size(sampleA) + size(sampleB)).


Possible calling interfaces

! univariate sample
call setVarMeanMerged(varB, meanB, varA, meanA, fracA)
call setVarMeanMerged(varMerged, meanMerged, varB, meanB, varA, meanA, fracA)
! ndim-dimensional sample
call setVarMeanMerged(varB(1:ndim), varA(1:ndim), meanDiff(1:ndim), fracA)
call setVarMeanMerged(varMerged(1:ndim), varB(1:ndim), varA(1:ndim), meanDiff(1:ndim), fracA)
Return the (weighted) merged variance and mean of a complex or real sample resulting from the merger ...
This module contains classes and procedures for computing the properties related to the covariance ma...
Warning
The condition 0 < fracA .and. fracA < 1 must hold for the corresponding input arguments.
The condition size(varB) == size(varA) must hold for the corresponding input arguments.
The condition size(varA) == size(meanA) must hold for the corresponding input arguments.
The condition size(varA) == size(meanB) must hold for the corresponding input arguments.
The condition size(varA) == size(varMearged) must hold for the corresponding input arguments.
The condition size(varA) == size(meanMearged) must hold for the corresponding input arguments.
These conditions are verified only if the library is built with the preprocessor macro CHECK_ENABLED=1.
The pure procedure(s) documented herein become impure when the ParaMonte library is compiled with preprocessor macro CHECK_ENABLED=1.
By default, these procedures are pure in release build and impure in debug and testing builds.
See also
getCor
setCor
getCov
setCov
getVar
setVar
getMean
setMean
getCovMerged
setCovMerged
getVarMerged
setVarMerged
getMeanMerged
setMeanMerged
setVarMeanMerged
setVarMeanMerged


Example usage

1program example
2
3 use pm_kind, only: SK, IK
4 use pm_kind, only: TKG => RKS ! All other real types are also supported.
5 use pm_sampleVar, only: getVar
6 use pm_sampleMean, only: getMean
10 use pm_distUnif, only: getUnifRand
11 use pm_arrayRange, only: getRange
12 use pm_io, only: display_type
13
14 implicit none
15
16 integer(IK), parameter :: nsam = 2
17 integer(IK), allocatable :: iweight(:)
18 integer(IK) :: isam, ndim, lb(nsam), ub(nsam)
19 integer(IK) :: dim, itry, ntry = 5
20 type(display_type) :: disp
21 disp = display_type(file = "main.out.F90")
22
23 call disp%skip()
24 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
25 call disp%show("!Compute the biased merged variance and mean of a univariate sample.")
26 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
27 call disp%skip()
28
29 block
30 real(TKG) :: mean(0:nsam), meanMerged
31 real(TKG), allocatable :: sample(:)
32 real(TKG) :: var(0:nsam), varMerged
33 do itry = 1, ntry
34 call disp%skip()
35 call disp%show("lb(1) = 1; ub(1) = getUnifRand(2, 7)")
36 lb(1) = 1; ub(1) = getUnifRand(2, 7)
37 call disp%show("do isam = 2, nsam")
38 call disp%show(" lb(isam) = ub(isam - 1) + 1")
39 call disp%show(" ub(isam) = ub(isam - 1) + getUnifRand(2, 7)")
40 call disp%show("end do")
41 do isam = 2, nsam
42 lb(isam) = ub(isam - 1) + 1
43 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
44 end do
45 call disp%show("lb")
46 call disp%show( lb )
47 call disp%show("ub")
48 call disp%show( ub )
49 call disp%show("sample = getUnifRand(0., 1., ub(nsam))")
50 sample = getUnifRand(0., 1., ub(nsam))
51 call disp%show("sample")
52 call disp%show( sample )
53 call disp%show("mean(0) = getMean(sample)")
54 mean(0) = getMean(sample)
55 call disp%show("mean(0) ! reference")
56 call disp%show( mean(0) )
57 call disp%show("var(0) = getVar(sample)")
58 var(0) = getVar(sample)
59 call disp%show("var(0) ! reference")
60 call disp%show( var(0) )
61 call disp%show("do isam = 1, nsam")
62 call disp%show(" var(isam) = getVar(sample(lb(isam):ub(isam)))")
63 call disp%show(" mean(isam) = getMean(sample(lb(isam):ub(isam)))")
64 call disp%show("end do")
65 do isam = 1, nsam
66 var(isam) = getVar(sample(lb(isam):ub(isam)))
67 mean(isam) = getMean(sample(lb(isam):ub(isam)))
68 end do
69 call disp%show("call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))")
70 call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
71 call disp%show("meanMerged")
72 call disp%show( meanMerged )
73 call disp%show("varMerged")
74 call disp%show( varMerged )
75 call disp%show("call setVarMeanMerged(var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))")
76 call setVarMeanMerged(var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
77 call disp%show("mean(2)")
78 call disp%show( mean(2) )
79 call disp%show("mean(0) ! reference")
80 call disp%show( mean(0) )
81 call disp%show("var(2)")
82 call disp%show( var(2) )
83 call disp%show("var(0) ! reference")
84 call disp%show( var(0) )
85 call disp%skip()
86 end do
87 end block
88
89 block
90 complex(TKG) :: mean(0:nsam), meanMerged
91 complex(TKG), allocatable :: sample(:)
92 real(TKG) :: var(0:nsam), varMerged
93 do itry = 1, ntry
94 call disp%skip()
95 call disp%show("lb(1) = 1; ub(1) = getUnifRand(2, 7)")
96 lb(1) = 1; ub(1) = getUnifRand(2, 7)
97 call disp%show("do isam = 2, nsam")
98 call disp%show(" lb(isam) = ub(isam - 1) + 1")
99 call disp%show(" ub(isam) = ub(isam - 1) + getUnifRand(2, 7)")
100 call disp%show("end do")
101 do isam = 2, nsam
102 lb(isam) = ub(isam - 1) + 1
103 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
104 end do
105 call disp%show("lb")
106 call disp%show( lb )
107 call disp%show("ub")
108 call disp%show( ub )
109 call disp%show("sample = cmplx(getUnifRand(-1., +1., ub(nsam)), getUnifRand(-1., +1., ub(nsam)), TKG)")
110 sample = cmplx(getUnifRand(-1., +1., ub(nsam)), getUnifRand(-1., +1., ub(nsam)), TKG)
111 call disp%show("sample")
112 call disp%show( sample )
113 call disp%show("mean(0) = getMean(sample)")
114 mean(0) = getMean(sample)
115 call disp%show("mean(0) ! reference")
116 call disp%show( mean(0) )
117 call disp%show("var(0) = getVar(sample)")
118 var(0) = getVar(sample)
119 call disp%show("var(0) ! reference")
120 call disp%show( var(0) )
121 call disp%show("do isam = 1, nsam")
122 call disp%show(" var(isam) = getVar(sample(lb(isam):ub(isam)))")
123 call disp%show(" mean(isam) = getMean(sample(lb(isam):ub(isam)))")
124 call disp%show("end do")
125 do isam = 1, nsam
126 var(isam) = getVar(sample(lb(isam):ub(isam)))
127 mean(isam) = getMean(sample(lb(isam):ub(isam)))
128 end do
129 call disp%show("call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))")
130 call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
131 call disp%show("meanMerged")
132 call disp%show( meanMerged )
133 call disp%show("varMerged")
134 call disp%show( varMerged )
135 call disp%show("call setVarMeanMerged(var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))")
136 call setVarMeanMerged(var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
137 call disp%show("mean(2)")
138 call disp%show( mean(2) )
139 call disp%show("mean(0) ! reference")
140 call disp%show( mean(0) )
141 call disp%show("var(2)")
142 call disp%show( var(2) )
143 call disp%show("var(0) ! reference")
144 call disp%show( var(0) )
145 call disp%skip()
146 end do
147 end block
148
149 call disp%skip()
150 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
151 call disp%show("!Compute the biased merged variance and mean of a frequency weighted univariate sample.")
152 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
153 call disp%skip()
154
155 block
156 real(TKG) :: mean(0:nsam), meanMerged
157 real(TKG), allocatable :: sample(:)
158 real(TKG) :: var(0:nsam), varMerged
159 do itry = 1, ntry
160 call disp%skip()
161 call disp%show("lb(1) = 1; ub(1) = getUnifRand(2, 7)")
162 lb(1) = 1; ub(1) = getUnifRand(2, 7)
163 call disp%show("do isam = 2, nsam")
164 call disp%show(" lb(isam) = ub(isam - 1) + 1")
165 call disp%show(" ub(isam) = ub(isam - 1) + getUnifRand(2, 7)")
166 call disp%show("end do")
167 do isam = 2, nsam
168 lb(isam) = ub(isam - 1) + 1
169 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
170 end do
171 call disp%show("lb")
172 call disp%show( lb )
173 call disp%show("ub")
174 call disp%show( ub )
175 call disp%show("sample = getUnifRand(0., 1., ub(nsam))")
176 sample = getUnifRand(0., 1., ub(nsam))
177 call disp%show("sample")
178 call disp%show( sample )
179 call disp%show("iweight = getUnifRand(1, 10, size(sample, 1, IK))")
180 iweight = getUnifRand(1, 10, size(sample, 1, IK))
181 call disp%show("iweight")
182 call disp%show( iweight )
183 call disp%show("mean(0) = getMean(sample, iweight)")
184 mean(0) = getMean(sample, iweight)
185 call disp%show("mean(0) ! reference")
186 call disp%show( mean(0) )
187 call disp%show("var(0) = getVar(sample, iweight)")
188 var(0) = getVar(sample, iweight)
189 call disp%show("var(0) ! reference")
190 call disp%show( var(0) )
191 call disp%show("do isam = 1, nsam")
192 call disp%show(" var(isam) = getVar(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))")
193 call disp%show(" mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))")
194 call disp%show("end do")
195 do isam = 1, nsam
196 var(isam) = getVar(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
197 mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
198 end do
199 call disp%show("call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))")
200 call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
201 call disp%show("meanMerged")
202 call disp%show( meanMerged )
203 call disp%show("varMerged")
204 call disp%show( varMerged )
205 call disp%show("call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))")
206 call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
207 call disp%show("mean(2)")
208 call disp%show( mean(2) )
209 call disp%show("mean(0) ! reference")
210 call disp%show( mean(0) )
211 call disp%show("var(2)")
212 call disp%show( var(2) )
213 call disp%show("var(0) ! reference")
214 call disp%show( var(0) )
215 call disp%skip()
216 end do
217 end block
218
219 block
220 complex(TKG) :: mean(0:nsam), meanMerged
221 complex(TKG), allocatable :: sample(:)
222 real(TKG) :: var(0:nsam), varMerged
223 do itry = 1, ntry
224 call disp%skip()
225 call disp%show("lb(1) = 1; ub(1) = getUnifRand(2, 7)")
226 lb(1) = 1; ub(1) = getUnifRand(2, 7)
227 call disp%show("do isam = 2, nsam")
228 call disp%show(" lb(isam) = ub(isam - 1) + 1")
229 call disp%show(" ub(isam) = ub(isam - 1) + getUnifRand(2, 7)")
230 call disp%show("end do")
231 do isam = 2, nsam
232 lb(isam) = ub(isam - 1) + 1
233 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
234 end do
235 call disp%show("lb")
236 call disp%show( lb )
237 call disp%show("ub")
238 call disp%show( ub )
239 call disp%show("sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)")
240 sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
241 call disp%show("sample")
242 call disp%show( sample )
243 call disp%show("iweight = getUnifRand(1, 10, size(sample, 1, IK))")
244 iweight = getUnifRand(1, 10, size(sample, 1, IK))
245 call disp%show("iweight")
246 call disp%show( iweight )
247 call disp%show("mean(0) = getMean(sample, iweight)")
248 mean(0) = getMean(sample, iweight)
249 call disp%show("mean(0) ! reference")
250 call disp%show( mean(0) )
251 call disp%show("var(0) = getVar(sample, iweight)")
252 var(0) = getVar(sample, iweight)
253 call disp%show("var(0) ! reference")
254 call disp%show( var(0) )
255 call disp%show("do isam = 1, nsam")
256 call disp%show(" var(isam) = getVar(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))")
257 call disp%show(" mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))")
258 call disp%show("end do")
259 do isam = 1, nsam
260 var(isam) = getVar(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
261 mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
262 end do
263 call disp%show("call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))")
264 call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
265 call disp%show("meanMerged")
266 call disp%show( meanMerged )
267 call disp%show("varMerged")
268 call disp%show( varMerged )
269 call disp%show("call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))")
270 call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
271 call disp%show("mean(2)")
272 call disp%show( mean(2) )
273 call disp%show("mean(0) ! reference")
274 call disp%show( mean(0) )
275 call disp%show("var(2)")
276 call disp%show( var(2) )
277 call disp%show("var(0) ! reference")
278 call disp%show( var(0) )
279 call disp%skip()
280 end do
281 end block
282
283 call disp%skip()
284 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
285 call disp%show("!Compute the biased merged variance and mean of a reliability weighted univariate sample.")
286 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
287 call disp%skip()
288
289 block
290 real(TKG) :: mean(0:nsam), meanMerged
291 real(TKG), allocatable :: sample(:)
292 real(TKG), allocatable :: rweight(:)
293 real(TKG) :: var(0:nsam), varMerged
294 do itry = 1, ntry
295 call disp%skip()
296 call disp%show("lb(1) = 1; ub(1) = getUnifRand(2, 7)")
297 lb(1) = 1; ub(1) = getUnifRand(2, 7)
298 call disp%show("do isam = 2, nsam")
299 call disp%show(" lb(isam) = ub(isam - 1) + 1")
300 call disp%show(" ub(isam) = ub(isam - 1) + getUnifRand(2, 7)")
301 call disp%show("end do")
302 do isam = 2, nsam
303 lb(isam) = ub(isam - 1) + 1
304 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
305 end do
306 call disp%show("lb")
307 call disp%show( lb )
308 call disp%show("ub")
309 call disp%show( ub )
310 call disp%show("sample = getUnifRand(0., 1., ub(nsam))")
311 sample = getUnifRand(0., 1., ub(nsam))
312 call disp%show("sample")
313 call disp%show( sample )
314 call disp%show("rweight = getUnifRand(1., 2., size(sample, 1, IK))")
315 rweight = getUnifRand(1., 2., size(sample, 1, IK))
316 call disp%show("rweight")
317 call disp%show( rweight )
318 call disp%show("mean(0) = getMean(sample, rweight)")
319 mean(0) = getMean(sample, rweight)
320 call disp%show("mean(0) ! reference")
321 call disp%show( mean(0) )
322 call disp%show("var(0) = getVar(sample, rweight)")
323 var(0) = getVar(sample, rweight)
324 call disp%show("var(0) ! reference")
325 call disp%show( var(0) )
326 call disp%show("do isam = 1, nsam")
327 call disp%show(" var(isam) = getVar(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))")
328 call disp%show(" mean(isam) = getMean(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))")
329 call disp%show("end do")
330 do isam = 1, nsam
331 var(isam) = getVar(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
332 mean(isam) = getMean(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
333 end do
334 call disp%show("call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))")
335 call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
336 call disp%show("meanMerged")
337 call disp%show( meanMerged )
338 call disp%show("varMerged")
339 call disp%show( varMerged )
340 call disp%show("call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))")
341 call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
342 call disp%show("mean(2)")
343 call disp%show( mean(2) )
344 call disp%show("mean(0) ! reference")
345 call disp%show( mean(0) )
346 call disp%show("var(2)")
347 call disp%show( var(2) )
348 call disp%show("var(0) ! reference")
349 call disp%show( var(0) )
350 call disp%skip()
351 end do
352 end block
353
354 block
355 complex(TKG) :: mean(0:nsam), meanMerged
356 complex(TKG), allocatable :: sample(:)
357 real(TKG), allocatable :: rweight(:)
358 real(TKG) :: var(0:nsam), varMerged
359 do itry = 1, ntry
360 call disp%skip()
361 call disp%show("lb(1) = 1; ub(1) = getUnifRand(2, 7)")
362 lb(1) = 1; ub(1) = getUnifRand(2, 7)
363 call disp%show("do isam = 2, nsam")
364 call disp%show(" lb(isam) = ub(isam - 1) + 1")
365 call disp%show(" ub(isam) = ub(isam - 1) + getUnifRand(2, 7)")
366 call disp%show("end do")
367 do isam = 2, nsam
368 lb(isam) = ub(isam - 1) + 1
369 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
370 end do
371 call disp%show("lb")
372 call disp%show( lb )
373 call disp%show("ub")
374 call disp%show( ub )
375 call disp%show("sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)")
376 sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
377 call disp%show("sample")
378 call disp%show( sample )
379 call disp%show("rweight = getUnifRand(1., 2., size(sample, 1, IK))")
380 rweight = getUnifRand(1., 2., size(sample, 1, IK))
381 call disp%show("rweight")
382 call disp%show( rweight )
383 call disp%show("mean(0) = getMean(sample, rweight)")
384 mean(0) = getMean(sample, rweight)
385 call disp%show("mean(0) ! reference")
386 call disp%show( mean(0) )
387 call disp%show("var(0) = getVar(sample, rweight)")
388 var(0) = getVar(sample, rweight)
389 call disp%show("var(0) ! reference")
390 call disp%show( var(0) )
391 call disp%show("do isam = 1, nsam")
392 call disp%show(" var(isam) = getVar(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))")
393 call disp%show(" mean(isam) = getMean(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))")
394 call disp%show("end do")
395 do isam = 1, nsam
396 var(isam) = getVar(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
397 mean(isam) = getMean(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
398 end do
399 call disp%show("call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))")
400 call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
401 call disp%show("meanMerged")
402 call disp%show( meanMerged )
403 call disp%show("varMerged")
404 call disp%show( varMerged )
405 call disp%show("call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))")
406 call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
407 call disp%show("mean(2)")
408 call disp%show( mean(2) )
409 call disp%show("mean(0) ! reference")
410 call disp%show( mean(0) )
411 call disp%show("var(2)")
412 call disp%show( var(2) )
413 call disp%show("var(0) ! reference")
414 call disp%show( var(0) )
415 call disp%skip()
416 end do
417 end block
418
419 call disp%skip()
420 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
421 call disp%show("!Compute the biased merged variance and mean of a multivariate sample.")
422 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
423 call disp%skip()
424
425 block
426 real(TKG), allocatable :: sample(:,:)
427 real(TKG), allocatable :: mean(:,:), meanMerged(:)
428 real(TKG), allocatable :: var(:,:), varMerged(:)
429 do itry = 1, ntry
430 call disp%skip()
431 call disp%show("dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)")
432 dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
433 call disp%show("do isam = 2, nsam")
434 call disp%show(" lb(isam) = ub(isam - 1) + 1")
435 call disp%show(" ub(isam) = ub(isam - 1) + getUnifRand(2, 7)")
436 call disp%show("end do")
437 do isam = 2, nsam
438 lb(isam) = ub(isam - 1) + 1
439 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
440 end do
441 call disp%show("lb")
442 call disp%show( lb )
443 call disp%show("ub")
444 call disp%show( ub )
445 call disp%show("ndim = getUnifRand(1, minval(ub - lb + 1, 1))")
446 ndim = getUnifRand(1, minval(ub - lb + 1, 1))
447 call disp%show("call setRebound(var, [1_IK, 0_IK], [ndim, nsam])")
448 call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
449 call disp%show("call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])")
450 call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
451 call disp%show("call setResized(meanMerged, ndim)")
452 call setResized(meanMerged, ndim)
453 call disp%show("call setResized(varMerged, ndim)")
454 call setResized(varMerged, ndim)
455 call disp%show("sample = getUnifRand(-1., +1., ndim, ub(nsam))")
456 sample = getUnifRand(-1., +1., ndim, ub(nsam))
457 call disp%show("sample")
458 call disp%show( sample )
459 call disp%show("mean(:,0) = getVar(sample, dim)")
460 mean(:,0) = getVar(sample, dim)
461 call disp%show("mean(:,0) ! reference")
462 call disp%show( mean(:,0) )
463 call disp%show("var(:,0) = getVar(sample, dim)")
464 var(:,0) = getVar(sample, dim)
465 call disp%show("var(:,0) ! reference")
466 call disp%show( var(:,0) )
467 call disp%show("do isam = 1, nsam")
468 call disp%show(" var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)")
469 call disp%show(" mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)")
470 call disp%show("end do")
471 do isam = 1, nsam
472 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
473 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
474 end do
475 call disp%show("call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))")
476 call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
477 call disp%show("meanMerged")
478 call disp%show( meanMerged )
479 call disp%show("varMerged")
480 call disp%show( varMerged )
481 call disp%show("call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))")
482 call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
483 call disp%show("mean(:,2)")
484 call disp%show( mean(:,2) )
485 call disp%show("mean(:,0) ! reference")
486 call disp%show( mean(:,0) )
487 call disp%show("var(:,2)")
488 call disp%show( var(:,2) )
489 call disp%show("var(:,0) ! reference")
490 call disp%show( var(:,0) )
491 call disp%skip()
492 end do
493 end block
494
495 block
496 complex(TKG), allocatable :: sample(:,:)
497 complex(TKG), allocatable :: mean(:,:), meanMerged(:)
498 real(TKG), allocatable :: var(:,:), varMerged(:)
499 do itry = 1, ntry
500 call disp%skip()
501 call disp%show("dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)")
502 dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
503 call disp%show("do isam = 2, nsam")
504 call disp%show(" lb(isam) = ub(isam - 1) + 1")
505 call disp%show(" ub(isam) = ub(isam - 1) + getUnifRand(2, 7)")
506 call disp%show("end do")
507 do isam = 2, nsam
508 lb(isam) = ub(isam - 1) + 1
509 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
510 end do
511 call disp%show("lb")
512 call disp%show( lb )
513 call disp%show("ub")
514 call disp%show( ub )
515 call disp%show("ndim = getUnifRand(1, minval(ub - lb + 1, 1))")
516 ndim = getUnifRand(1, minval(ub - lb + 1, 1))
517 call disp%show("call setRebound(var, [1_IK, 0_IK], [ndim, nsam])")
518 call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
519 call disp%show("call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])")
520 call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
521 call disp%show("call setResized(meanMerged, ndim)")
522 call setResized(meanMerged, ndim)
523 call disp%show("call setResized(varMerged, ndim)")
524 call setResized(varMerged, ndim)
525 call disp%show("sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), -getUnifRand(-1., +1., ndim, ub(nsam)), TKG)")
526 sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), -getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
527 call disp%show("sample")
528 call disp%show( sample )
529 call disp%show("mean(:,0) = getVar(sample, dim)")
530 mean(:,0) = getVar(sample, dim)
531 call disp%show("mean(:,0) ! reference")
532 call disp%show( mean(:,0) )
533 call disp%show("var(:,0) = getVar(sample, dim)")
534 var(:,0) = getVar(sample, dim)
535 call disp%show("var(:,0) ! reference")
536 call disp%show( var(:,0) )
537 call disp%show("do isam = 1, nsam")
538 call disp%show(" var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)")
539 call disp%show(" mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)")
540 call disp%show("end do")
541 do isam = 1, nsam
542 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
543 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
544 end do
545 call disp%show("call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))")
546 call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
547 call disp%show("meanMerged")
548 call disp%show( meanMerged )
549 call disp%show("varMerged")
550 call disp%show( varMerged )
551 call disp%show("call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))")
552 call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
553 call disp%show("mean(:,2)")
554 call disp%show( mean(:,2) )
555 call disp%show("mean(:,0) ! reference")
556 call disp%show( mean(:,0) )
557 call disp%show("var(:,2)")
558 call disp%show( var(:,2) )
559 call disp%show("var(:,0) ! reference")
560 call disp%show( var(:,0) )
561 call disp%skip()
562 end do
563 end block
564
565 call disp%skip()
566 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
567 call disp%show("!Compute the biased merged variance and mean of a frequency weighted multivariate sample.")
568 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
569 call disp%skip()
570
571 block
572 real(TKG), allocatable :: sample(:,:)
573 real(TKG), allocatable :: mean(:,:), meanMerged(:)
574 real(TKG), allocatable :: var(:,:), varMerged(:)
575 do itry = 1, ntry
576 call disp%skip()
577 call disp%show("dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)")
578 dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
579 call disp%show("do isam = 2, nsam")
580 call disp%show(" lb(isam) = ub(isam - 1) + 1")
581 call disp%show(" ub(isam) = ub(isam - 1) + getUnifRand(2, 7)")
582 call disp%show("end do")
583 do isam = 2, nsam
584 lb(isam) = ub(isam - 1) + 1
585 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
586 end do
587 call disp%show("lb")
588 call disp%show( lb )
589 call disp%show("ub")
590 call disp%show( ub )
591 call disp%show("ndim = getUnifRand(1, minval(ub - lb + 1, 1))")
592 ndim = getUnifRand(1, minval(ub - lb + 1, 1))
593 call disp%show("call setRebound(var, [1_IK, 0_IK], [ndim, nsam])")
594 call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
595 call disp%show("call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])")
596 call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
597 call disp%show("call setResized(meanMerged, ndim)")
598 call setResized(meanMerged, ndim)
599 call disp%show("call setResized(varMerged, ndim)")
600 call setResized(varMerged, ndim)
601 call disp%show("sample = getUnifRand(-1., +1., ndim, ub(nsam))")
602 sample = getUnifRand(-1., +1., ndim, ub(nsam))
603 call disp%show("sample")
604 call disp%show( sample )
605 call disp%show("iweight = getUnifRand(1, 10, size(sample, dim, IK))")
606 iweight = getUnifRand(1, 10, size(sample, dim, IK))
607 call disp%show("iweight")
608 call disp%show( iweight )
609 call disp%show("mean(:,0) = getVar(sample, 2_IK, iweight)")
610 mean(:,0) = getVar(sample, 2_IK, iweight)
611 call disp%show("mean(:,0) ! reference")
612 call disp%show( mean(:,0) )
613 call disp%show("var(:,0) = getVar(sample, 2_IK, iweight)")
614 var(:,0) = getVar(sample, 2_IK, iweight)
615 call disp%show("var(:,0) ! reference")
616 call disp%show( var(:,0) )
617 call disp%show("do isam = 1, nsam")
618 call disp%show(" var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))")
619 call disp%show(" mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))")
620 call disp%show("end do")
621 do isam = 1, nsam
622 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
623 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
624 end do
625 call disp%show("call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))")
626 call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
627 call disp%show("meanMerged")
628 call disp%show( meanMerged )
629 call disp%show("varMerged")
630 call disp%show( varMerged )
631 call disp%show("call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))")
632 call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
633 call disp%show("mean(:,2)")
634 call disp%show( mean(:,2) )
635 call disp%show("mean(:,0) ! reference")
636 call disp%show( mean(:,0) )
637 call disp%show("var(:,2)")
638 call disp%show( var(:,2) )
639 call disp%show("var(:,0) ! reference")
640 call disp%show( var(:,0) )
641 call disp%skip()
642 end do
643 end block
644
645 block
646 complex(TKG), allocatable :: sample(:,:)
647 complex(TKG), allocatable :: mean(:,:), meanMerged(:)
648 real(TKG), allocatable :: var(:,:), varMerged(:)
649 do itry = 1, ntry
650 call disp%skip()
651 call disp%show("dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)")
652 dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
653 call disp%show("do isam = 2, nsam")
654 call disp%show(" lb(isam) = ub(isam - 1) + 1")
655 call disp%show(" ub(isam) = ub(isam - 1) + getUnifRand(2, 7)")
656 call disp%show("end do")
657 do isam = 2, nsam
658 lb(isam) = ub(isam - 1) + 1
659 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
660 end do
661 call disp%show("lb")
662 call disp%show( lb )
663 call disp%show("ub")
664 call disp%show( ub )
665 call disp%show("ndim = getUnifRand(1, minval(ub - lb + 1, 1))")
666 ndim = getUnifRand(1, minval(ub - lb + 1, 1))
667 call disp%show("call setRebound(var, [1_IK, 0_IK], [ndim, nsam])")
668 call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
669 call disp%show("call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])")
670 call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
671 call disp%show("call setResized(meanMerged, ndim)")
672 call setResized(meanMerged, ndim)
673 call disp%show("call setResized(varMerged, ndim)")
674 call setResized(varMerged, ndim)
675 call disp%show("sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)")
676 sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
677 call disp%show("sample")
678 call disp%show( sample )
679 call disp%show("iweight = getUnifRand(1, 10, size(sample, dim, IK))")
680 iweight = getUnifRand(1, 10, size(sample, dim, IK))
681 call disp%show("iweight")
682 call disp%show( iweight )
683 call disp%show("mean(:,0) = getVar(sample, 2_IK, iweight)")
684 mean(:,0) = getVar(sample, 2_IK, iweight)
685 call disp%show("mean(:,0) ! reference")
686 call disp%show( mean(:,0) )
687 call disp%show("var(:,0) = getVar(sample, 2_IK, iweight)")
688 var(:,0) = getVar(sample, 2_IK, iweight)
689 call disp%show("var(:,0) ! reference")
690 call disp%show( var(:,0) )
691 call disp%show("do isam = 1, nsam")
692 call disp%show(" var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))")
693 call disp%show(" mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))")
694 call disp%show("end do")
695 do isam = 1, nsam
696 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
697 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
698 end do
699 call disp%show("call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))")
700 call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
701 call disp%show("meanMerged")
702 call disp%show( meanMerged )
703 call disp%show("varMerged")
704 call disp%show( varMerged )
705 call disp%show("call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))")
706 call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
707 call disp%show("mean(:,2)")
708 call disp%show( mean(:,2) )
709 call disp%show("mean(:,0) ! reference")
710 call disp%show( mean(:,0) )
711 call disp%show("var(:,2)")
712 call disp%show( var(:,2) )
713 call disp%show("var(:,0) ! reference")
714 call disp%show( var(:,0) )
715 call disp%skip()
716 end do
717 end block
718
719 call disp%skip()
720 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
721 call disp%show("!Compute the biased merged variance and mean of a reliability weighted multivariate sample.")
722 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
723 call disp%skip()
724
725 block
726 real(TKG), allocatable :: sample(:,:)
727 real(TKG), allocatable :: mean(:,:), meanMerged(:)
728 real(TKG), allocatable :: var(:,:), varMerged(:)
729 real(TKG), allocatable :: rweight(:)
730 do itry = 1, ntry
731 call disp%skip()
732 call disp%show("dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)")
733 dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
734 call disp%show("do isam = 2, nsam")
735 call disp%show(" lb(isam) = ub(isam - 1) + 1")
736 call disp%show(" ub(isam) = ub(isam - 1) + getUnifRand(2, 7)")
737 call disp%show("end do")
738 do isam = 2, nsam
739 lb(isam) = ub(isam - 1) + 1
740 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
741 end do
742 call disp%show("lb")
743 call disp%show( lb )
744 call disp%show("ub")
745 call disp%show( ub )
746 call disp%show("ndim = getUnifRand(1, minval(ub - lb + 1, 1))")
747 ndim = getUnifRand(1, minval(ub - lb + 1, 1))
748 call disp%show("call setRebound(var, [1_IK, 0_IK], [ndim, nsam])")
749 call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
750 call disp%show("call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])")
751 call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
752 call disp%show("call setResized(meanMerged, ndim)")
753 call setResized(meanMerged, ndim)
754 call disp%show("call setResized(varMerged, ndim)")
755 call setResized(varMerged, ndim)
756 call disp%show("sample = getUnifRand(-1., +1., ndim, ub(nsam))")
757 sample = getUnifRand(-1., +1., ndim, ub(nsam))
758 call disp%show("sample")
759 call disp%show( sample )
760 call disp%show("rweight = getUnifRand(1., 2., size(sample, dim, IK))")
761 rweight = getUnifRand(1., 2., size(sample, dim, IK))
762 call disp%show("rweight")
763 call disp%show( rweight )
764 call disp%show("mean(:,0) = getVar(sample, 2_IK, rweight)")
765 mean(:,0) = getVar(sample, 2_IK, rweight)
766 call disp%show("mean(:,0) ! reference")
767 call disp%show( mean(:,0) )
768 call disp%show("var(:,0) = getVar(sample, 2_IK, rweight)")
769 var(:,0) = getVar(sample, 2_IK, rweight)
770 call disp%show("var(:,0) ! reference")
771 call disp%show( var(:,0) )
772 call disp%show("do isam = 1, nsam")
773 call disp%show(" var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))")
774 call disp%show(" mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))")
775 call disp%show("end do")
776 do isam = 1, nsam
777 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
778 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
779 end do
780 call disp%show("call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))")
781 call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
782 call disp%show("meanMerged")
783 call disp%show( meanMerged )
784 call disp%show("varMerged")
785 call disp%show( varMerged )
786 call disp%show("call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))")
787 call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
788 call disp%show("mean(:,2)")
789 call disp%show( mean(:,2) )
790 call disp%show("mean(:,0) ! reference")
791 call disp%show( mean(:,0) )
792 call disp%show("var(:,2)")
793 call disp%show( var(:,2) )
794 call disp%show("var(:,0) ! reference")
795 call disp%show( var(:,0) )
796 call disp%skip()
797 end do
798 end block
799
800 block
801 complex(TKG), allocatable :: sample(:,:)
802 complex(TKG), allocatable :: mean(:,:), meanMerged(:)
803 real(TKG), allocatable :: var(:,:), varMerged(:)
804 real(TKG), allocatable :: rweight(:)
805 do itry = 1, ntry
806 call disp%skip()
807 call disp%show("dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)")
808 dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
809 call disp%show("do isam = 2, nsam")
810 call disp%show(" lb(isam) = ub(isam - 1) + 1")
811 call disp%show(" ub(isam) = ub(isam - 1) + getUnifRand(2, 7)")
812 call disp%show("end do")
813 do isam = 2, nsam
814 lb(isam) = ub(isam - 1) + 1
815 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
816 end do
817 call disp%show("lb")
818 call disp%show( lb )
819 call disp%show("ub")
820 call disp%show( ub )
821 call disp%show("ndim = getUnifRand(1, minval(ub - lb + 1, 1))")
822 ndim = getUnifRand(1, minval(ub - lb + 1, 1))
823 call disp%show("call setRebound(var, [1_IK, 0_IK], [ndim, nsam])")
824 call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
825 call disp%show("call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])")
826 call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
827 call disp%show("call setResized(meanMerged, ndim)")
828 call setResized(meanMerged, ndim)
829 call disp%show("call setResized(varMerged, ndim)")
830 call setResized(varMerged, ndim)
831 call disp%show("sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)")
832 sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
833 call disp%show("sample")
834 call disp%show( sample )
835 call disp%show("rweight = getUnifRand(1., 2., size(sample, dim, IK))")
836 rweight = getUnifRand(1., 2., size(sample, dim, IK))
837 call disp%show("rweight")
838 call disp%show( rweight )
839 call disp%show("mean(:,0) = getVar(sample, 2_IK, rweight)")
840 mean(:,0) = getVar(sample, 2_IK, rweight)
841 call disp%show("mean(:,0) ! reference")
842 call disp%show( mean(:,0) )
843 call disp%show("var(:,0) = getVar(sample, 2_IK, rweight)")
844 var(:,0) = getVar(sample, 2_IK, rweight)
845 call disp%show("var(:,0) ! reference")
846 call disp%show( var(:,0) )
847 call disp%show("do isam = 1, nsam")
848 call disp%show(" var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))")
849 call disp%show(" mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))")
850 call disp%show("end do")
851 do isam = 1, nsam
852 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
853 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
854 end do
855 call disp%show("call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))")
856 call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
857 call disp%show("meanMerged")
858 call disp%show( meanMerged )
859 call disp%show("varMerged")
860 call disp%show( varMerged )
861 call disp%show("call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))")
862 call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
863 call disp%show("mean(:,2)")
864 call disp%show( mean(:,2) )
865 call disp%show("mean(:,0) ! reference")
866 call disp%show( mean(:,0) )
867 call disp%show("var(:,2)")
868 call disp%show( var(:,2) )
869 call disp%show("var(:,0) ! reference")
870 call disp%show( var(:,0) )
871 call disp%skip()
872 end do
873 end block
874
875end program example
Generate minimally-spaced character, integer, real sequences or sequences at fixed intervals of size ...
Resize (shrink or expand) an input allocatable array of rank 1..3 to arbitrary new lower and upper bo...
Allocate or resize (shrink or expand) an input allocatable scalar string or array of rank 1....
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.
Definition: pm_io.F90:11726
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11508
Generate and return the (weighted) mean of an input sample of nsam observations with ndim = 1 or 2 at...
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 generating ranges of discrete character,...
This module contains procedures and generic interfaces for resizing allocatable arrays of various typ...
This module contains procedures and generic interfaces for resizing allocatable arrays of various typ...
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...
Definition: pm_io.F90:252
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
Definition: pm_io.F90:11393
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
Definition: pm_kind.F90:268
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
Definition: pm_kind.F90:540
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
Definition: pm_kind.F90:539
integer, parameter RKS
The single-precision real kind in Fortran mode. On most platforms, this is an 32-bit real kind.
Definition: pm_kind.F90:567
This module contains classes and procedures for computing the first moment (i.e., the statistical mea...
Generate and return an object of type display_type.
Definition: pm_io.F90:10282

Example Unix compile command via Intel ifort compiler
1#!/usr/bin/env sh
2rm main.exe
3ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example Windows Batch compile command via Intel ifort compiler
1del main.exe
2set PATH=..\..\..\lib;%PATH%
3ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
4main.exe

Example Unix / MinGW compile command via GNU gfortran compiler
1#!/usr/bin/env sh
2rm main.exe
3gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example output
1
2!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3!Compute the biased merged variance and mean of a univariate sample.
4!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5
6
7lb(1) = 1; ub(1) = getUnifRand(2, 7)
8do isam = 2, nsam
9 lb(isam) = ub(isam - 1) + 1
10 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
11end do
12lb
13+1, +6
14ub
15+5, +11
16sample = getUnifRand(0., 1., ub(nsam))
17sample
18+0.119940042E-1, +0.656136096, +0.920551598, +0.100176871, +0.860603511, +0.201040685, +0.459808290, +0.532367587, +0.672253072, +0.793510675E-2, +0.413463652
19mean(0) = getMean(sample)
20mean(0) ! reference
21+0.439666390
22var(0) = getVar(sample)
23var(0) ! reference
24+0.964155421E-1
25do isam = 1, nsam
26 var(isam) = getVar(sample(lb(isam):ub(isam)))
27 mean(isam) = getMean(sample(lb(isam):ub(isam)))
28end do
29call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
30meanMerged
31+0.439666390
32varMerged
33+0.964155570E-1
34call setVarMeanMerged(var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
35mean(2)
36+0.439666390
37mean(0) ! reference
38+0.439666390
39var(2)
40+0.964155570E-1
41var(0) ! reference
42+0.964155421E-1
43
44
45lb(1) = 1; ub(1) = getUnifRand(2, 7)
46do isam = 2, nsam
47 lb(isam) = ub(isam - 1) + 1
48 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
49end do
50lb
51+1, +6
52ub
53+5, +11
54sample = getUnifRand(0., 1., ub(nsam))
55sample
56+0.883841753, +0.354862809E-1, +0.707520783, +0.353002489, +0.971128941E-1, +0.679025769, +0.887165725, +0.346522450, +0.944431603, +0.259654522E-1, +0.854691327
57mean(0) = getMean(sample)
58mean(0) ! reference
59+0.528615177
60var(0) = getVar(sample)
61var(0) ! reference
62+0.121329874
63do isam = 1, nsam
64 var(isam) = getVar(sample(lb(isam):ub(isam)))
65 mean(isam) = getMean(sample(lb(isam):ub(isam)))
66end do
67call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
68meanMerged
69+0.528615117
70varMerged
71+0.121329874
72call setVarMeanMerged(var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
73mean(2)
74+0.528615117
75mean(0) ! reference
76+0.528615177
77var(2)
78+0.121329874
79var(0) ! reference
80+0.121329874
81
82
83lb(1) = 1; ub(1) = getUnifRand(2, 7)
84do isam = 2, nsam
85 lb(isam) = ub(isam - 1) + 1
86 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
87end do
88lb
89+1, +7
90ub
91+6, +10
92sample = getUnifRand(0., 1., ub(nsam))
93sample
94+0.133238673, +0.704561889, +0.235955894, +0.434056163, +0.439929366, +0.597409070, +0.800524533, +0.882233262, +0.512249291, +0.932722628
95mean(0) = getMean(sample)
96mean(0) ! reference
97+0.567288041
98var(0) = getVar(sample)
99var(0) ! reference
100+0.642063692E-1
101do isam = 1, nsam
102 var(isam) = getVar(sample(lb(isam):ub(isam)))
103 mean(isam) = getMean(sample(lb(isam):ub(isam)))
104end do
105call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
106meanMerged
107+0.567288041
108varMerged
109+0.642063618E-1
110call setVarMeanMerged(var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
111mean(2)
112+0.567288041
113mean(0) ! reference
114+0.567288041
115var(2)
116+0.642063618E-1
117var(0) ! reference
118+0.642063692E-1
119
120
121lb(1) = 1; ub(1) = getUnifRand(2, 7)
122do isam = 2, nsam
123 lb(isam) = ub(isam - 1) + 1
124 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
125end do
126lb
127+1, +4
128ub
129+3, +10
130sample = getUnifRand(0., 1., ub(nsam))
131sample
132+0.311637640, +0.286906958, +0.195507348, +0.811418474, +0.552980423, +0.104915917, +0.750227213, +0.781923532E-1, +0.117942452, +0.849288762
133mean(0) = getMean(sample)
134mean(0) ! reference
135+0.405901760
136var(0) = getVar(sample)
137var(0) ! reference
138+0.849445760E-1
139do isam = 1, nsam
140 var(isam) = getVar(sample(lb(isam):ub(isam)))
141 mean(isam) = getMean(sample(lb(isam):ub(isam)))
142end do
143call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
144meanMerged
145+0.405901730
146varMerged
147+0.849445686E-1
148call setVarMeanMerged(var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
149mean(2)
150+0.405901730
151mean(0) ! reference
152+0.405901760
153var(2)
154+0.849445686E-1
155var(0) ! reference
156+0.849445760E-1
157
158
159lb(1) = 1; ub(1) = getUnifRand(2, 7)
160do isam = 2, nsam
161 lb(isam) = ub(isam - 1) + 1
162 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
163end do
164lb
165+1, +4
166ub
167+3, +8
168sample = getUnifRand(0., 1., ub(nsam))
169sample
170+0.769666314, +0.289621472, +0.782481730, +0.229598761, +0.572728693, +0.294855356, +0.365101993, +0.518420577
171mean(0) = getMean(sample)
172mean(0) ! reference
173+0.477809370
174var(0) = getVar(sample)
175var(0) ! reference
176+0.414828733E-1
177do isam = 1, nsam
178 var(isam) = getVar(sample(lb(isam):ub(isam)))
179 mean(isam) = getMean(sample(lb(isam):ub(isam)))
180end do
181call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
182meanMerged
183+0.477809370
184varMerged
185+0.414828695E-1
186call setVarMeanMerged(var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
187mean(2)
188+0.477809370
189mean(0) ! reference
190+0.477809370
191var(2)
192+0.414828695E-1
193var(0) ! reference
194+0.414828733E-1
195
196
197lb(1) = 1; ub(1) = getUnifRand(2, 7)
198do isam = 2, nsam
199 lb(isam) = ub(isam - 1) + 1
200 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
201end do
202lb
203+1, +8
204ub
205+7, +9
206sample = cmplx(getUnifRand(-1., +1., ub(nsam)), getUnifRand(-1., +1., ub(nsam)), TKG)
207sample
208(-0.385736227E-1, -0.971312165), (-0.164464593, +0.457289696), (-0.552359462, -0.583754778), (-0.244892836E-1, -0.118603349), (+0.934637308, +0.229700208), (-0.168417931, +0.209864140), (-0.785303235, -0.622492790), (-0.141442776, -0.474508405), (+0.145599246, +0.854253769E-3)
209mean(0) = getMean(sample)
210mean(0) ! reference
211(-0.883127078E-1, -0.208107024)
212var(0) = getVar(sample)
213var(0) ! reference
214+0.405660570
215do isam = 1, nsam
216 var(isam) = getVar(sample(lb(isam):ub(isam)))
217 mean(isam) = getMean(sample(lb(isam):ub(isam)))
218end do
219call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
220meanMerged
221(-0.883127004E-1, -0.208107024)
222varMerged
223+0.405660570
224call setVarMeanMerged(var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
225mean(2)
226(-0.883127004E-1, -0.208107024)
227mean(0) ! reference
228(-0.883127078E-1, -0.208107024)
229var(2)
230+0.405660570
231var(0) ! reference
232+0.405660570
233
234
235lb(1) = 1; ub(1) = getUnifRand(2, 7)
236do isam = 2, nsam
237 lb(isam) = ub(isam - 1) + 1
238 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
239end do
240lb
241+1, +7
242ub
243+6, +12
244sample = cmplx(getUnifRand(-1., +1., ub(nsam)), getUnifRand(-1., +1., ub(nsam)), TKG)
245sample
246(-0.645243645, +0.117631197), (-0.365102530, -0.439955711), (+0.737687469, +0.750073314), (-0.790288687, -0.346800208), (-0.858775258, -0.964322329), (+0.373319030, +0.493835330), (+0.363248467, -0.768578768), (-0.687694550, -0.548529267), (+0.472329974, +0.716293812), (-0.322200656, +0.764347076), (-0.346867085, +0.717595339), (+0.556713343, -0.145169020)
247mean(0) = getMean(sample)
248mean(0) ! reference
249(-0.126072839, +0.288683977E-1)
250var(0) = getVar(sample)
251var(0) ! reference
252+0.695460260
253do isam = 1, nsam
254 var(isam) = getVar(sample(lb(isam):ub(isam)))
255 mean(isam) = getMean(sample(lb(isam):ub(isam)))
256end do
257call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
258meanMerged
259(-0.126072854, +0.288683958E-1)
260varMerged
261+0.695460320
262call setVarMeanMerged(var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
263mean(2)
264(-0.126072854, +0.288683958E-1)
265mean(0) ! reference
266(-0.126072839, +0.288683977E-1)
267var(2)
268+0.695460320
269var(0) ! reference
270+0.695460260
271
272
273lb(1) = 1; ub(1) = getUnifRand(2, 7)
274do isam = 2, nsam
275 lb(isam) = ub(isam - 1) + 1
276 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
277end do
278lb
279+1, +4
280ub
281+3, +6
282sample = cmplx(getUnifRand(-1., +1., ub(nsam)), getUnifRand(-1., +1., ub(nsam)), TKG)
283sample
284(-0.463739991, -0.740990281), (-0.887680292, +0.577617884E-1), (-0.696246147, -0.493150949), (+0.914370537, +0.327253819), (-0.237545729, -0.638078570), (+0.699199677, -0.951303482)
285mean(0) = getMean(sample)
286mean(0) ! reference
287(-0.111940347, -0.406417936)
288var(0) = getVar(sample)
289var(0) ! reference
290+0.669625461
291do isam = 1, nsam
292 var(isam) = getVar(sample(lb(isam):ub(isam)))
293 mean(isam) = getMean(sample(lb(isam):ub(isam)))
294end do
295call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
296meanMerged
297(-0.111940339, -0.406417936)
298varMerged
299+0.669625461
300call setVarMeanMerged(var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
301mean(2)
302(-0.111940339, -0.406417936)
303mean(0) ! reference
304(-0.111940347, -0.406417936)
305var(2)
306+0.669625461
307var(0) ! reference
308+0.669625461
309
310
311lb(1) = 1; ub(1) = getUnifRand(2, 7)
312do isam = 2, nsam
313 lb(isam) = ub(isam - 1) + 1
314 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
315end do
316lb
317+1, +6
318ub
319+5, +10
320sample = cmplx(getUnifRand(-1., +1., ub(nsam)), getUnifRand(-1., +1., ub(nsam)), TKG)
321sample
322(+0.271996379, -0.778391004), (+0.362214565, -0.723257422), (-0.615412474, -0.175877213), (-0.438934922, -0.869427085), (-0.199115157, -0.280784488), (-0.546283126, -0.614637136E-1), (-0.222089887, +0.420297980), (-0.617734909, +0.170706987), (-0.783601522, -0.256677985), (-0.881325006E-1, -0.971402764)
323mean(0) = getMean(sample)
324mean(0) ! reference
325(-0.287709385, -0.352627665)
326var(0) = getVar(sample)
327var(0) ! reference
328+0.330988526
329do isam = 1, nsam
330 var(isam) = getVar(sample(lb(isam):ub(isam)))
331 mean(isam) = getMean(sample(lb(isam):ub(isam)))
332end do
333call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
334meanMerged
335(-0.287709385, -0.352627695)
336varMerged
337+0.330988556
338call setVarMeanMerged(var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
339mean(2)
340(-0.287709385, -0.352627695)
341mean(0) ! reference
342(-0.287709385, -0.352627665)
343var(2)
344+0.330988556
345var(0) ! reference
346+0.330988526
347
348
349lb(1) = 1; ub(1) = getUnifRand(2, 7)
350do isam = 2, nsam
351 lb(isam) = ub(isam - 1) + 1
352 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
353end do
354lb
355+1, +6
356ub
357+5, +7
358sample = cmplx(getUnifRand(-1., +1., ub(nsam)), getUnifRand(-1., +1., ub(nsam)), TKG)
359sample
360(+0.230885625, -0.781304359), (-0.107927680, +0.313308120), (-0.275286317, +0.807674170), (-0.492192030, +0.894426107E-1), (+0.900775075, -0.742510319), (+0.691864014, +0.187800765), (-0.853224277, -0.652338982)
361mean(0) = getMean(sample)
362mean(0) ! reference
363(+0.135563444E-1, -0.111132570)
364var(0) = getVar(sample)
365var(0) ! reference
366+0.670626938
367do isam = 1, nsam
368 var(isam) = getVar(sample(lb(isam):ub(isam)))
369 mean(isam) = getMean(sample(lb(isam):ub(isam)))
370end do
371call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
372meanMerged
373(+0.135563482E-1, -0.111132562)
374varMerged
375+0.670626938
376call setVarMeanMerged(var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
377mean(2)
378(+0.135563482E-1, -0.111132562)
379mean(0) ! reference
380(+0.135563444E-1, -0.111132570)
381var(2)
382+0.670626938
383var(0) ! reference
384+0.670626938
385
386
387!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
388!Compute the biased merged variance and mean of a frequency weighted univariate sample.
389!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
390
391
392lb(1) = 1; ub(1) = getUnifRand(2, 7)
393do isam = 2, nsam
394 lb(isam) = ub(isam - 1) + 1
395 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
396end do
397lb
398+1, +7
399ub
400+6, +10
401sample = getUnifRand(0., 1., ub(nsam))
402sample
403+0.877293646, +0.872215331, +0.125901878, +0.301837325, +0.908573806, +0.414544940, +0.434481144, +0.148264587, +0.611916482, +0.848079145
404iweight = getUnifRand(1, 10, size(sample, 1, IK))
405iweight
406+3, +1, +5, +3, +7, +9, +4, +3, +6, +7
407mean(0) = getMean(sample, iweight)
408mean(0) ! reference
409+0.560850203
410var(0) = getVar(sample, iweight)
411var(0) ! reference
412+0.781511888E-1
413do isam = 1, nsam
414 var(isam) = getVar(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
415 mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
416end do
417call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
418meanMerged
419+0.560850143
420varMerged
421+0.781511888E-1
422call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
423mean(2)
424+0.560850143
425mean(0) ! reference
426+0.560850203
427var(2)
428+0.781511888E-1
429var(0) ! reference
430+0.781511888E-1
431
432
433lb(1) = 1; ub(1) = getUnifRand(2, 7)
434do isam = 2, nsam
435 lb(isam) = ub(isam - 1) + 1
436 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
437end do
438lb
439+1, +3
440ub
441+2, +8
442sample = getUnifRand(0., 1., ub(nsam))
443sample
444+0.700306714, +0.292092562, +0.974595904, +0.867057383, +0.441709697, +0.668324947, +0.509613633, +0.879361153
445iweight = getUnifRand(1, 10, size(sample, 1, IK))
446iweight
447+2, +5, +8, +1, +10, +7, +1, +4
448mean(0) = getMean(sample, iweight)
449mean(0) ! reference
450+0.648613989
451var(0) = getVar(sample, iweight)
452var(0) ! reference
453+0.579427592E-1
454do isam = 1, nsam
455 var(isam) = getVar(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
456 mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
457end do
458call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
459meanMerged
460+0.648613930
461varMerged
462+0.579427555E-1
463call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
464mean(2)
465+0.648613930
466mean(0) ! reference
467+0.648613989
468var(2)
469+0.579427555E-1
470var(0) ! reference
471+0.579427592E-1
472
473
474lb(1) = 1; ub(1) = getUnifRand(2, 7)
475do isam = 2, nsam
476 lb(isam) = ub(isam - 1) + 1
477 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
478end do
479lb
480+1, +8
481ub
482+7, +14
483sample = getUnifRand(0., 1., ub(nsam))
484sample
485+0.958505034, +0.345331252, +0.319890797, +0.160288930, +0.762265980, +0.535349429, +0.990700126E-1, +0.201173484, +0.212709844, +0.776189625, +0.778449178, +0.504525006, +0.270502448, +0.664611638
486iweight = getUnifRand(1, 10, size(sample, 1, IK))
487iweight
488+1, +8, +4, +4, +3, +9, +6, +8, +6, +8, +5, +3, +2, +2
489mean(0) = getMean(sample, iweight)
490mean(0) ! reference
491+0.430615187
492var(0) = getVar(sample, iweight)
493var(0) ! reference
494+0.610139407E-1
495do isam = 1, nsam
496 var(isam) = getVar(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
497 mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
498end do
499call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
500meanMerged
501+0.430615187
502varMerged
503+0.610139370E-1
504call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
505mean(2)
506+0.430615187
507mean(0) ! reference
508+0.430615187
509var(2)
510+0.610139370E-1
511var(0) ! reference
512+0.610139407E-1
513
514
515lb(1) = 1; ub(1) = getUnifRand(2, 7)
516do isam = 2, nsam
517 lb(isam) = ub(isam - 1) + 1
518 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
519end do
520lb
521+1, +7
522ub
523+6, +12
524sample = getUnifRand(0., 1., ub(nsam))
525sample
526+0.812932909, +0.840605795, +0.753042042, +0.138438940, +0.214533925, +0.625773966, +0.594727159, +0.524592102, +0.151322603, +0.410685182, +0.898426771E-1, +0.861285269
527iweight = getUnifRand(1, 10, size(sample, 1, IK))
528iweight
529+8, +10, +8, +3, +9, +1, +9, +10, +1, +8, +2, +9
530mean(0) = getMean(sample, iweight)
531mean(0) ! reference
532+0.588106036
533var(0) = getVar(sample, iweight)
534var(0) ! reference
535+0.612193495E-1
536do isam = 1, nsam
537 var(isam) = getVar(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
538 mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
539end do
540call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
541meanMerged
542+0.588106096
543varMerged
544+0.612193495E-1
545call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
546mean(2)
547+0.588106096
548mean(0) ! reference
549+0.588106036
550var(2)
551+0.612193495E-1
552var(0) ! reference
553+0.612193495E-1
554
555
556lb(1) = 1; ub(1) = getUnifRand(2, 7)
557do isam = 2, nsam
558 lb(isam) = ub(isam - 1) + 1
559 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
560end do
561lb
562+1, +7
563ub
564+6, +13
565sample = getUnifRand(0., 1., ub(nsam))
566sample
567+0.450314939, +0.303190827, +0.667677045, +0.492998481, +0.766684115, +0.107900679, +0.386415839, +0.668759227, +0.317474127, +0.284253597, +0.542022586, +0.207650661E-1, +0.941341877
568iweight = getUnifRand(1, 10, size(sample, 1, IK))
569iweight
570+6, +1, +6, +1, +1, +5, +9, +9, +1, +5, +2, +6, +5
571mean(0) = getMean(sample, iweight)
572mean(0) ! reference
573+0.455455989
574var(0) = getVar(sample, iweight)
575var(0) ! reference
576+0.691743791E-1
577do isam = 1, nsam
578 var(isam) = getVar(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
579 mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
580end do
581call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
582meanMerged
583+0.455456018
584varMerged
585+0.691743866E-1
586call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
587mean(2)
588+0.455456018
589mean(0) ! reference
590+0.455455989
591var(2)
592+0.691743866E-1
593var(0) ! reference
594+0.691743791E-1
595
596
597lb(1) = 1; ub(1) = getUnifRand(2, 7)
598do isam = 2, nsam
599 lb(isam) = ub(isam - 1) + 1
600 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
601end do
602lb
603+1, +4
604ub
605+3, +9
606sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
607sample
608(+0.733839154, -0.736027062), (+0.238857985, -0.570147872), (+0.161682308, -0.531322896), (+0.824257672, -0.677505434), (+0.780953765E-1, -0.651413560), (+0.426721990, -0.748082161), (+0.683678210, -0.855036020), (+0.214939833, -0.527190447), (+0.978096664, -0.140259802)
609iweight = getUnifRand(1, 10, size(sample, 1, IK))
610iweight
611+5, +1, +8, +6, +9, +4, +1, +3, +6
612mean(0) = getMean(sample, iweight)
613mean(0) ! reference
614(+0.459392637, -0.574398041)
615var(0) = getVar(sample, iweight)
616var(0) ! reference
617+0.155565634
618do isam = 1, nsam
619 var(isam) = getVar(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
620 mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
621end do
622call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
623meanMerged
624(+0.459392577, -0.574398041)
625varMerged
626+0.155565649
627call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
628mean(2)
629(+0.459392577, -0.574398041)
630mean(0) ! reference
631(+0.459392637, -0.574398041)
632var(2)
633+0.155565649
634var(0) ! reference
635+0.155565634
636
637
638lb(1) = 1; ub(1) = getUnifRand(2, 7)
639do isam = 2, nsam
640 lb(isam) = ub(isam - 1) + 1
641 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
642end do
643lb
644+1, +6
645ub
646+5, +11
647sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
648sample
649(+0.953109980, -0.314150333), (+0.780628860, -0.188690245), (+0.485206187, -0.691465676), (+0.236192822, -0.561198115), (+0.709286392, -0.338161469), (+0.389771342, -0.542102456), (+0.531400800, -0.437221527E-1), (+0.149240315, -0.982882679), (+0.512519538, -0.503458142), (+0.533620477, -0.602279365), (+0.660914183, -0.493254721)
650iweight = getUnifRand(1, 10, size(sample, 1, IK))
651iweight
652+4, +5, +5, +4, +2, +9, +8, +8, +9, +5, +4
653mean(0) = getMean(sample, iweight)
654mean(0) ! reference
655(+0.498134375, -0.495012641)
656var(0) = getVar(sample, iweight)
657var(0) ! reference
658+0.115321882
659do isam = 1, nsam
660 var(isam) = getVar(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
661 mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
662end do
663call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
664meanMerged
665(+0.498134375, -0.495012641)
666varMerged
667+0.115321882
668call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
669mean(2)
670(+0.498134375, -0.495012641)
671mean(0) ! reference
672(+0.498134375, -0.495012641)
673var(2)
674+0.115321882
675var(0) ! reference
676+0.115321882
677
678
679lb(1) = 1; ub(1) = getUnifRand(2, 7)
680do isam = 2, nsam
681 lb(isam) = ub(isam - 1) + 1
682 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
683end do
684lb
685+1, +4
686ub
687+3, +5
688sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
689sample
690(+0.608615577, -0.418816626), (+0.619734049, -0.964758635), (+0.437514067, -0.212158978), (+0.248523414, -0.206597209), (+0.731221914, -0.797430575)
691iweight = getUnifRand(1, 10, size(sample, 1, IK))
692iweight
693+4, +3, +8, +2, +4
694mean(0) = getMean(sample, iweight)
695mean(0) ! reference
696(+0.534081519, -0.469987184)
697var(0) = getVar(sample, iweight)
698var(0) ! reference
699+0.108651198
700do isam = 1, nsam
701 var(isam) = getVar(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
702 mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
703end do
704call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
705meanMerged
706(+0.534081519, -0.469987184)
707varMerged
708+0.108651191
709call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
710mean(2)
711(+0.534081519, -0.469987184)
712mean(0) ! reference
713(+0.534081519, -0.469987184)
714var(2)
715+0.108651191
716var(0) ! reference
717+0.108651198
718
719
720lb(1) = 1; ub(1) = getUnifRand(2, 7)
721do isam = 2, nsam
722 lb(isam) = ub(isam - 1) + 1
723 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
724end do
725lb
726+1, +5
727ub
728+4, +11
729sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
730sample
731(+0.288896084, -0.653880894), (+0.387549162, -0.979286194), (+0.399118066, -0.748419583), (+0.423218250, -0.312043726), (+0.623215854, -0.630982041), (+0.744935870E-1, -0.158288479E-1), (+0.171287358, -0.475338459), (+0.967443705, -0.975493848), (+0.253366828E-1, -0.505101979), (+0.576567054E-1, -0.335952044), (+0.344425440E-2, -0.901057124E-1)
732iweight = getUnifRand(1, 10, size(sample, 1, IK))
733iweight
734+9, +6, +7, +3, +9, +2, +7, +2, +2, +3, +3
735mean(0) = getMean(sample, iweight)
736mean(0) ! reference
737(+0.341785759, -0.588923454)
738var(0) = getVar(sample, iweight)
739var(0) ! reference
740+0.114781953
741do isam = 1, nsam
742 var(isam) = getVar(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
743 mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
744end do
745call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
746meanMerged
747(+0.341785759, -0.588923454)
748varMerged
749+0.114781961
750call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
751mean(2)
752(+0.341785759, -0.588923454)
753mean(0) ! reference
754(+0.341785759, -0.588923454)
755var(2)
756+0.114781961
757var(0) ! reference
758+0.114781953
759
760
761lb(1) = 1; ub(1) = getUnifRand(2, 7)
762do isam = 2, nsam
763 lb(isam) = ub(isam - 1) + 1
764 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
765end do
766lb
767+1, +5
768ub
769+4, +8
770sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
771sample
772(+0.657687306, -0.670729876E-1), (+0.958387852, -0.722694397E-2), (+0.988820493, -0.263041496), (+0.481504560, -0.756367266), (+0.410300493, -0.245879471), (+0.795342386, -0.992211699), (+0.929423094, -0.182306767E-1), (+0.234219849, -0.333952785)
773iweight = getUnifRand(1, 10, size(sample, 1, IK))
774iweight
775+7, +10, +9, +5, +7, +3, +7, +2
776mean(0) = getMean(sample, iweight)
777mean(0) ! reference
778(+0.754542530, -0.243686050)
779var(0) = getVar(sample, iweight)
780var(0) ! reference
781+0.141721100
782do isam = 1, nsam
783 var(isam) = getVar(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
784 mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
785end do
786call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
787meanMerged
788(+0.754542530, -0.243686050)
789varMerged
790+0.141721085
791call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
792mean(2)
793(+0.754542530, -0.243686050)
794mean(0) ! reference
795(+0.754542530, -0.243686050)
796var(2)
797+0.141721085
798var(0) ! reference
799+0.141721100
800
801
802!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
803!Compute the biased merged variance and mean of a reliability weighted univariate sample.
804!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
805
806
807lb(1) = 1; ub(1) = getUnifRand(2, 7)
808do isam = 2, nsam
809 lb(isam) = ub(isam - 1) + 1
810 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
811end do
812lb
813+1, +4
814ub
815+3, +9
816sample = getUnifRand(0., 1., ub(nsam))
817sample
818+0.674505651, +0.884572268E-1, +0.778975904, +0.651336432, +0.980571866, +0.141536474, +0.291891158, +0.321805716, +0.400037169
819rweight = getUnifRand(1., 2., size(sample, 1, IK))
820rweight
821+1.75373650, +1.03356385, +1.52788496, +1.01779795, +1.20727324, +1.60602701, +1.30024660, +1.08889067, +1.73037934
822mean(0) = getMean(sample, rweight)
823mean(0) ! reference
824+0.485963702
825var(0) = getVar(sample, rweight)
826var(0) ! reference
827+0.783992186E-1
828do isam = 1, nsam
829 var(isam) = getVar(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
830 mean(isam) = getMean(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
831end do
832call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
833meanMerged
834+0.485963672
835varMerged
836+0.783992186E-1
837call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
838mean(2)
839+0.485963672
840mean(0) ! reference
841+0.485963702
842var(2)
843+0.783992186E-1
844var(0) ! reference
845+0.783992186E-1
846
847
848lb(1) = 1; ub(1) = getUnifRand(2, 7)
849do isam = 2, nsam
850 lb(isam) = ub(isam - 1) + 1
851 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
852end do
853lb
854+1, +8
855ub
856+7, +11
857sample = getUnifRand(0., 1., ub(nsam))
858sample
859+0.614780426, +0.470804274, +0.192424715, +0.478024364, +0.483757198, +0.961663127E-1, +0.713184476E-1, +0.392000079, +0.621323168, +0.438278556, +0.204148531
860rweight = getUnifRand(1., 2., size(sample, 1, IK))
861rweight
862+1.01158857, +1.01859975, +1.73260868, +1.48818684, +1.35715485, +1.78745222, +1.86245263, +1.75748146, +1.96912062, +1.42044401, +1.42447019
863mean(0) = getMean(sample, rweight)
864mean(0) ! reference
865+0.352549434
866var(0) = getVar(sample, rweight)
867var(0) ! reference
868+0.372329503E-1
869do isam = 1, nsam
870 var(isam) = getVar(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
871 mean(isam) = getMean(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
872end do
873call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
874meanMerged
875+0.352549493
876varMerged
877+0.372329541E-1
878call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
879mean(2)
880+0.352549493
881mean(0) ! reference
882+0.352549434
883var(2)
884+0.372329541E-1
885var(0) ! reference
886+0.372329503E-1
887
888
889lb(1) = 1; ub(1) = getUnifRand(2, 7)
890do isam = 2, nsam
891 lb(isam) = ub(isam - 1) + 1
892 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
893end do
894lb
895+1, +8
896ub
897+7, +12
898sample = getUnifRand(0., 1., ub(nsam))
899sample
900+0.209337831, +0.230150700, +0.859026134, +0.810046315, +0.476253629, +0.970555782, +0.960021973, +0.910234153, +0.870920360, +0.699376225, +0.661750972, +0.782559395
901rweight = getUnifRand(1., 2., size(sample, 1, IK))
902rweight
903+1.94758272, +1.76901412, +1.87601042, +1.63177502, +1.02643919, +1.19849062, +1.03706694, +1.53485990, +1.15975714, +1.80401039, +1.67372990, +1.41304803
904mean(0) = getMean(sample, rweight)
905mean(0) ! reference
906+0.679404914
907var(0) = getVar(sample, rweight)
908var(0) ! reference
909+0.687246174E-1
910do isam = 1, nsam
911 var(isam) = getVar(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
912 mean(isam) = getMean(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
913end do
914call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
915meanMerged
916+0.679404855
917varMerged
918+0.687246174E-1
919call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
920mean(2)
921+0.679404855
922mean(0) ! reference
923+0.679404914
924var(2)
925+0.687246174E-1
926var(0) ! reference
927+0.687246174E-1
928
929
930lb(1) = 1; ub(1) = getUnifRand(2, 7)
931do isam = 2, nsam
932 lb(isam) = ub(isam - 1) + 1
933 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
934end do
935lb
936+1, +8
937ub
938+7, +11
939sample = getUnifRand(0., 1., ub(nsam))
940sample
941+0.331320763E-1, +0.997135401, +0.416052222, +0.908958912E-2, +0.999018729, +0.264216542, +0.818529725E-1, +0.427850306, +0.120869100, +0.107904911, +0.470962107
942rweight = getUnifRand(1., 2., size(sample, 1, IK))
943rweight
944+1.49814856, +1.64824224, +1.89569652, +1.23003721, +1.67444062, +1.46046174, +1.02513421, +1.33302343, +1.79053736, +1.49233651, +1.19293594
945mean(0) = getMean(sample, rweight)
946mean(0) ! reference
947+0.378378689
948var(0) = getVar(sample, rweight)
949var(0) ! reference
950+0.121643074
951do isam = 1, nsam
952 var(isam) = getVar(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
953 mean(isam) = getMean(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
954end do
955call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
956meanMerged
957+0.378378689
958varMerged
959+0.121643081
960call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
961mean(2)
962+0.378378689
963mean(0) ! reference
964+0.378378689
965var(2)
966+0.121643081
967var(0) ! reference
968+0.121643074
969
970
971lb(1) = 1; ub(1) = getUnifRand(2, 7)
972do isam = 2, nsam
973 lb(isam) = ub(isam - 1) + 1
974 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
975end do
976lb
977+1, +8
978ub
979+7, +11
980sample = getUnifRand(0., 1., ub(nsam))
981sample
982+0.479176342, +0.651354790, +0.979081631, +0.643035412, +0.646971166, +0.728912175, +0.733106077, +0.726554751, +0.807007492, +0.740020156, +0.853646338
983rweight = getUnifRand(1., 2., size(sample, 1, IK))
984rweight
985+1.01996756, +1.20847034, +1.86048603, +1.59032822, +1.16948724, +1.67066908, +1.58738041, +1.76641357, +1.98581839, +1.71012497, +1.34003353
986mean(0) = getMean(sample, rweight)
987mean(0) ! reference
988+0.742414117
989var(0) = getVar(sample, rweight)
990var(0) ! reference
991+0.140176918E-1
992do isam = 1, nsam
993 var(isam) = getVar(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
994 mean(isam) = getMean(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
995end do
996call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
997meanMerged
998+0.742414117
999varMerged
1000+0.140176928E-1
1001call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1002mean(2)
1003+0.742414117
1004mean(0) ! reference
1005+0.742414117
1006var(2)
1007+0.140176928E-1
1008var(0) ! reference
1009+0.140176918E-1
1010
1011
1012lb(1) = 1; ub(1) = getUnifRand(2, 7)
1013do isam = 2, nsam
1014 lb(isam) = ub(isam - 1) + 1
1015 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1016end do
1017lb
1018+1, +5
1019ub
1020+4, +6
1021sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
1022sample
1023(+0.689120829, -0.234999061), (+0.402820230, -0.445851266), (+0.928521395, -0.256282091E-1), (+0.458933353, -0.315659881), (+0.141881645, -0.894450724), (+0.667115092, -0.426235199)
1024rweight = getUnifRand(1., 2., size(sample, 1, IK))
1025rweight
1026+1.25882101, +1.01175332, +1.05331218, +1.30983901, +1.80418277, +1.32992387
1027mean(0) = getMean(sample, rweight)
1028mean(0) ! reference
1029(+0.514606774, -0.433581024)
1030var(0) = getVar(sample, rweight)
1031var(0) ! reference
1032+0.147230744
1033do isam = 1, nsam
1034 var(isam) = getVar(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
1035 mean(isam) = getMean(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
1036end do
1037call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1038meanMerged
1039(+0.514606833, -0.433580995)
1040varMerged
1041+0.147230744
1042call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1043mean(2)
1044(+0.514606833, -0.433580995)
1045mean(0) ! reference
1046(+0.514606774, -0.433581024)
1047var(2)
1048+0.147230744
1049var(0) ! reference
1050+0.147230744
1051
1052
1053lb(1) = 1; ub(1) = getUnifRand(2, 7)
1054do isam = 2, nsam
1055 lb(isam) = ub(isam - 1) + 1
1056 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1057end do
1058lb
1059+1, +3
1060ub
1061+2, +7
1062sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
1063sample
1064(+0.365207911, -0.388750851), (+0.475437462, -0.850406229), (+0.600203335, -0.738627851), (+0.238107026, -0.970534921), (+0.744269729, -0.638918519), (+0.544522703, -0.445047200), (+0.359141469, -0.507187247)
1065rweight = getUnifRand(1., 2., size(sample, 1, IK))
1066rweight
1067+1.51620340, +1.85358036, +1.72813451, +1.21773052, +1.07183599, +1.50133920, +1.03417802
1068mean(0) = getMean(sample, rweight)
1069mean(0) ! reference
1070(+0.478568673, -0.655197263)
1071var(0) = getVar(sample, rweight)
1072var(0) ! reference
1073+0.617823415E-1
1074do isam = 1, nsam
1075 var(isam) = getVar(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
1076 mean(isam) = getMean(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
1077end do
1078call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1079meanMerged
1080(+0.478568703, -0.655197382)
1081varMerged
1082+0.617823526E-1
1083call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1084mean(2)
1085(+0.478568703, -0.655197382)
1086mean(0) ! reference
1087(+0.478568673, -0.655197263)
1088var(2)
1089+0.617823526E-1
1090var(0) ! reference
1091+0.617823415E-1
1092
1093
1094lb(1) = 1; ub(1) = getUnifRand(2, 7)
1095do isam = 2, nsam
1096 lb(isam) = ub(isam - 1) + 1
1097 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1098end do
1099lb
1100+1, +3
1101ub
1102+2, +4
1103sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
1104sample
1105(+0.739192128, -0.842893600), (+0.557888150E-1, -0.790932655), (+0.493421853, -0.256256402), (+0.133751631E-1, -0.820576131)
1106rweight = getUnifRand(1., 2., size(sample, 1, IK))
1107rweight
1108+1.61477947, +1.66125584, +1.36738837, +1.45803833
1109mean(0) = getMean(sample, rweight)
1110mean(0) ! reference
1111(+0.324596375, -0.691942751)
1112var(0) = getVar(sample, rweight)
1113var(0) ! reference
1114+0.149891779
1115do isam = 1, nsam
1116 var(isam) = getVar(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
1117 mean(isam) = getMean(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
1118end do
1119call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1120meanMerged
1121(+0.324596405, -0.691942692)
1122varMerged
1123+0.149891794
1124call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1125mean(2)
1126(+0.324596405, -0.691942692)
1127mean(0) ! reference
1128(+0.324596375, -0.691942751)
1129var(2)
1130+0.149891794
1131var(0) ! reference
1132+0.149891779
1133
1134
1135lb(1) = 1; ub(1) = getUnifRand(2, 7)
1136do isam = 2, nsam
1137 lb(isam) = ub(isam - 1) + 1
1138 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1139end do
1140lb
1141+1, +8
1142ub
1143+7, +9
1144sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
1145sample
1146(+0.778856456, -0.643124104), (+0.929328263, -0.953751445), (+0.306445360, -0.764832199), (+0.653658748, -0.180498183), (+0.167709410, -0.995094776), (+0.274486303, -0.459129333), (+0.697831631, -0.748343527), (+0.999758244, -0.207869589), (+0.638001621, -0.797863543)
1147rweight = getUnifRand(1., 2., size(sample, 1, IK))
1148rweight
1149+1.46506858, +1.14070487, +1.34108961, +1.08089876, +1.27528250, +1.24871540, +1.94184399, +1.76558363, +1.08629298
1150mean(0) = getMean(sample, rweight)
1151mean(0) ! reference
1152(+0.622786820, -0.630207837)
1153var(0) = getVar(sample, rweight)
1154var(0) ! reference
1155+0.153679967
1156do isam = 1, nsam
1157 var(isam) = getVar(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
1158 mean(isam) = getMean(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
1159end do
1160call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1161meanMerged
1162(+0.622786880, -0.630207837)
1163varMerged
1164+0.153679967
1165call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1166mean(2)
1167(+0.622786880, -0.630207837)
1168mean(0) ! reference
1169(+0.622786820, -0.630207837)
1170var(2)
1171+0.153679967
1172var(0) ! reference
1173+0.153679967
1174
1175
1176lb(1) = 1; ub(1) = getUnifRand(2, 7)
1177do isam = 2, nsam
1178 lb(isam) = ub(isam - 1) + 1
1179 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1180end do
1181lb
1182+1, +4
1183ub
1184+3, +10
1185sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
1186sample
1187(+0.498375833, -0.341944516), (+0.785785675, -0.838963985), (+0.803011954, -0.905782282), (+0.308905840, -0.354638219), (+0.672143102, -0.715029776), (+0.299706280, -0.650145113), (+0.229217350, -0.692987084), (+0.968931794, -0.803514123), (+0.308839679E-1, -0.159259737), (+0.426950395, -0.564006925)
1188rweight = getUnifRand(1., 2., size(sample, 1, IK))
1189rweight
1190+1.24266434, +1.08515835, +1.61370671, +1.62555397, +1.66845918, +1.37063169, +1.32197857, +1.62536025, +1.23835897, +1.98431218
1191mean(0) = getMean(sample, rweight)
1192mean(0) ! reference
1193(+0.512009501, -0.608823538)
1194var(0) = getVar(sample, rweight)
1195var(0) ! reference
1196+0.126935750
1197do isam = 1, nsam
1198 var(isam) = getVar(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
1199 mean(isam) = getMean(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
1200end do
1201call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1202meanMerged
1203(+0.512009561, -0.608823657)
1204varMerged
1205+0.126935765
1206call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1207mean(2)
1208(+0.512009561, -0.608823657)
1209mean(0) ! reference
1210(+0.512009501, -0.608823538)
1211var(2)
1212+0.126935765
1213var(0) ! reference
1214+0.126935750
1215
1216
1217!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1218!Compute the biased merged variance and mean of a multivariate sample.
1219!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1220
1221
1222dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1223do isam = 2, nsam
1224 lb(isam) = ub(isam - 1) + 1
1225 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1226end do
1227lb
1228+1, +4
1229ub
1230+3, +7
1231ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1232call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1233call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1234call setResized(meanMerged, ndim)
1235call setResized(varMerged, ndim)
1236sample = getUnifRand(-1., +1., ndim, ub(nsam))
1237sample
1238-0.439300776, -0.947754502, +0.633023024, -0.410256982, +0.196280479E-1, +0.104475260, +0.199488044
1239+0.713191628, -0.763127685, +0.995138764, -0.165531993, +0.520690560, -0.845351934, -0.545616984
1240-0.311024070, +0.587350607, -0.697266936, +0.609308243, +0.846387744, -0.507608891, -0.164826751
1241mean(:,0) = getVar(sample, dim)
1242mean(:,0) ! reference
1243+0.230054438, +0.484424531, +0.325943947
1244var(:,0) = getVar(sample, dim)
1245var(:,0) ! reference
1246+0.230054438, +0.484424531, +0.325943947
1247do isam = 1, nsam
1248 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
1249 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1250end do
1251call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1252meanMerged
1253-0.120099694, -0.129439235E-1, +0.517599843E-1
1254varMerged
1255+0.230054438, +0.484424531, +0.325943947
1256call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1257mean(:,2)
1258-0.120099694, -0.129439235E-1, +0.517599843E-1
1259mean(:,0) ! reference
1260+0.230054438, +0.484424531, +0.325943947
1261var(:,2)
1262+0.230054438, +0.484424531, +0.325943947
1263var(:,0) ! reference
1264+0.230054438, +0.484424531, +0.325943947
1265
1266
1267dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1268do isam = 2, nsam
1269 lb(isam) = ub(isam - 1) + 1
1270 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1271end do
1272lb
1273+1, +8
1274ub
1275+7, +14
1276ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1277call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1278call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1279call setResized(meanMerged, ndim)
1280call setResized(varMerged, ndim)
1281sample = getUnifRand(-1., +1., ndim, ub(nsam))
1282sample
1283-0.320945621, -0.938246965, +0.846944928, +0.792569995, +0.607313871, -0.270295858, +0.727086663, +0.571539164, -0.546037793, +0.907956958, -0.270005107, +0.442611098, +0.785134315, -0.528756261
1284-0.502276540, +0.382720113, -0.453468084, -0.497294307, -0.457640767, +0.142306089, -0.484768867, +0.934381008, +0.372496843, +0.547003627, -0.256724358E-1, +0.137520432, -0.172556996, +0.629006028
1285-0.250745058, +0.875776172, -0.220005393, -0.611425161, -0.606422901, +0.772572875, -0.392596841, +0.325260401, +0.205267668E-1, -0.626538157, -0.697822332, -0.849208832E-1, +0.591000795, +0.219418526
1286-0.803479671, -0.860755444, +0.858319998, -0.183054447, -0.511176705, +0.575032234, +0.788634658, -0.472276092, +0.826205134, +0.577724218, +0.620198846, +0.164198637, +0.447374940, -0.961143017
1287+0.495147109, +0.682114124, +0.967505336, -0.212088943, -0.533003807, -0.331007957, +0.313996315, -0.430609703, -0.972972035, -0.365960240, -0.638307333, +0.685997009E-1, -0.162395000, +0.450876117
1288mean(:,0) = getVar(sample, dim)
1289mean(:,0) ! reference
1290+0.382186949, +0.217904523, +0.266257435, +0.433174640, +0.289978445
1291var(:,0) = getVar(sample, dim)
1292var(:,0) ! reference
1293+0.382186949, +0.217904523, +0.266257435, +0.433174640, +0.289978445
1294do isam = 1, nsam
1295 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
1296 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1297end do
1298call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1299meanMerged
1300+0.200490683, +0.394111574E-1, -0.489943698E-1, +0.761288106E-1, -0.477218777E-1
1301varMerged
1302+0.382186979, +0.217904538, +0.266257405, +0.433174670, +0.289978445
1303call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1304mean(:,2)
1305+0.200490683, +0.394111574E-1, -0.489943698E-1, +0.761288106E-1, -0.477218777E-1
1306mean(:,0) ! reference
1307+0.382186949, +0.217904523, +0.266257435, +0.433174640, +0.289978445
1308var(:,2)
1309+0.382186979, +0.217904538, +0.266257405, +0.433174670, +0.289978445
1310var(:,0) ! reference
1311+0.382186949, +0.217904523, +0.266257435, +0.433174640, +0.289978445
1312
1313
1314dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1315do isam = 2, nsam
1316 lb(isam) = ub(isam - 1) + 1
1317 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1318end do
1319lb
1320+1, +8
1321ub
1322+7, +14
1323ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1324call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1325call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1326call setResized(meanMerged, ndim)
1327call setResized(varMerged, ndim)
1328sample = getUnifRand(-1., +1., ndim, ub(nsam))
1329sample
1330-0.158958673, -0.233285904, +0.215965033, +0.425416350, +0.384628773E-1, +0.931401491, +0.661632657, -0.852002025, -0.514157057, -0.905305386, +0.842246532, +0.581661105, -0.678930759, +0.708365679
1331+0.612628102, -0.732807994, +0.537922740, +0.945479155, -0.975803494, -0.592299104, +0.775635004, -0.655461788, +0.231520295, +0.361016989E-1, +0.717669725E-1, -0.547278643, +0.535398364, -0.925517559
1332-0.776354194, +0.749330759, -0.920078278, +0.378347516, -0.644398093, -0.191198587E-1, -0.209176540E-1, +0.346883535, -0.817781091, -0.427559733, +0.572685242, -0.118050814, +0.513249993, -0.196097612
1333-0.583040833, +0.264287472, +0.673619270, +0.223239183, +0.348567963E-3, +0.741120100, +0.108615398, -0.387412429, +0.531768322, -0.454299450E-1, +0.911919117, -0.243890882, -0.744576693, -0.913441896
1334+0.858712792, +0.453865528E-2, +0.789859772, -0.710540056, +0.407098532, +0.545049787, +0.747678757, +0.262606144E-1, +0.601000190, +0.868038774, +0.895237327, -0.853961110, +0.547324777, -0.596507549
1335+0.960217714, +0.204936266E-1, -0.542162061, +0.990568399, -0.520812154, +0.102156758, -0.196271896, +0.140751600, +0.674492240, -0.441921473, +0.668405175, -0.731903791, -0.227602005, -0.443277359
1336mean(:,0) = getVar(sample, dim)
1337mean(:,0) ! reference
1338+0.382407039, +0.421383917, +0.289260745, +0.297758013, +0.355087638, +0.314566612
1339var(:,0) = getVar(sample, dim)
1340var(:,0) ! reference
1341+0.382407039, +0.421383917, +0.289260745, +0.297758013, +0.355087638, +0.314566612
1342do isam = 1, nsam
1343 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
1344 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1345end do
1346call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1347meanMerged
1348+0.758937150E-1, -0.487654470E-1, -0.985614508E-1, +0.383660495E-1, +0.294985086, +0.323667750E-1
1349varMerged
1350+0.382407039, +0.421383798, +0.289260745, +0.297758013, +0.355087638, +0.314566642
1351call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1352mean(:,2)
1353+0.758937150E-1, -0.487654470E-1, -0.985614508E-1, +0.383660495E-1, +0.294985086, +0.323667750E-1
1354mean(:,0) ! reference
1355+0.382407039, +0.421383917, +0.289260745, +0.297758013, +0.355087638, +0.314566612
1356var(:,2)
1357+0.382407039, +0.421383798, +0.289260745, +0.297758013, +0.355087638, +0.314566642
1358var(:,0) ! reference
1359+0.382407039, +0.421383917, +0.289260745, +0.297758013, +0.355087638, +0.314566612
1360
1361
1362dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1363do isam = 2, nsam
1364 lb(isam) = ub(isam - 1) + 1
1365 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1366end do
1367lb
1368+1, +7
1369ub
1370+6, +9
1371ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1372call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1373call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1374call setResized(meanMerged, ndim)
1375call setResized(varMerged, ndim)
1376sample = getUnifRand(-1., +1., ndim, ub(nsam))
1377sample
1378-0.150514126, +0.711577535, +0.216513395, -0.497512102, -0.351622343, +0.579126358, -0.851261616, -0.146335959, +0.136786580
1379+0.482598782, +0.549315572, +0.190539002, +0.628557324, -0.234736681, +0.438307881, +0.216528893, +0.240388513, -0.900430679E-1
1380mean(:,0) = getVar(sample, dim)
1381mean(:,0) ! reference
1382+0.225925073, +0.749487057E-1
1383var(:,0) = getVar(sample, dim)
1384var(:,0) ! reference
1385+0.225925073, +0.749487057E-1
1386do isam = 1, nsam
1387 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
1388 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1389end do
1390call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1391meanMerged
1392-0.392491333E-1, +0.269050717
1393varMerged
1394+0.225925088, +0.749487132E-1
1395call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1396mean(:,2)
1397-0.392491333E-1, +0.269050717
1398mean(:,0) ! reference
1399+0.225925073, +0.749487057E-1
1400var(:,2)
1401+0.225925088, +0.749487132E-1
1402var(:,0) ! reference
1403+0.225925073, +0.749487057E-1
1404
1405
1406dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1407do isam = 2, nsam
1408 lb(isam) = ub(isam - 1) + 1
1409 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1410end do
1411lb
1412+1, +7
1413ub
1414+6, +12
1415ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1416call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1417call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1418call setResized(meanMerged, ndim)
1419call setResized(varMerged, ndim)
1420sample = getUnifRand(-1., +1., ndim, ub(nsam))
1421sample
1422-0.416686893, +0.125025034, +0.971437693E-1, +0.872558594, -0.932730079, -0.610853791, -0.327465177, +0.807903886, -0.467597485, -0.484535336, -0.489243031, +0.680097699
1423-0.712541223, -0.225304365E-1, -0.437398672, +0.991033673, +0.837484241, -0.442648530, -0.636169076, +0.866333365, -0.572261095, +0.764882565E-1, +0.776366115, +0.119745493
1424-0.567359447, +0.674515128, +0.717805386, -0.231692195, -0.158733845, +0.956128836E-1, +0.611454248, -0.425406694E-1, +0.107408643, +0.727708817, -0.991427898E-1, +0.138234138
1425mean(:,0) = getVar(sample, dim)
1426mean(:,0) ! reference
1427+0.334076822, +0.385443270, +0.166780770
1428var(:,0) = getVar(sample, dim)
1429var(:,0) ! reference
1430+0.334076822, +0.385443270, +0.166780770
1431do isam = 1, nsam
1432 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
1433 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1434end do
1435call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1436meanMerged
1437-0.955319032E-1, +0.703251809E-1, +0.164439201
1438varMerged
1439+0.334076852, +0.385443270, +0.166780785
1440call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1441mean(:,2)
1442-0.955319032E-1, +0.703251809E-1, +0.164439201
1443mean(:,0) ! reference
1444+0.334076822, +0.385443270, +0.166780770
1445var(:,2)
1446+0.334076852, +0.385443270, +0.166780785
1447var(:,0) ! reference
1448+0.334076822, +0.385443270, +0.166780770
1449
1450
1451dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1452do isam = 2, nsam
1453 lb(isam) = ub(isam - 1) + 1
1454 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1455end do
1456lb
1457+1, +6
1458ub
1459+5, +12
1460ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1461call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1462call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1463call setResized(meanMerged, ndim)
1464call setResized(varMerged, ndim)
1465sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), -getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
1466sample
1467(-0.827937245, +0.573437333), (+0.925697446, +0.444543123), (-0.545472503, +0.460077405), (+0.542983532, +0.839096665), (-0.698645949, -0.978960872), (-0.829718947, -0.274715185), (+0.344073534, +0.619020820), (-0.545555353, -0.879950881), (+0.922487855, -0.102486610E-1), (-0.782257557, +0.229459167), (-0.352678061, +0.930501103), (+0.945703983E-1, -0.688433766)
1468(-0.229400754, -0.530421972), (-0.187813878, -0.410598278), (-0.578216076, +0.802461863), (-0.357069135, -0.391425610), (-0.215777159E-1, +0.666727185), (+0.110720992, +0.697784662), (-0.652069211, +0.738842010), (+0.602635145, +0.525061369), (+0.671922803, -0.732921004), (+0.378312230, +0.658055305), (-0.484220505, -0.505790710E-1), (+0.102074623, +0.438763976)
1469(-0.753292322, +0.666397333), (+0.759135485, -0.437500358), (+0.327015281, -0.366309047), (-0.800070524, -0.372627974E-1), (-0.243941903, +0.702132821), (-0.195869327, +0.763610005), (+0.675318122, +0.841464162), (-0.962815523, -0.837390423), (-0.657793403, +0.451066613), (+0.109459758, -0.885191917), (-0.926375985, +0.122865438), (+0.521078110E-1, -0.803279042)
1470(+0.856962085, -0.500666499), (-0.539519429, +0.220919132), (+0.658990622, +0.426123738), (-0.418452263, +0.682990313), (-0.398637891, -0.402785659), (-0.780998707, -0.519223452), (-0.633221865, +0.487448215), (+0.831326365, -0.270884156), (+0.986258864, +0.271868110), (+0.192654490, -0.669101238), (+0.743857861, -0.871444941), (+0.926627398, -0.228209496)
1471(+0.605386257, +0.778706074), (-0.909575820, +0.703624725), (-0.902975798E-1, +0.787807584), (-0.952966690, +0.398319840), (+0.708492041, -0.832051992), (-0.817630649, +0.484323502E-1), (+0.566180348, +0.942621827), (-0.115485191E-1, +0.641840696), (-0.673574328, -0.224295139), (+0.938803673, +0.584035873), (+0.369288564, -0.372304797), (-0.424251437, -0.685607910)
1472mean(:,0) = getVar(sample, dim)
1473mean(:,0) ! reference
1474(+0.830049872, +0.00000000), (+0.486362100, +0.00000000), (+0.750634313, +0.00000000), (+0.691127717, +0.00000000), (+0.787409186, +0.00000000)
1475var(:,0) = getVar(sample, dim)
1476var(:,0) ! reference
1477+0.830049872, +0.486362100, +0.750634313, +0.691127717, +0.787409186
1478do isam = 1, nsam
1479 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
1480 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1481end do
1482call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1483meanMerged
1484(-0.146037757, +0.105318844), (-0.537251234E-1, +0.200979233), (-0.218093559, +0.150502305E-1), (+0.202153966, -0.114413843), (-0.576411784E-1, +0.230927408)
1485varMerged
1486+0.830049813, +0.486362129, +0.750634313, +0.691127717, +0.787409186
1487call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1488mean(:,2)
1489(-0.146037757, +0.105318844), (-0.537251234E-1, +0.200979233), (-0.218093559, +0.150502305E-1), (+0.202153966, -0.114413843), (-0.576411784E-1, +0.230927408)
1490mean(:,0) ! reference
1491(+0.830049872, +0.00000000), (+0.486362100, +0.00000000), (+0.750634313, +0.00000000), (+0.691127717, +0.00000000), (+0.787409186, +0.00000000)
1492var(:,2)
1493+0.830049813, +0.486362129, +0.750634313, +0.691127717, +0.787409186
1494var(:,0) ! reference
1495+0.830049872, +0.486362100, +0.750634313, +0.691127717, +0.787409186
1496
1497
1498dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1499do isam = 2, nsam
1500 lb(isam) = ub(isam - 1) + 1
1501 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1502end do
1503lb
1504+1, +4
1505ub
1506+3, +8
1507ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1508call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1509call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1510call setResized(meanMerged, ndim)
1511call setResized(varMerged, ndim)
1512sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), -getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
1513sample
1514(+0.763936281, -0.335784316), (-0.886662841, -0.659366846), (+0.536572099, -0.479399920), (-0.999518752, +0.110117078), (-0.633312106, +0.477422714), (+0.800188899, +0.630500555), (-0.910677910, +0.722780228), (+0.152210832, -0.267416716)
1515(+0.735235929, +0.807211280), (-0.207703352, -0.672501922), (-0.972353816, +0.939628839), (+0.375396967, -0.284383893), (+0.754493475, -0.344394684), (-0.274041772, +0.834401011), (+0.427717209, -0.783475161), (-0.821393967, +0.604826927)
1516(+0.711423874, -0.476529598), (-0.962325215, +0.443145037), (+0.319249392, -0.112603664), (+0.697380662, -0.562021971), (-0.123974681, +0.795188785), (-0.102982521E-1, +0.909578085), (-0.118997455, +0.215515137), (-0.345981956, -0.839719772E-1)
1517mean(:,0) = getVar(sample, dim)
1518mean(:,0) ! reference
1519(+0.797658920, +0.00000000), (+0.860319376, +0.00000000), (+0.534044802, +0.00000000)
1520var(:,0) = getVar(sample, dim)
1521var(:,0) ! reference
1522+0.797658920, +0.860319376, +0.534044802
1523do isam = 1, nsam
1524 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
1525 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1526end do
1527call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1528meanMerged
1529(-0.147157937, +0.248565972E-1), (+0.216883421E-2, +0.137664050), (+0.208095461E-1, +0.141037494)
1530varMerged
1531+0.797658980, +0.860319436, +0.534044802
1532call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1533mean(:,2)
1534(-0.147157937, +0.248565972E-1), (+0.216883421E-2, +0.137664050), (+0.208095461E-1, +0.141037494)
1535mean(:,0) ! reference
1536(+0.797658920, +0.00000000), (+0.860319376, +0.00000000), (+0.534044802, +0.00000000)
1537var(:,2)
1538+0.797658980, +0.860319436, +0.534044802
1539var(:,0) ! reference
1540+0.797658920, +0.860319376, +0.534044802
1541
1542
1543dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1544do isam = 2, nsam
1545 lb(isam) = ub(isam - 1) + 1
1546 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1547end do
1548lb
1549+1, +3
1550ub
1551+2, +9
1552ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1553call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1554call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1555call setResized(meanMerged, ndim)
1556call setResized(varMerged, ndim)
1557sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), -getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
1558sample
1559(-0.836043477, -0.367998004), (-0.479369164, +0.980343938), (+0.860828400, -0.351111531), (+0.929677367, -0.589284778), (+0.497790575E-1, +0.316970348E-1), (+0.678704977, +0.514211655), (+0.705893397, -0.767410636), (+0.400087714, +0.483188987), (-0.247502208, +0.870597243)
1560(-0.887015700, -0.778934598), (+0.147802830, -0.194910169), (+0.853671670, -0.390640378), (+0.582563281, +0.289507151), (+0.364023924, -0.667358041), (-0.245419741E-1, -0.967603207), (-0.599232554, +0.612211585), (+0.683482051, +0.394176841), (+0.821595907, -0.396433115)
1561mean(:,0) = getVar(sample, dim)
1562mean(:,0) ! reference
1563(+0.731698155, +0.00000000), (+0.616895556, +0.00000000)
1564var(:,0) = getVar(sample, dim)
1565var(:,0) ! reference
1566+0.731698155, +0.616895556
1567do isam = 1, nsam
1568 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
1569 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1570end do
1571call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1572meanMerged
1573(+0.229117364, +0.893593282E-1), (+0.215816647, -0.233331561)
1574varMerged
1575+0.731698155, +0.616895616
1576call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1577mean(:,2)
1578(+0.229117364, +0.893593282E-1), (+0.215816647, -0.233331561)
1579mean(:,0) ! reference
1580(+0.731698155, +0.00000000), (+0.616895556, +0.00000000)
1581var(:,2)
1582+0.731698155, +0.616895616
1583var(:,0) ! reference
1584+0.731698155, +0.616895556
1585
1586
1587dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1588do isam = 2, nsam
1589 lb(isam) = ub(isam - 1) + 1
1590 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1591end do
1592lb
1593+1, +8
1594ub
1595+7, +11
1596ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1597call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1598call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1599call setResized(meanMerged, ndim)
1600call setResized(varMerged, ndim)
1601sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), -getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
1602sample
1603(+0.760060430, -0.140191555), (-0.665151834, +0.211441636), (-0.727792501, -0.572162271), (-0.764912724, -0.163124800E-1), (-0.475780606, +0.635030746), (+0.545262575, -0.845309258), (-0.168730378, +0.390247345), (+0.591508627, -0.761119723), (+0.592610598, -0.199554801), (+0.147854209, -0.260728717), (+0.186126947, -0.711760640)
1604(+0.454974413, +0.391404867), (+0.594176054, -0.802765131), (-0.490337610, +0.853772163), (-0.951193810, +0.395136595), (+0.249110699, +0.922598958), (+0.637888789, -0.498852849), (-0.768915415, +0.138136148E-1), (-0.730981469, +0.457081318), (-0.630509853E-1, +0.943181992), (-0.674258828, +0.958418846), (+0.367269635, -0.575836539)
1605mean(:,0) = getVar(sample, dim)
1606mean(:,0) ! reference
1607(+0.530160487, +0.00000000), (+0.727527142, +0.00000000)
1608var(:,0) = getVar(sample, dim)
1609var(:,0) ! reference
1610+0.530160487, +0.727527142
1611do isam = 1, nsam
1612 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
1613 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1614end do
1615call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1616meanMerged
1617(+0.191412866E-2, -0.206401795), (-0.125028968, +0.277995795)
1618varMerged
1619+0.530160487, +0.727527082
1620call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1621mean(:,2)
1622(+0.191412866E-2, -0.206401795), (-0.125028968, +0.277995795)
1623mean(:,0) ! reference
1624(+0.530160487, +0.00000000), (+0.727527142, +0.00000000)
1625var(:,2)
1626+0.530160487, +0.727527082
1627var(:,0) ! reference
1628+0.530160487, +0.727527142
1629
1630
1631dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1632do isam = 2, nsam
1633 lb(isam) = ub(isam - 1) + 1
1634 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1635end do
1636lb
1637+1, +3
1638ub
1639+2, +9
1640ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1641call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1642call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1643call setResized(meanMerged, ndim)
1644call setResized(varMerged, ndim)
1645sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), -getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
1646sample
1647(-0.785773754, -0.413294792), (-0.858735442, +0.948035359), (-0.114555955, -0.920747757), (+0.371067405, +0.178279400), (+0.198675632, -0.188819528), (+0.416556716, -0.977314234), (-0.810105085, -0.971097708), (-0.300586104, -0.569568872E-1), (+0.851434469, +0.126441717)
1648(-0.859861732, -0.498287916), (-0.979881883, -0.874804974), (+0.447566867, -0.669304371), (+0.958600998, +0.789242983E-1), (-0.479042530, +0.346481204), (+0.685823798, -0.626841903), (+0.925171733, -0.699363351), (+0.122157335, -0.405358434), (-0.935447931, -0.206273317)
1649mean(:,0) = getVar(sample, dim)
1650mean(:,0) ! reference
1651(+0.710976303, +0.00000000), (+0.726188362, +0.00000000)
1652var(:,0) = getVar(sample, dim)
1653var(:,0) ! reference
1654+0.710976303, +0.726188362
1655do isam = 1, nsam
1656 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
1657 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1658end do
1659call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1660meanMerged
1661(-0.114669114, -0.252830505), (-0.127681494E-1, -0.394981027)
1662varMerged
1663+0.710976362, +0.726188302
1664call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1665mean(:,2)
1666(-0.114669114, -0.252830505), (-0.127681494E-1, -0.394981027)
1667mean(:,0) ! reference
1668(+0.710976303, +0.00000000), (+0.726188362, +0.00000000)
1669var(:,2)
1670+0.710976362, +0.726188302
1671var(:,0) ! reference
1672+0.710976303, +0.726188362
1673
1674
1675!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1676!Compute the biased merged variance and mean of a frequency weighted multivariate sample.
1677!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1678
1679
1680dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1681do isam = 2, nsam
1682 lb(isam) = ub(isam - 1) + 1
1683 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1684end do
1685lb
1686+1, +7
1687ub
1688+6, +10
1689ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1690call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1691call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1692call setResized(meanMerged, ndim)
1693call setResized(varMerged, ndim)
1694sample = getUnifRand(-1., +1., ndim, ub(nsam))
1695sample
1696-0.643719077, -0.855207324, +0.450945616, +0.362075090, +0.551812768, -0.690978646, -0.744119763, -0.518817544, +0.198843718, -0.131254196E-1
1697+0.834832788, +0.807408810, -0.139973044, -0.257270098, +0.667196393, +0.625988841, -0.250999451, +0.990952849, -0.267226100, +0.290871620
1698+0.691654921, +0.641442657, -0.802313805, +0.266432524, +0.531755209, -0.415774941, -0.703921318, -0.232786417, +0.812192678, -0.336648345
1699iweight = getUnifRand(1, 10, size(sample, dim, IK))
1700iweight
1701+1, +9, +3, +1, +3, +7, +10, +6, +5, +1
1702mean(:,0) = getVar(sample, 2_IK, iweight)
1703mean(:,0) ! reference
1704+0.243014738, +0.261459768, +0.366754174
1705var(:,0) = getVar(sample, 2_IK, iweight)
1706var(:,0) ! reference
1707+0.243014738, +0.261459768, +0.366754174
1708do isam = 1, nsam
1709 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1710 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1711end do
1712call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1713meanMerged
1714-0.421306401, +0.352136910, -0.370140523E-1
1715varMerged
1716+0.243014738, +0.261459768, +0.366754144
1717call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1718mean(:,2)
1719-0.421306401, +0.352136910, -0.370140523E-1
1720mean(:,0) ! reference
1721+0.243014738, +0.261459768, +0.366754174
1722var(:,2)
1723+0.243014738, +0.261459768, +0.366754144
1724var(:,0) ! reference
1725+0.243014738, +0.261459768, +0.366754174
1726
1727
1728dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1729do isam = 2, nsam
1730 lb(isam) = ub(isam - 1) + 1
1731 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1732end do
1733lb
1734+1, +6
1735ub
1736+5, +7
1737ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1738call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1739call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1740call setResized(meanMerged, ndim)
1741call setResized(varMerged, ndim)
1742sample = getUnifRand(-1., +1., ndim, ub(nsam))
1743sample
1744+0.927004576, -0.853206158, +0.827405572, +0.298742056E-1, +0.560175776, +0.499327660, +0.257999063
1745-0.682084918, +0.831631422, -0.733739734, -0.617742062, +0.636015892, +0.125550628, -0.543881178
1746iweight = getUnifRand(1, 10, size(sample, dim, IK))
1747iweight
1748+8, +6, +6, +10, +3, +4, +4
1749mean(:,0) = getVar(sample, 2_IK, iweight)
1750mean(:,0) ! reference
1751+0.338830203, +0.354304641
1752var(:,0) = getVar(sample, 2_IK, iweight)
1753var(:,0) ! reference
1754+0.338830203, +0.354304641
1755do isam = 1, nsam
1756 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1757 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1758end do
1759call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1760meanMerged
1761+0.299263656, -0.263707906
1762varMerged
1763+0.338830203, +0.354304641
1764call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1765mean(:,2)
1766+0.299263656, -0.263707906
1767mean(:,0) ! reference
1768+0.338830203, +0.354304641
1769var(:,2)
1770+0.338830203, +0.354304641
1771var(:,0) ! reference
1772+0.338830203, +0.354304641
1773
1774
1775dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1776do isam = 2, nsam
1777 lb(isam) = ub(isam - 1) + 1
1778 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1779end do
1780lb
1781+1, +6
1782ub
1783+5, +7
1784ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1785call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1786call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1787call setResized(meanMerged, ndim)
1788call setResized(varMerged, ndim)
1789sample = getUnifRand(-1., +1., ndim, ub(nsam))
1790sample
1791+0.936405182, -0.521316290, +0.864827275, +0.745933056E-1, +0.207241893, -0.220037937, -0.933571935
1792+0.457517266, +0.780159712, -0.906429291, -0.200025678, +0.142363310, +0.566818476, -0.980188251
1793iweight = getUnifRand(1, 10, size(sample, dim, IK))
1794iweight
1795+1, +10, +10, +3, +3, +1, +8
1796mean(:,0) = getVar(sample, 2_IK, iweight)
1797mean(:,0) ! reference
1798+0.501959622, +0.578007996
1799var(:,0) = getVar(sample, 2_IK, iweight)
1800var(:,0) ! reference
1801+0.501959622, +0.578007996
1802do isam = 1, nsam
1803 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1804 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1805end do
1806call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1807meanMerged
1808-0.686553568E-1, -0.229245931
1809varMerged
1810+0.501959562, +0.578008056
1811call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1812mean(:,2)
1813-0.686553568E-1, -0.229245931
1814mean(:,0) ! reference
1815+0.501959622, +0.578007996
1816var(:,2)
1817+0.501959562, +0.578008056
1818var(:,0) ! reference
1819+0.501959622, +0.578007996
1820
1821
1822dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1823do isam = 2, nsam
1824 lb(isam) = ub(isam - 1) + 1
1825 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1826end do
1827lb
1828+1, +6
1829ub
1830+5, +12
1831ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1832call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1833call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1834call setResized(meanMerged, ndim)
1835call setResized(varMerged, ndim)
1836sample = getUnifRand(-1., +1., ndim, ub(nsam))
1837sample
1838+0.905704856, +0.308492184E-1, -0.787090182, -0.392057419, +0.813247800, +0.993899107E-1, -0.794128418, -0.892188549, -0.657222867, -0.591577291, +0.912078500, -0.286368251
1839-0.236485481, -0.755500674, -0.697118640, +0.698418975, +0.742473006, -0.841741204, +0.574502468, -0.772358775, -0.755270481, -0.685257316, +0.461509228, +0.685600042E-1
1840+0.939602852E-1, +0.785410881, +0.382186413, -0.408938646, +0.382983685E-1, -0.322721720, +0.682053804, -0.377744317, +0.374070883, -0.204478264, -0.925498724, +0.671899199
1841iweight = getUnifRand(1, 10, size(sample, dim, IK))
1842iweight
1843+10, +9, +1, +7, +6, +8, +3, +9, +7, +10, +6, +1
1844mean(:,0) = getVar(sample, 2_IK, iweight)
1845mean(:,0) ! reference
1846+0.446371555, +0.373269498, +0.225802064
1847var(:,0) = getVar(sample, 2_IK, iweight)
1848var(:,0) ! reference
1849+0.446371555, +0.373269498, +0.225802064
1850do isam = 1, nsam
1851 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1852 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1853end do
1854call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1855meanMerged
1856-0.553831905E-1, -0.282872856, -0.322725177E-1
1857varMerged
1858+0.446371585, +0.373269498, +0.225802049
1859call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1860mean(:,2)
1861-0.553831905E-1, -0.282872856, -0.322725177E-1
1862mean(:,0) ! reference
1863+0.446371555, +0.373269498, +0.225802064
1864var(:,2)
1865+0.446371585, +0.373269498, +0.225802049
1866var(:,0) ! reference
1867+0.446371555, +0.373269498, +0.225802064
1868
1869
1870dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1871do isam = 2, nsam
1872 lb(isam) = ub(isam - 1) + 1
1873 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1874end do
1875lb
1876+1, +5
1877ub
1878+4, +7
1879ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1880call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1881call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1882call setResized(meanMerged, ndim)
1883call setResized(varMerged, ndim)
1884sample = getUnifRand(-1., +1., ndim, ub(nsam))
1885sample
1886-0.995423555, -0.503279090, -0.822163343, -0.510252118, +0.437843800E-2, -0.813341379, -0.670410872
1887-0.237360716, +0.333773136, +0.279461145E-1, +0.336447239, +0.130962133, -0.482149363, +0.598000169
1888+0.213051677, +0.889516592, +0.729994297, -0.711555481, +0.967219949, -0.897472262, +0.326425195
1889iweight = getUnifRand(1, 10, size(sample, dim, IK))
1890iweight
1891+2, +8, +9, +7, +5, +10, +2
1892mean(:,0) = getVar(sample, 2_IK, iweight)
1893mean(:,0) ! reference
1894+0.737216994E-1, +0.112813115, +0.627091587
1895var(:,0) = getVar(sample, 2_IK, iweight)
1896var(:,0) ! reference
1897+0.737216994E-1, +0.112813115, +0.627091587
1898do isam = 1, nsam
1899 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1900 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1901end do
1902call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1903meanMerged
1904-0.614899039, +0.425913110E-1, +0.131291240
1905varMerged
1906+0.737217069E-1, +0.112813100, +0.627091646
1907call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1908mean(:,2)
1909-0.614899039, +0.425913110E-1, +0.131291240
1910mean(:,0) ! reference
1911+0.737216994E-1, +0.112813115, +0.627091587
1912var(:,2)
1913+0.737217069E-1, +0.112813100, +0.627091646
1914var(:,0) ! reference
1915+0.737216994E-1, +0.112813115, +0.627091587
1916
1917
1918dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1919do isam = 2, nsam
1920 lb(isam) = ub(isam - 1) + 1
1921 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1922end do
1923lb
1924+1, +7
1925ub
1926+6, +12
1927ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1928call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1929call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1930call setResized(meanMerged, ndim)
1931call setResized(varMerged, ndim)
1932sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
1933sample
1934(-0.851281643, -0.986930609), (-0.964846611E-1, +0.146651864), (+0.518817663, -0.443830609), (+0.414522409, +0.234564304), (-0.373918414, +0.259147525), (-0.220223665E-1, +0.808806539), (+0.650298595, -0.275458097), (+0.749525309, -0.521147013), (+0.445556283, +0.493030787), (+0.272839546, +0.752681136), (-0.876741409E-1, -0.746885180), (+0.912574291, -0.379040122)
1935(+0.666175961, +0.480147839), (+0.610077024, -0.457082272), (-0.747153401, -0.776517391E-1), (+0.693219185, -0.693808079), (+0.703310966E-2, -0.215394735), (+0.521205425, -0.777920485), (-0.946692944, -0.929207087), (+0.738097310, +0.282233119), (+0.731930733, -0.426679850E-1), (+0.479791164, +0.105232000E-1), (+0.217943907, +0.529036999), (+0.178094745, +0.217967391)
1936iweight = getUnifRand(1, 10, size(sample, dim, IK))
1937iweight
1938+2, +7, +6, +8, +4, +10, +3, +9, +6, +1, +2, +2
1939mean(:,0) = getVar(sample, 2_IK, iweight)
1940mean(:,0) ! reference
1941(+0.445248663, +0.00000000), (+0.479920685, +0.00000000)
1942var(:,0) = getVar(sample, 2_IK, iweight)
1943var(:,0) ! reference
1944+0.445248663, +0.479920685
1945do isam = 1, nsam
1946 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1947 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1948end do
1949call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1950meanMerged
1951(+0.260463893, +0.555534363E-1), (+0.356202722, -0.264923990)
1952varMerged
1953+0.445248634, +0.479920685
1954call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1955mean(:,2)
1956(+0.260463893, +0.555534363E-1), (+0.356202722, -0.264923990)
1957mean(:,0) ! reference
1958(+0.445248663, +0.00000000), (+0.479920685, +0.00000000)
1959var(:,2)
1960+0.445248634, +0.479920685
1961var(:,0) ! reference
1962+0.445248663, +0.479920685
1963
1964
1965dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1966do isam = 2, nsam
1967 lb(isam) = ub(isam - 1) + 1
1968 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1969end do
1970lb
1971+1, +6
1972ub
1973+5, +7
1974ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1975call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1976call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1977call setResized(meanMerged, ndim)
1978call setResized(varMerged, ndim)
1979sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
1980sample
1981(-0.604471922, -0.722172856), (-0.586372614E-1, -0.765535116), (-0.992283702, +0.807943702), (-0.487717509, +0.104156017), (-0.254726410, +0.939801216), (-0.909863949, +0.103176475), (-0.543208003, -0.837131381)
1982(-0.587000966, +0.841384172), (+0.663629413, -0.793049216), (+0.719133019, -0.723772764), (+0.986236334, +0.142232656), (+0.924685240, +0.738291502), (+0.523684144, +0.216694236), (-0.194679022, -0.102457047)
1983iweight = getUnifRand(1, 10, size(sample, dim, IK))
1984iweight
1985+9, +3, +8, +2, +8, +2, +5
1986mean(:,0) = getVar(sample, 2_IK, iweight)
1987mean(:,0) ! reference
1988(+0.689130783, +0.00000000), (+0.822354198, +0.00000000)
1989var(:,0) = getVar(sample, 2_IK, iweight)
1990var(:,0) ! reference
1991+0.689130783, +0.822354198
1992do isam = 1, nsam
1993 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1994 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1995end do
1996call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1997meanMerged
1998(-0.570363402, +0.382380113E-1), (+0.321753293, +0.149054825)
1999varMerged
2000+0.689130843, +0.822354257
2001call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
2002mean(:,2)
2003(-0.570363402, +0.382380113E-1), (+0.321753293, +0.149054825)
2004mean(:,0) ! reference
2005(+0.689130783, +0.00000000), (+0.822354198, +0.00000000)
2006var(:,2)
2007+0.689130843, +0.822354257
2008var(:,0) ! reference
2009+0.689130783, +0.822354198
2010
2011
2012dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
2013do isam = 2, nsam
2014 lb(isam) = ub(isam - 1) + 1
2015 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
2016end do
2017lb
2018+1, +6
2019ub
2020+5, +12
2021ndim = getUnifRand(1, minval(ub - lb + 1, 1))
2022call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
2023call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
2024call setResized(meanMerged, ndim)
2025call setResized(varMerged, ndim)
2026sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
2027sample
2028(-0.356173277, -0.950295568), (+0.430824757E-1, +0.240799665), (-0.874439478E-1, -0.805547595), (+0.775285125, +0.601713896), (+0.617304564, -0.802394032), (+0.148570895, +0.196672559), (-0.715219021, -0.606914997), (-0.609425902, -0.936508060), (+0.829522252, -0.111786127E-1), (-0.263325572, -0.558312058), (+0.844980478E-1, -0.950670958), (-0.373999357, -0.936996341)
2029(+0.642017007, -0.639532804E-1), (+0.226229787, -0.699286222), (-0.474665284, +0.890850902), (-0.124120235, +0.727239609), (+0.800080299, -0.591337681E-2), (-0.535969973, -0.212570429), (-0.552075267, -0.281301737), (+0.138498902, -0.416224837), (+0.197449327, -0.216166854), (+0.338417053, -0.694341421), (-0.940167069, -0.481247663), (+0.136414766E-1, -0.129129410)
2030(+0.382838368, +0.366681337), (+0.558368206, +0.170911431), (+0.474322319, +0.131924510), (+0.449027538, +0.712810040), (-0.588616729, +0.254755616), (-0.953671813, +0.753389239), (-0.768563390, -0.538604498), (-0.574646950, -0.400382161), (-0.804148674, +0.734889984), (+0.356234908, +0.105269432), (-0.239333272, -0.844217062), (-0.183472633, -0.910837770)
2031iweight = getUnifRand(1, 10, size(sample, dim, IK))
2032iweight
2033+7, +8, +10, +8, +8, +7, +5, +3, +9, +2, +4, +5
2034mean(:,0) = getVar(sample, 2_IK, iweight)
2035mean(:,0) ! reference
2036(+0.560278833, +0.00000000), (+0.502727032, +0.00000000), (+0.619186282, +0.00000000)
2037var(:,0) = getVar(sample, 2_IK, iweight)
2038var(:,0) ! reference
2039+0.560278833, +0.502727032, +0.619186282
2040do isam = 1, nsam
2041 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
2042 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
2043end do
2044call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
2045meanMerged
2046(+0.120531492, -0.375774711), (-0.487191975E-2, -0.185637102E-1), (-0.129851326, +0.174564198)
2047varMerged
2048+0.560278773, +0.502727032, +0.619186163
2049call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
2050mean(:,2)
2051(+0.120531492, -0.375774711), (-0.487191975E-2, -0.185637102E-1), (-0.129851326, +0.174564198)
2052mean(:,0) ! reference
2053(+0.560278833, +0.00000000), (+0.502727032, +0.00000000), (+0.619186282, +0.00000000)
2054var(:,2)
2055+0.560278773, +0.502727032, +0.619186163
2056var(:,0) ! reference
2057+0.560278833, +0.502727032, +0.619186282
2058
2059
2060dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
2061do isam = 2, nsam
2062 lb(isam) = ub(isam - 1) + 1
2063 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
2064end do
2065lb
2066+1, +7
2067ub
2068+6, +10
2069ndim = getUnifRand(1, minval(ub - lb + 1, 1))
2070call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
2071call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
2072call setResized(meanMerged, ndim)
2073call setResized(varMerged, ndim)
2074sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
2075sample
2076(+0.789366961E-1, -0.459667087), (+0.555796146, -0.999973059), (+0.645811200, -0.851449728), (-0.376818180, -0.988416433), (-0.295202613, -0.753653407), (-0.652528405, +0.149038315), (-0.281677485, -0.990754247), (+0.296763778, -0.147832155), (+0.535935044, +0.262844443), (-0.715446830, -0.838607669)
2077iweight = getUnifRand(1, 10, size(sample, dim, IK))
2078iweight
2079+8, +5, +7, +2, +8, +8, +1, +8, +2, +2
2080mean(:,0) = getVar(sample, 2_IK, iweight)
2081mean(:,0) ! reference
2082(+0.399099320, +0.00000000)
2083var(:,0) = getVar(sample, 2_IK, iweight)
2084var(:,0) ! reference
2085+0.399099320
2086do isam = 1, nsam
2087 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
2088 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
2089end do
2090call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
2091meanMerged
2092(+0.260603391E-1, -0.485804737)
2093varMerged
2094+0.399099261
2095call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
2096mean(:,2)
2097(+0.260603391E-1, -0.485804737)
2098mean(:,0) ! reference
2099(+0.399099320, +0.00000000)
2100var(:,2)
2101+0.399099261
2102var(:,0) ! reference
2103+0.399099320
2104
2105
2106dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
2107do isam = 2, nsam
2108 lb(isam) = ub(isam - 1) + 1
2109 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
2110end do
2111lb
2112+1, +3
2113ub
2114+2, +8
2115ndim = getUnifRand(1, minval(ub - lb + 1, 1))
2116call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
2117call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
2118call setResized(meanMerged, ndim)
2119call setResized(varMerged, ndim)
2120sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
2121sample
2122(+0.926758051E-1, -0.655876875), (+0.843337893, +0.290679097), (-0.752840757, +0.496578574), (+0.751332760, -0.224754930), (-0.154177785, -0.299545169), (+0.343067050, +0.270943999), (+0.474354029E-1, +0.884594440), (-0.530583382, +0.971300602E-1)
2123iweight = getUnifRand(1, 10, size(sample, dim, IK))
2124iweight
2125+9, +7, +10, +2, +9, +10, +10, +3
2126mean(:,0) = getVar(sample, 2_IK, iweight)
2127mean(:,0) ! reference
2128(+0.481507272, +0.00000000)
2129var(:,0) = getVar(sample, 2_IK, iweight)
2130var(:,0) ! reference
2131+0.481507272
2132do isam = 1, nsam
2133 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
2134 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
2135end do
2136call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
2137meanMerged
2138(+0.272896588E-1, +0.163316786)
2139varMerged
2140+0.481507242
2141call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
2142mean(:,2)
2143(+0.272896588E-1, +0.163316786)
2144mean(:,0) ! reference
2145(+0.481507272, +0.00000000)
2146var(:,2)
2147+0.481507242
2148var(:,0) ! reference
2149+0.481507272
2150
2151
2152!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2153!Compute the biased merged variance and mean of a reliability weighted multivariate sample.
2154!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2155
2156
2157dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
2158do isam = 2, nsam
2159 lb(isam) = ub(isam - 1) + 1
2160 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
2161end do
2162lb
2163+1, +6
2164ub
2165+5, +8
2166ndim = getUnifRand(1, minval(ub - lb + 1, 1))
2167call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
2168call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
2169call setResized(meanMerged, ndim)
2170call setResized(varMerged, ndim)
2171sample = getUnifRand(-1., +1., ndim, ub(nsam))
2172sample
2173-0.456859827, +0.846340775, -0.529965758, -0.529519439, -0.531724572, -0.953049302, +0.453287363, +0.871036887
2174+0.166800976, -0.741932273, -0.113613844, -0.748641491, -0.368432879, +0.924904704, +0.704228640, +0.286103725
2175-0.549233437, -0.343745589, +0.656392455, +0.232125282, +0.167057753, +0.423360467, +0.834948659, +0.533569694
2176rweight = getUnifRand(1., 2., size(sample, dim, IK))
2177rweight
2178+1.91578388, +1.15440679, +1.63607156, +1.16868019, +1.48426163, +1.07659340, +1.26548696, +1.85025275
2179mean(:,0) = getVar(sample, 2_IK, rweight)
2180mean(:,0) ! reference
2181+0.431653619, +0.282213181, +0.218195528
2182var(:,0) = getVar(sample, 2_IK, rweight)
2183var(:,0) ! reference
2184+0.431653619, +0.282213181, +0.218195528
2185do isam = 1, nsam
2186 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2187 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2188end do
2189call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2190meanMerged
2191-0.877910405E-1, +0.235217065E-1, +0.228865653
2192varMerged
2193+0.431653559, +0.282213181, +0.218195498
2194call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2195mean(:,2)
2196-0.877910405E-1, +0.235217065E-1, +0.228865653
2197mean(:,0) ! reference
2198+0.431653619, +0.282213181, +0.218195528
2199var(:,2)
2200+0.431653559, +0.282213181, +0.218195498
2201var(:,0) ! reference
2202+0.431653619, +0.282213181, +0.218195528
2203
2204
2205dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
2206do isam = 2, nsam
2207 lb(isam) = ub(isam - 1) + 1
2208 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
2209end do
2210lb
2211+1, +6
2212ub
2213+5, +11
2214ndim = getUnifRand(1, minval(ub - lb + 1, 1))
2215call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
2216call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
2217call setResized(meanMerged, ndim)
2218call setResized(varMerged, ndim)
2219sample = getUnifRand(-1., +1., ndim, ub(nsam))
2220sample
2221-0.952730060, +0.417450070, +0.382472157, -0.969472051, +0.620872378, -0.354057431, +0.287482977, +0.840806365, -0.448304653, -0.916323543, -0.241936564
2222+0.355140805, -0.192204118, -0.904233813, -0.706048250, +0.524552584, -0.972798228, +0.333295703, +0.913730741, -0.999574184, +0.770824075, +0.752492905
2223rweight = getUnifRand(1., 2., size(sample, dim, IK))
2224rweight
2225+1.89920223, +1.93254256, +1.61339211, +1.76530468, +1.03323865, +1.51040733, +1.81978631, +1.25476003, +1.21311593, +1.65833759, +1.27826726
2226mean(:,0) = getVar(sample, 2_IK, rweight)
2227mean(:,0) ! reference
2228+0.402585149, +0.493393302
2229var(:,0) = getVar(sample, 2_IK, rweight)
2230var(:,0) ! reference
2231+0.402585149, +0.493393302
2232do isam = 1, nsam
2233 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2234 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2235end do
2236call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2237meanMerged
2238-0.164020360, -0.323324800E-1
2239varMerged
2240+0.402585179, +0.493393302
2241call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2242mean(:,2)
2243-0.164020360, -0.323324800E-1
2244mean(:,0) ! reference
2245+0.402585149, +0.493393302
2246var(:,2)
2247+0.402585179, +0.493393302
2248var(:,0) ! reference
2249+0.402585149, +0.493393302
2250
2251
2252dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
2253do isam = 2, nsam
2254 lb(isam) = ub(isam - 1) + 1
2255 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
2256end do
2257lb
2258+1, +3
2259ub
2260+2, +7
2261ndim = getUnifRand(1, minval(ub - lb + 1, 1))
2262call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
2263call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
2264call setResized(meanMerged, ndim)
2265call setResized(varMerged, ndim)
2266sample = getUnifRand(-1., +1., ndim, ub(nsam))
2267sample
2268+0.678837419, -0.104835033, -0.141752720, +0.305764675E-1, -0.168594837, +0.702507615, +0.115168214
2269rweight = getUnifRand(1., 2., size(sample, dim, IK))
2270rweight
2271+1.00804949, +1.87534475, +1.66213238, +1.35118973, +1.35291338, +1.44975519, +1.79031503
2272mean(:,0) = getVar(sample, 2_IK, rweight)
2273mean(:,0) ! reference
2274+0.108568534
2275var(:,0) = getVar(sample, 2_IK, rweight)
2276var(:,0) ! reference
2277+0.108568534
2278do isam = 1, nsam
2279 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2280 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2281end do
2282call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2283meanMerged
2284+0.122973964
2285varMerged
2286+0.108568512
2287call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2288mean(:,2)
2289+0.122973964
2290mean(:,0) ! reference
2291+0.108568534
2292var(:,2)
2293+0.108568512
2294var(:,0) ! reference
2295+0.108568534
2296
2297
2298dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
2299do isam = 2, nsam
2300 lb(isam) = ub(isam - 1) + 1
2301 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
2302end do
2303lb
2304+1, +6
2305ub
2306+5, +10
2307ndim = getUnifRand(1, minval(ub - lb + 1, 1))
2308call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
2309call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
2310call setResized(meanMerged, ndim)
2311call setResized(varMerged, ndim)
2312sample = getUnifRand(-1., +1., ndim, ub(nsam))
2313sample
2314-0.590085983E-1, +0.665111303, -0.860111475, +0.600747705, +0.477968574, +0.938823223, +0.506662369, -0.664431095, +0.306898355, +0.769069195
2315+0.866360784, -0.552640080, -0.592116594, -0.741476417, -0.945961356, -0.169301748, -0.820216656, -0.336416125, +0.696911812, -0.724162936
2316-0.841434360, +0.328338504, +0.995761633, +0.221701026, +0.866441846, -0.921578050, +0.230515003E-2, -0.475273013, -0.357847810, +0.283270717
2317-0.622297764, -0.670937300, -0.403313398, +0.171689391, +0.372068524, +0.741893411, +0.860774159, +0.515783548, -0.331782818, +0.646715164E-1
2318rweight = getUnifRand(1., 2., size(sample, dim, IK))
2319rweight
2320+1.31561375, +1.56880832, +1.33455181, +1.83362663, +1.84589934, +1.50811875, +1.30193865, +1.60850406, +1.88360548, +1.17562199
2321mean(:,0) = getVar(sample, 2_IK, rweight)
2322mean(:,0) ! reference
2323+0.313359886, +0.363156915, +0.382107615, +0.266435415
2324var(:,0) = getVar(sample, 2_IK, rweight)
2325var(:,0) ! reference
2326+0.313359886, +0.363156915, +0.382107615, +0.266435415
2327do isam = 1, nsam
2328 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2329 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2330end do
2331call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2332meanMerged
2333+0.279048830, -0.326873511, +0.162927955E-1, +0.723423734E-1
2334varMerged
2335+0.313359886, +0.363156915, +0.382107615, +0.266435444
2336call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2337mean(:,2)
2338+0.279048830, -0.326873511, +0.162927955E-1, +0.723423734E-1
2339mean(:,0) ! reference
2340+0.313359886, +0.363156915, +0.382107615, +0.266435415
2341var(:,2)
2342+0.313359886, +0.363156915, +0.382107615, +0.266435444
2343var(:,0) ! reference
2344+0.313359886, +0.363156915, +0.382107615, +0.266435415
2345
2346
2347dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
2348do isam = 2, nsam
2349 lb(isam) = ub(isam - 1) + 1
2350 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
2351end do
2352lb
2353+1, +8
2354ub
2355+7, +13
2356ndim = getUnifRand(1, minval(ub - lb + 1, 1))
2357call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
2358call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
2359call setResized(meanMerged, ndim)
2360call setResized(varMerged, ndim)
2361sample = getUnifRand(-1., +1., ndim, ub(nsam))
2362sample
2363-0.380760312, -0.181761146, -0.551533222, -0.252892613, -0.533695459, +0.153751612, -0.348669410, +0.561230779, +0.658128858, +0.937129021, -0.522557139, -0.703782201, -0.673147082
2364-0.850821376, -0.344029188, -0.978334785, +0.912092090, +0.477890134, -0.179162741, +0.784522176, +0.158455610, -0.765434980, -0.778558731, +0.305698276, +0.176838994, -0.454311371E-1
2365+0.159700632, +0.382051468E-1, +0.950282097, +0.138051152, -0.958918810, -0.166980743, -0.432868838, -0.311475277, +0.492194653, -0.528613329, +0.688581467E-1, +0.440961599, +0.911751628
2366-0.524776340, -0.390508533, +0.791839242, +0.441127181, -0.270178318, -0.740340233, -0.234954000, -0.272068262, +0.622387528, +0.566700697E-1, +0.550194502, -0.596840262, +0.568737864
2367-0.596731782, -0.980297446, -0.880720139, +0.675351501, +0.860759020E-1, +0.284641027, -0.702136040, -0.713813305E-2, +0.894187808, -0.124615192, +0.582032084, +0.486657143, -0.363450646
2368-0.361077070, +0.867906809, -0.863591671, -0.945906401, -0.593127728, -0.277345061, +0.572922230E-1, -0.306186318, -0.822239757, +0.786304474E-2, -0.126777172, -0.142967105, +0.477281809
2369rweight = getUnifRand(1., 2., size(sample, dim, IK))
2370rweight
2371+1.51350498, +1.89345598, +1.29765248, +1.30025578, +1.67977345, +1.35092080, +1.91176558, +1.49859715, +1.47617102, +1.05615437, +1.90248680, +1.73263478, +1.75387597
2372mean(:,0) = getVar(sample, 2_IK, rweight)
2373mean(:,0) ! reference
2374+0.243654490, +0.343116134, +0.279995084, +0.254535228, +0.364152372, +0.262150049
2375var(:,0) = getVar(sample, 2_IK, rweight)
2376var(:,0) ! reference
2377+0.243654490, +0.343116134, +0.279995084, +0.254535228, +0.364152372, +0.262150049
2378do isam = 1, nsam
2379 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2380 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2381end do
2382call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2383meanMerged
2384-0.192081332, -0.426470488E-1, +0.617861599E-1, -0.125053227E-1, -0.661122724E-1, -0.188110501
2385varMerged
2386+0.243654519, +0.343116164, +0.279995114, +0.254535198, +0.364152431, +0.262150049
2387call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2388mean(:,2)
2389-0.192081332, -0.426470488E-1, +0.617861599E-1, -0.125053227E-1, -0.661122724E-1, -0.188110501
2390mean(:,0) ! reference
2391+0.243654490, +0.343116134, +0.279995084, +0.254535228, +0.364152372, +0.262150049
2392var(:,2)
2393+0.243654519, +0.343116164, +0.279995114, +0.254535198, +0.364152431, +0.262150049
2394var(:,0) ! reference
2395+0.243654490, +0.343116134, +0.279995084, +0.254535228, +0.364152372, +0.262150049
2396
2397
2398dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
2399do isam = 2, nsam
2400 lb(isam) = ub(isam - 1) + 1
2401 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
2402end do
2403lb
2404+1, +8
2405ub
2406+7, +9
2407ndim = getUnifRand(1, minval(ub - lb + 1, 1))
2408call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
2409call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
2410call setResized(meanMerged, ndim)
2411call setResized(varMerged, ndim)
2412sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
2413sample
2414(-0.559929132, +0.107594609), (-0.127242565, +0.910096884), (-0.265121579, -0.456588626), (+0.228326917, +0.470838547), (+0.895473957, +0.338093758), (-0.510994196, -0.222503781), (+0.996068716, -0.968947411E-1), (+0.387076139E-1, +0.746616483), (+0.962647915, +0.732249379)
2415(-0.224885702, -0.549366951), (-0.468231559, +0.669173479), (-0.333083391, +0.280504227), (+0.291358113, +0.147912502E-1), (+0.125867486, +0.545435309), (-0.259938598, -0.162636042E-1), (-0.648244262, -0.566329598), (-0.656138062, +0.851830006), (-0.681183696, -0.794881105)
2416rweight = getUnifRand(1., 2., size(sample, dim, IK))
2417rweight
2418+1.95570564, +1.48555732, +1.48572564, +1.94028366, +1.03725314, +1.65249991, +1.59643817, +1.66730642, +1.70330381
2419mean(:,0) = getVar(sample, 2_IK, rweight)
2420mean(:,0) ! reference
2421(+0.539648235, +0.00000000), (+0.416557014, +0.00000000)
2422var(:,0) = getVar(sample, 2_IK, rweight)
2423var(:,0) ! reference
2424+0.539648235, +0.416557014
2425do isam = 1, nsam
2426 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2427 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2428end do
2429call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2430meanMerged
2431(+0.147605628, +0.283530354), (-0.320369333, +0.456161937E-2)
2432varMerged
2433+0.539648175, +0.416557014
2434call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2435mean(:,2)
2436(+0.147605628, +0.283530354), (-0.320369333, +0.456161937E-2)
2437mean(:,0) ! reference
2438(+0.539648235, +0.00000000), (+0.416557014, +0.00000000)
2439var(:,2)
2440+0.539648175, +0.416557014
2441var(:,0) ! reference
2442+0.539648235, +0.416557014
2443
2444
2445dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
2446do isam = 2, nsam
2447 lb(isam) = ub(isam - 1) + 1
2448 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
2449end do
2450lb
2451+1, +7
2452ub
2453+6, +11
2454ndim = getUnifRand(1, minval(ub - lb + 1, 1))
2455call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
2456call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
2457call setResized(meanMerged, ndim)
2458call setResized(varMerged, ndim)
2459sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
2460sample
2461(-0.475404501, -0.745295286), (+0.654235840, +0.180504441), (-0.477253795, +0.838284016), (+0.623126030E-1, -0.580994964), (-0.336308122, +0.918545365), (-0.723591685, +0.406844139), (+0.261555791, -0.496661901), (-0.395248413, -0.209601998), (-0.286167622, -0.860378027), (-0.880562067, +0.718285918), (+0.230759501, +0.133298635E-1)
2462(-0.330305934, +0.869467258E-1), (+0.257432103, -0.260700941), (-0.948377490, -0.154860735), (-0.262456775, +0.644871235), (-0.481317997, +0.409146786), (-0.253222704, -0.978476048), (+0.807442904, +0.433811545), (-0.865841627, +0.677737474), (-0.306224704, -0.165075779), (-0.543186426, -0.639907598), (+0.608236074, -0.456133366)
2463rweight = getUnifRand(1., 2., size(sample, dim, IK))
2464rweight
2465+1.50786710, +1.90293026, +1.22824669, +1.23750782, +1.61801374, +1.95698977, +1.52990723, +1.46897864, +1.81417561, +1.13496017, +1.33197188
2466mean(:,0) = getVar(sample, 2_IK, rweight)
2467mean(:,0) ! reference
2468(+0.577200532, +0.00000000), (+0.538022697, +0.00000000)
2469var(:,0) = getVar(sample, 2_IK, rweight)
2470var(:,0) ! reference
2471+0.577200532, +0.538022697
2472do isam = 1, nsam
2473 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2474 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2475end do
2476call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2477meanMerged
2478(-0.199193686, +0.102087110E-2), (-0.189499885, -0.588145107E-1)
2479varMerged
2480+0.577200532, +0.538022637
2481call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2482mean(:,2)
2483(-0.199193686, +0.102087110E-2), (-0.189499885, -0.588145107E-1)
2484mean(:,0) ! reference
2485(+0.577200532, +0.00000000), (+0.538022697, +0.00000000)
2486var(:,2)
2487+0.577200532, +0.538022637
2488var(:,0) ! reference
2489+0.577200532, +0.538022697
2490
2491
2492dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
2493do isam = 2, nsam
2494 lb(isam) = ub(isam - 1) + 1
2495 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
2496end do
2497lb
2498+1, +5
2499ub
2500+4, +10
2501ndim = getUnifRand(1, minval(ub - lb + 1, 1))
2502call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
2503call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
2504call setResized(meanMerged, ndim)
2505call setResized(varMerged, ndim)
2506sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
2507sample
2508(-0.483351827, -0.942086101), (-0.153762460, -0.816159725), (-0.215927482, +0.623725653), (-0.635021091, -0.687877059), (-0.409031868, -0.519144535), (+0.138303041E-1, +0.846430302), (-0.792427897, -0.760880470), (+0.173882008, +0.578499794), (-0.126905680, -0.144201875), (+0.482061744, +0.434282184)
2509rweight = getUnifRand(1., 2., size(sample, dim, IK))
2510rweight
2511+1.93162394, +1.85349691, +1.93623066, +1.37309849, +1.87251413, +1.37600076, +1.30573750, +1.88095713, +1.51429009, +1.76100111
2512mean(:,0) = getVar(sample, 2_IK, rweight)
2513mean(:,0) ! reference
2514(+0.559749186, +0.00000000)
2515var(:,0) = getVar(sample, 2_IK, rweight)
2516var(:,0) ! reference
2517+0.559749186
2518do isam = 1, nsam
2519 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2520 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2521end do
2522call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2523meanMerged
2524(-0.196755737, -0.133040398)
2525varMerged
2526+0.559749126
2527call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2528mean(:,2)
2529(-0.196755737, -0.133040398)
2530mean(:,0) ! reference
2531(+0.559749186, +0.00000000)
2532var(:,2)
2533+0.559749126
2534var(:,0) ! reference
2535+0.559749186
2536
2537
2538dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
2539do isam = 2, nsam
2540 lb(isam) = ub(isam - 1) + 1
2541 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
2542end do
2543lb
2544+1, +3
2545ub
2546+2, +8
2547ndim = getUnifRand(1, minval(ub - lb + 1, 1))
2548call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
2549call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
2550call setResized(meanMerged, ndim)
2551call setResized(varMerged, ndim)
2552sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
2553sample
2554(-0.694346547, +0.443354607), (+0.155163646, -0.194434881), (+0.678552389, +0.993994474), (+0.276175737E-1, +0.479347944), (-0.740348339, +0.664105058), (+0.147382617, +0.890783191), (-0.662088156, -0.781434774), (-0.323125124, -0.418649197)
2555rweight = getUnifRand(1., 2., size(sample, dim, IK))
2556rweight
2557+1.81097853, +1.31777596, +1.65954888, +1.55192065, +1.80724859, +1.72039008, +1.18610168, +1.86958385
2558mean(:,0) = getVar(sample, 2_IK, rweight)
2559mean(:,0) ! reference
2560(+0.571343303, +0.00000000)
2561var(:,0) = getVar(sample, 2_IK, rweight)
2562var(:,0) ! reference
2563+0.571343303
2564do isam = 1, nsam
2565 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2566 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2567end do
2568call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2569meanMerged
2570(-0.182448030, +0.306673706)
2571varMerged
2572+0.571343303
2573call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2574mean(:,2)
2575(-0.182448030, +0.306673706)
2576mean(:,0) ! reference
2577(+0.571343303, +0.00000000)
2578var(:,2)
2579+0.571343303
2580var(:,0) ! reference
2581+0.571343303
2582
2583
2584dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
2585do isam = 2, nsam
2586 lb(isam) = ub(isam - 1) + 1
2587 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
2588end do
2589lb
2590+1, +6
2591ub
2592+5, +7
2593ndim = getUnifRand(1, minval(ub - lb + 1, 1))
2594call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
2595call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
2596call setResized(meanMerged, ndim)
2597call setResized(varMerged, ndim)
2598sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
2599sample
2600(-0.522180438, -0.978707910), (+0.913498282, -0.639264941), (+0.510934591, -0.460795403), (+0.566257238, -0.191065907), (+0.802366972, +0.688931942), (+0.823998809, +0.839356780), (+0.753705502E-1, +0.415634751)
2601rweight = getUnifRand(1., 2., size(sample, dim, IK))
2602rweight
2603+1.62331700, +1.67917943, +1.08532345, +1.72158051, +1.65279627, +1.24655652, +1.58064413
2604mean(:,0) = getVar(sample, 2_IK, rweight)
2605mean(:,0) ! reference
2606(+0.656648755, +0.00000000)
2607var(:,0) = getVar(sample, 2_IK, rweight)
2608var(:,0) ! reference
2609+0.656648755
2610do isam = 1, nsam
2611 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2612 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2613end do
2614call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2615meanMerged
2616(+0.442715883, -0.613161027E-1)
2617varMerged
2618+0.656648755
2619call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2620mean(:,2)
2621(+0.442715883, -0.613161027E-1)
2622mean(:,0) ! reference
2623(+0.656648755, +0.00000000)
2624var(:,2)
2625+0.656648755
2626var(:,0) ! reference
2627+0.656648755
2628
2629
Test:
test_pm_sampleVar


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Amir Shahmoradi, April 21, 2017, 1:54 AM, Institute for Computational Engineering and Sciences (ICES), The University of Texas at Austin

Definition at line 9374 of file pm_sampleVar.F90.


The documentation for this interface was generated from the following file: