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, +4
14ub
15+3, +6
16sample = getUnifRand(0., 1., ub(nsam))
17sample
18+0.300738692, +0.826546073, +0.904453993, +0.388791502, +0.707582772, +0.952494144
19mean(0) = getMean(sample)
20mean(0) ! reference
21+0.680101216
22var(0) = getVar(sample)
23var(0) ! reference
24+0.625851229E-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.680101216
32varMerged
33+0.625851154E-1
34call setVarMeanMerged(var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
35mean(2)
36+0.680101216
37mean(0) ! reference
38+0.680101216
39var(2)
40+0.625851154E-1
41var(0) ! reference
42+0.625851229E-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, +3
52ub
53+2, +4
54sample = getUnifRand(0., 1., ub(nsam))
55sample
56+0.451598644, +0.816199720, +0.182628632E-3, +0.347925842
57mean(0) = getMean(sample)
58mean(0) ! reference
59+0.403976738
60var(0) = getVar(sample)
61var(0) ! reference
62+0.845967531E-1
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.403976738
70varMerged
71+0.845967606E-1
72call setVarMeanMerged(var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
73mean(2)
74+0.403976738
75mean(0) ! reference
76+0.403976738
77var(2)
78+0.845967606E-1
79var(0) ! reference
80+0.845967531E-1
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, +5
90ub
91+4, +7
92sample = getUnifRand(0., 1., ub(nsam))
93sample
94+0.912773132, +0.402607918, +0.374722421, +0.778887272E-1, +0.958424330, +0.178530216, +0.515347719
95mean(0) = getMean(sample)
96mean(0) ! reference
97+0.488613516
98var(0) = getVar(sample)
99var(0) ! reference
100+0.980804190E-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.488613486
108varMerged
109+0.980804190E-1
110call setVarMeanMerged(var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
111mean(2)
112+0.488613486
113mean(0) ! reference
114+0.488613516
115var(2)
116+0.980804190E-1
117var(0) ! reference
118+0.980804190E-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, +7
128ub
129+6, +12
130sample = getUnifRand(0., 1., ub(nsam))
131sample
132+0.579243839, +0.365756810, +0.975298882, +0.150066078, +0.794467330E-1, +0.588669062, +0.288138032, +0.895552337, +0.190088153, +0.616138697, +0.854666471, +0.493799806
133mean(0) = getMean(sample)
134mean(0) ! reference
135+0.506405413
136var(0) = getVar(sample)
137var(0) ! reference
138+0.828004852E-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.506405413
146varMerged
147+0.828004852E-1
148call setVarMeanMerged(var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
149mean(2)
150+0.506405413
151mean(0) ! reference
152+0.506405413
153var(2)
154+0.828004852E-1
155var(0) ! reference
156+0.828004852E-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, +8
166ub
167+7, +11
168sample = getUnifRand(0., 1., ub(nsam))
169sample
170+0.444651842E-1, +0.178797841E-1, +0.486887693E-1, +0.292090833, +0.113872349, +0.828850269, +0.783131242, +0.673079848, +0.489113569, +0.925929666, +0.946931660
171mean(0) = getMean(sample)
172mean(0) ! reference
173+0.469457597
174var(0) = getVar(sample)
175var(0) ! reference
176+0.129567116
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.469457567
184varMerged
185+0.129567102
186call setVarMeanMerged(var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
187mean(2)
188+0.469457567
189mean(0) ! reference
190+0.469457597
191var(2)
192+0.129567102
193var(0) ! reference
194+0.129567116
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, +7
204ub
205+6, +12
206sample = cmplx(getUnifRand(-1., +1., ub(nsam)), getUnifRand(-1., +1., ub(nsam)), TKG)
207sample
208(+0.801158905, +0.962853432E-3), (+0.210760355, +0.602453232), (-0.984127879, +0.956022024), (+0.110168099, -0.636793494), (-0.704571128, -0.118475676), (-0.509290576, -0.652885079), (-0.427154779, +0.631077290E-1), (-0.708558559E-1, +0.205811262E-1), (-0.694830179, -0.457609057), (+0.292301059, -0.659750700E-1), (-0.781919956, +0.835206509), (+0.727935791, -0.540279627)
209mean(0) = getMean(sample)
210mean(0) ! reference
211(-0.169202164, +0.526289165E-3)
212var(0) = getVar(sample)
213var(0) ! reference
214+0.608877420
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.169202179, +0.526289456E-3)
222varMerged
223+0.608877480
224call setVarMeanMerged(var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
225mean(2)
226(-0.169202179, +0.526289456E-3)
227mean(0) ! reference
228(-0.169202164, +0.526289165E-3)
229var(2)
230+0.608877480
231var(0) ! reference
232+0.608877420
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, +5
242ub
243+4, +8
244sample = cmplx(getUnifRand(-1., +1., ub(nsam)), getUnifRand(-1., +1., ub(nsam)), TKG)
245sample
246(+0.529052019, -0.868605375E-1), (-0.493851066, -0.366667509E-1), (-0.260193944, +0.392078161), (-0.200027227E-1, +0.929609656), (-0.612545013, +0.222085357), (-0.443601847, +0.670454979), (-0.545647740, +0.533435345), (-0.352996111, -0.934483647)
247mean(0) = getMean(sample)
248mean(0) ! reference
249(-0.274973303, +0.211206570)
250var(0) = getVar(sample)
251var(0) ! reference
252+0.413487852
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.274973303, +0.211206570)
260varMerged
261+0.413487792
262call setVarMeanMerged(var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
263mean(2)
264(-0.274973303, +0.211206570)
265mean(0) ! reference
266(-0.274973303, +0.211206570)
267var(2)
268+0.413487792
269var(0) ! reference
270+0.413487852
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, +7
280ub
281+6, +8
282sample = cmplx(getUnifRand(-1., +1., ub(nsam)), getUnifRand(-1., +1., ub(nsam)), TKG)
283sample
284(-0.806439161, -0.688816190), (+0.126288772, +0.262729406), (-0.130549192, -0.820411921), (+0.512068272E-1, +0.401137114), (+0.659992576, +0.424023509), (+0.516079664, +0.233240485), (-0.906788826, +0.970872045), (-0.495441437, -0.576867700)
285mean(0) = getMean(sample)
286mean(0) ! reference
287(-0.123206347, +0.257383436E-1)
288var(0) = getVar(sample)
289var(0) ! reference
290+0.651990533
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.123206347, +0.257383436E-1)
298varMerged
299+0.651990414
300call setVarMeanMerged(var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
301mean(2)
302(-0.123206347, +0.257383436E-1)
303mean(0) ! reference
304(-0.123206347, +0.257383436E-1)
305var(2)
306+0.651990414
307var(0) ! reference
308+0.651990533
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, +12
320sample = cmplx(getUnifRand(-1., +1., ub(nsam)), getUnifRand(-1., +1., ub(nsam)), TKG)
321sample
322(+0.540003300, +0.109041452), (-0.367841721E-1, +0.277980685), (+0.877188444, -0.245737076), (-0.336740017, -0.323849559), (-0.850127816, -0.184817672), (+0.687840700, -0.316632271), (+0.957695961, -0.303204417), (-0.897617340E-1, -0.770005941), (-0.925921321, -0.153110504), (+0.934314966, -0.251621485), (-0.526561618, -0.843809247), (+0.247843266E-1, -0.198450327)
323mean(0) = getMean(sample)
324mean(0) ! reference
325(+0.104660921, -0.267018020)
326var(0) = getVar(sample)
327var(0) ! reference
328+0.519154489
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.104660928, -0.267018050)
336varMerged
337+0.519154489
338call setVarMeanMerged(var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
339mean(2)
340(+0.104660928, -0.267018050)
341mean(0) ! reference
342(+0.104660921, -0.267018020)
343var(2)
344+0.519154489
345var(0) ! reference
346+0.519154489
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, +5
356ub
357+4, +11
358sample = cmplx(getUnifRand(-1., +1., ub(nsam)), getUnifRand(-1., +1., ub(nsam)), TKG)
359sample
360(-0.469204903, -0.226135015), (-0.386271119, +0.397879481), (-0.199822664, -0.411331773), (+0.356772304, +0.825235963), (+0.310785055, -0.351433516), (-0.238024712, -0.188817978), (-0.478876948, -0.407534361), (-0.495306730, -0.966156840), (-0.424324989, +0.835064173), (+0.737160206, -0.971837282), (-0.949585438, +0.102951050)
361mean(0) = getMean(sample)
362mean(0) ! reference
363(-0.203336373, -0.123828739)
364var(0) = getVar(sample)
365var(0) ! reference
366+0.557901859
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.203336358, -0.123828739)
374varMerged
375+0.557901859
376call setVarMeanMerged(var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
377mean(2)
378(-0.203336358, -0.123828739)
379mean(0) ! reference
380(-0.203336373, -0.123828739)
381var(2)
382+0.557901859
383var(0) ! reference
384+0.557901859
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, +6
399ub
400+5, +10
401sample = getUnifRand(0., 1., ub(nsam))
402sample
403+0.701505542E-1, +0.508313477, +0.663662851, +0.766035795, +0.129113495, +0.488194823E-1, +0.533005714, +0.840995431, +0.714910030E-1, +0.621918678
404iweight = getUnifRand(1, 10, size(sample, 1, IK))
405iweight
406+6, +6, +7, +10, +9, +3, +9, +7, +10, +6
407mean(0) = getMean(sample, iweight)
408mean(0) ! reference
409+0.441311032
410var(0) = getVar(sample, iweight)
411var(0) ! reference
412+0.869956687E-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.441311061
420varMerged
421+0.869956613E-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.441311061
425mean(0) ! reference
426+0.441311032
427var(2)
428+0.869956613E-1
429var(0) ! reference
430+0.869956687E-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, +6
442sample = getUnifRand(0., 1., ub(nsam))
443sample
444+0.596907258, +0.626886666, +0.858889878, +0.510622203, +0.609003961, +0.780717015
445iweight = getUnifRand(1, 10, size(sample, 1, IK))
446iweight
447+8, +5, +9, +1, +7, +4
448mean(0) = getMean(sample, iweight)
449mean(0) ! reference
450+0.692241669
451var(0) = getVar(sample, iweight)
452var(0) ! reference
453+0.134354997E-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.692241669
461varMerged
462+0.134354997E-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.692241669
466mean(0) ! reference
467+0.692241669
468var(2)
469+0.134354997E-1
470var(0) ! reference
471+0.134354997E-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, +3
481ub
482+2, +7
483sample = getUnifRand(0., 1., ub(nsam))
484sample
485+0.335113466, +0.973845780, +0.818820000E-1, +0.996913373, +0.634366870, +0.131615400E-1, +0.471685588
486iweight = getUnifRand(1, 10, size(sample, 1, IK))
487iweight
488+5, +4, +1, +6, +2, +5, +5
489mean(0) = getMean(sample, iweight)
490mean(0) ! reference
491+0.547402918
492var(0) = getVar(sample, iweight)
493var(0) ! reference
494+0.137595579
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.547402978
502varMerged
503+0.137595579
504call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
505mean(2)
506+0.547402978
507mean(0) ! reference
508+0.547402918
509var(2)
510+0.137595579
511var(0) ! reference
512+0.137595579
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, +6
522ub
523+5, +11
524sample = getUnifRand(0., 1., ub(nsam))
525sample
526+0.422895610, +0.638454258, +0.829345107, +0.559985995, +0.598645210E-1, +0.914627314E-2, +0.829150975, +0.150096893, +0.981886268, +0.852020204, +0.153485954
527iweight = getUnifRand(1, 10, size(sample, 1, IK))
528iweight
529+4, +6, +4, +8, +2, +9, +1, +2, +5, +7, +4
530mean(0) = getMean(sample, iweight)
531mean(0) ! reference
532+0.502663136
533var(0) = getVar(sample, iweight)
534var(0) ! reference
535+0.115749151
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.502663195
543varMerged
544+0.115749151
545call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
546mean(2)
547+0.502663195
548mean(0) ! reference
549+0.502663136
550var(2)
551+0.115749151
552var(0) ! reference
553+0.115749151
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, +4
563ub
564+3, +5
565sample = getUnifRand(0., 1., ub(nsam))
566sample
567+0.173784912, +0.158469498, +0.739210546, +0.495084107, +0.337988734E-1
568iweight = getUnifRand(1, 10, size(sample, 1, IK))
569iweight
570+9, +1, +4, +8, +10
571mean(0) = getMean(sample, iweight)
572mean(0) ! reference
573+0.280563682
574var(0) = getVar(sample, iweight)
575var(0) ! reference
576+0.605009720E-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.280563653
584varMerged
585+0.605009645E-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.280563653
589mean(0) ! reference
590+0.280563682
591var(2)
592+0.605009645E-1
593var(0) ! reference
594+0.605009720E-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, +3
604ub
605+2, +9
606sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
607sample
608(+0.558308482, -0.966540754), (+0.431492269, -0.113531291), (+0.833939731, -0.940448761), (+0.305300236, -0.650056243), (+0.320975304, -0.355702698), (+0.492913067, -0.250933945), (+0.995503962, -0.222379148), (+0.487275422, -0.607189894), (+0.863998532, -0.644135475E-1)
609iweight = getUnifRand(1, 10, size(sample, 1, IK))
610iweight
611+6, +3, +4, +1, +2, +6, +1, +1, +2
612mean(0) = getMean(sample, iweight)
613mean(0) ! reference
614(+0.580599725, -0.527965188)
615var(0) = getVar(sample, iweight)
616var(0) ! reference
617+0.166873232
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.580599666, -0.527965188)
625varMerged
626+0.166873217
627call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
628mean(2)
629(+0.580599666, -0.527965188)
630mean(0) ! reference
631(+0.580599725, -0.527965188)
632var(2)
633+0.166873217
634var(0) ! reference
635+0.166873232
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, +3
645ub
646+2, +6
647sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
648sample
649(+0.358182371, -0.448367715), (+0.775513649, -0.144074440), (+0.779866338, -0.909540296), (+0.611526370E-1, -0.319255292), (+0.598419309E-1, -0.532354891), (+0.359419882, -0.894570708)
650iweight = getUnifRand(1, 10, size(sample, 1, IK))
651iweight
652+10, +1, +3, +6, +2, +2
653mean(0) = getMean(sample, iweight)
654mean(0) ! reference
655(+0.329265654, -0.505239785)
656var(0) = getVar(sample, iweight)
657var(0) ! reference
658+0.106677353
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.329265654, -0.505239785)
666varMerged
667+0.106677361
668call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
669mean(2)
670(+0.329265654, -0.505239785)
671mean(0) ! reference
672(+0.329265654, -0.505239785)
673var(2)
674+0.106677361
675var(0) ! reference
676+0.106677353
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, +8
688sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
689sample
690(+0.711909115, -0.841032982), (+0.269236028, -0.573951840), (+0.687201858, -0.726742506), (+0.318318903, -0.564504802), (+0.490798354E-1, -0.957034111), (+0.461083829, -0.359048188), (+0.902928472, -0.827983439), (+0.382648230, -0.613879204)
691iweight = getUnifRand(1, 10, size(sample, 1, IK))
692iweight
693+7, +6, +7, +8, +8, +4, +10, +9
694mean(0) = getMean(sample, iweight)
695mean(0) ! reference
696(+0.485861659, -0.709006667)
697var(0) = getVar(sample, iweight)
698var(0) ! reference
699+0.103683129
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.485861659, -0.709006667)
707varMerged
708+0.103683144
709call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
710mean(2)
711(+0.485861659, -0.709006667)
712mean(0) ! reference
713(+0.485861659, -0.709006667)
714var(2)
715+0.103683144
716var(0) ! reference
717+0.103683129
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, +7
727ub
728+6, +11
729sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
730sample
731(+0.987938046E-1, -0.979642093), (+0.266931891, -0.334516943), (+0.602450013, -0.584214926E-2), (+0.656891644, -0.182013988), (+0.396838129, -0.253311217), (+0.639068127, -0.202912629), (+0.478952527E-1, -0.126890540), (+0.652961493, -0.565283179), (+0.987951398, -0.313381433), (+0.266513228, -0.516300797), (+0.464500844, -0.696025372)
732iweight = getUnifRand(1, 10, size(sample, 1, IK))
733iweight
734+9, +4, +1, +8, +4, +2, +3, +5, +4, +10, +4
735mean(0) = getMean(sample, iweight)
736mean(0) ! reference
737(+0.417840362, -0.471177638)
738var(0) = getVar(sample, iweight)
739var(0) ! reference
740+0.151217729
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.417840362, -0.471177667)
748varMerged
749+0.151217729
750call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
751mean(2)
752(+0.417840362, -0.471177667)
753mean(0) ! reference
754(+0.417840362, -0.471177638)
755var(2)
756+0.151217729
757var(0) ! reference
758+0.151217729
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, +7
770sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
771sample
772(+0.255483687, -0.863725185), (+0.252958536E-1, -0.131093144), (+0.827879131, -0.233905315E-1), (+0.141663313, -0.838022411), (+0.123178959E-1, -0.273090243), (+0.521687031, -0.840979874), (+0.168640614, -0.666367531)
773iweight = getUnifRand(1, 10, size(sample, 1, IK))
774iweight
775+4, +6, +10, +3, +8, +6, +1
776mean(0) = getMean(sample, iweight)
777mean(0) ! reference
778(+0.349336773, -0.391747385)
779var(0) = getVar(sample, iweight)
780var(0) ! reference
781+0.233056664
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.349336773, -0.391747385)
789varMerged
790+0.233056650
791call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
792mean(2)
793(+0.349336773, -0.391747385)
794mean(0) ! reference
795(+0.349336773, -0.391747385)
796var(2)
797+0.233056650
798var(0) ! reference
799+0.233056664
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, +8
814ub
815+7, +14
816sample = getUnifRand(0., 1., ub(nsam))
817sample
818+0.132835269, +0.871566176, +0.775098443, +0.907114089, +0.543647945, +0.767972767, +0.747309387, +0.377118051, +0.887677670, +0.682251513, +0.542521238, +0.744446516E-1, +0.393683314, +0.756820977
819rweight = getUnifRand(1., 2., size(sample, 1, IK))
820rweight
821+1.22699714, +1.18399847, +1.77490568, +1.27476716, +1.69784927, +1.09041381, +1.34542489, +1.66541398, +1.75653911, +1.59754062, +1.79350400, +1.21765828, +1.75040889, +1.15708590
822mean(0) = getMean(sample, rweight)
823mean(0) ! reference
824+0.603851974
825var(0) = getVar(sample, rweight)
826var(0) ! reference
827+0.622879639E-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.603851974
835varMerged
836+0.622879639E-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.603851974
840mean(0) ! reference
841+0.603851974
842var(2)
843+0.622879639E-1
844var(0) ! reference
845+0.622879639E-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, +7
855ub
856+6, +12
857sample = getUnifRand(0., 1., ub(nsam))
858sample
859+0.385523200, +0.151785374, +0.892585039, +0.805965960, +0.524945855, +0.951787770, +0.701613188, +0.747123420, +0.696798205, +0.673267841E-1, +0.535488605, +0.402875066
860rweight = getUnifRand(1., 2., size(sample, 1, IK))
861rweight
862+1.49040484, +1.00088000, +1.05744600, +1.19077814, +1.57509434, +1.39221954, +1.51680493, +1.29833269, +1.62845206, +1.46337569, +1.35242033, +1.58305430
863mean(0) = getMean(sample, rweight)
864mean(0) ! reference
865+0.568693519
866var(0) = getVar(sample, rweight)
867var(0) ! reference
868+0.674956143E-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.568693519
876varMerged
877+0.674956143E-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.568693519
881mean(0) ! reference
882+0.568693519
883var(2)
884+0.674956143E-1
885var(0) ! reference
886+0.674956143E-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, +4
896ub
897+3, +8
898sample = getUnifRand(0., 1., ub(nsam))
899sample
900+0.396233797E-2, +0.786422789, +0.471328497E-1, +0.602182388, +0.485928059, +0.486149132, +0.131243944, +0.834346592
901rweight = getUnifRand(1., 2., size(sample, 1, IK))
902rweight
903+1.84344220, +1.58568430, +1.44832397, +1.95216489, +1.72541952, +1.59418809, +1.16701436, +1.19981599
904mean(0) = getMean(sample, rweight)
905mean(0) ! reference
906+0.420724869
907var(0) = getVar(sample, rweight)
908var(0) ! reference
909+0.891571492E-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.420724869
917varMerged
918+0.891571566E-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.420724869
922mean(0) ! reference
923+0.420724869
924var(2)
925+0.891571566E-1
926var(0) ! reference
927+0.891571492E-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, +7
937ub
938+6, +10
939sample = getUnifRand(0., 1., ub(nsam))
940sample
941+0.205258787, +0.893208385E-1, +0.946596920, +0.893974543, +0.386933804, +0.815021157, +0.759558976, +0.529469252, +0.297594368, +0.870348871
942rweight = getUnifRand(1., 2., size(sample, 1, IK))
943rweight
944+1.13571191, +1.66045403, +1.64836907, +1.13851058, +1.44940674, +1.60287857, +1.35368907, +1.59423661, +1.40005064, +1.72472763
945mean(0) = getMean(sample, rweight)
946mean(0) ! reference
947+0.585859418
948var(0) = getVar(sample, rweight)
949var(0) ! reference
950+0.910973400E-1
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.585859418
958varMerged
959+0.910973251E-1
960call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
961mean(2)
962+0.585859418
963mean(0) ! reference
964+0.585859418
965var(2)
966+0.910973251E-1
967var(0) ! reference
968+0.910973400E-1
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, +3
978ub
979+2, +7
980sample = getUnifRand(0., 1., ub(nsam))
981sample
982+0.505931675, +0.527020872, +0.486540020, +0.537758350, +0.387741745, +0.720295787, +0.962912679
983rweight = getUnifRand(1., 2., size(sample, 1, IK))
984rweight
985+1.53134251, +1.26934409, +1.86794567, +1.85778236, +1.29841423, +1.20967221, +1.44157910
986mean(0) = getMean(sample, rweight)
987mean(0) ! reference
988+0.583661079
989var(0) = getVar(sample, rweight)
990var(0) ! reference
991+0.300327372E-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.583661079
999varMerged
1000+0.300327390E-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.583661079
1004mean(0) ! reference
1005+0.583661079
1006var(2)
1007+0.300327390E-1
1008var(0) ! reference
1009+0.300327372E-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, +7
1019ub
1020+6, +9
1021sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
1022sample
1023(+0.145176530, -0.660803080), (+0.692834854E-1, -0.524664700), (+0.921244144, -0.426119447), (+0.899475634, -0.535263300), (+0.473420918, -0.416758120), (+0.604838371, -0.511714697), (+0.342711806E-1, -0.805644035), (+0.487457275, -0.203567863), (+0.541109562, -0.115936935)
1024rweight = getUnifRand(1., 2., size(sample, 1, IK))
1025rweight
1026+1.60351181, +1.49233472, +1.12591147, +1.94855857, +1.01515245, +1.90431690, +1.26000714, +1.62076271, +1.59752035
1027mean(0) = getMean(sample, rweight)
1028mean(0) ! reference
1029(+0.475835502, -0.463820279)
1030var(0) = getVar(sample, rweight)
1031var(0) ! reference
1032+0.133821428
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.475835532, -0.463820308)
1040varMerged
1041+0.133821428
1042call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1043mean(2)
1044(+0.475835532, -0.463820308)
1045mean(0) ! reference
1046(+0.475835502, -0.463820279)
1047var(2)
1048+0.133821428
1049var(0) ! reference
1050+0.133821428
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, +7
1060ub
1061+6, +9
1062sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
1063sample
1064(+0.241394639E-1, -0.748961091), (+0.253201246, -0.899627328), (+0.212384999, -0.271962345), (+0.300542712E-1, -0.374002814), (+0.996819735, -0.791645885), (+0.634574950, -0.480429113), (+0.174930692, -0.407218218), (+0.213004172, -0.684497714), (+0.827396333, -0.463329673)
1065rweight = getUnifRand(1., 2., size(sample, 1, IK))
1066rweight
1067+1.38830280, +1.45451522, +1.05288303, +1.00300562, +1.94611835, +1.98834896, +1.67692256, +1.29554772, +1.89863777
1068mean(0) = getMean(sample, rweight)
1069mean(0) ! reference
1070(+0.437634945, -0.580478609)
1071var(0) = getVar(sample, rweight)
1072var(0) ! reference
1073+0.159782201
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.437634945, -0.580478609)
1081varMerged
1082+0.159782201
1083call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1084mean(2)
1085(+0.437634945, -0.580478609)
1086mean(0) ! reference
1087(+0.437634945, -0.580478609)
1088var(2)
1089+0.159782201
1090var(0) ! reference
1091+0.159782201
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.249018967, -0.886792243), (+0.673844218, -0.468544424), (+0.427544892, -0.629629791), (+0.420058727, -0.593061984)
1106rweight = getUnifRand(1., 2., size(sample, 1, IK))
1107rweight
1108+1.14002752, +1.65599191, +1.93492341, +1.00124562
1109mean(0) = getMean(sample, rweight)
1110mean(0) ! reference
1111(+0.461886048, -0.627850950)
1112var(0) = getVar(sample, rweight)
1113var(0) ! reference
1114+0.435736962E-1
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.461885989, -0.627850771)
1122varMerged
1123+0.435736999E-1
1124call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1125mean(2)
1126(+0.461885989, -0.627850771)
1127mean(0) ! reference
1128(+0.461886048, -0.627850950)
1129var(2)
1130+0.435736999E-1
1131var(0) ! reference
1132+0.435736962E-1
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, +4
1142ub
1143+3, +5
1144sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
1145sample
1146(+0.250425339, -0.129961252), (+0.458485603, -0.416625142), (+0.632188916E-1, -0.594669700), (+0.932048678, -0.610012352), (+0.471760213, -0.339183271)
1147rweight = getUnifRand(1., 2., size(sample, 1, IK))
1148rweight
1149+1.15344775, +1.08451664, +1.01332998, +1.51756334, +1.98186207
1150mean(0) = getMean(sample, rweight)
1151mean(0) ! reference
1152(+0.473957717, -0.415108919)
1153var(0) = getVar(sample, rweight)
1154var(0) ! reference
1155+0.110039875
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.473957747, -0.415108919)
1163varMerged
1164+0.110039860
1165call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1166mean(2)
1167(+0.473957747, -0.415108919)
1168mean(0) ! reference
1169(+0.473957717, -0.415108919)
1170var(2)
1171+0.110039860
1172var(0) ! reference
1173+0.110039875
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, +8
1183ub
1184+7, +11
1185sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
1186sample
1187(+0.696598232, -0.151467144), (+0.351984441, -0.814055145), (+0.195879579, -0.724640489E-1), (+0.489833176, -0.436737955), (+0.415061951, -0.887042761), (+0.775786877, -0.510850668), (+0.603616834E-1, -0.516502917), (+0.781464994, -0.820315003), (+0.767220140, -0.678626120), (+0.124815583, -0.825029254), (+0.707865298, -0.177748680)
1188rweight = getUnifRand(1., 2., size(sample, 1, IK))
1189rweight
1190+1.26175809, +1.50726783, +1.10619044, +1.21604908, +1.07151687, +1.50455964, +1.44589996, +1.75267696, +1.71240234, +1.86201596, +1.35395122
1191mean(0) = getMean(sample, rweight)
1192mean(0) ! reference
1193(+0.493553340, -0.561720431)
1194var(0) = getVar(sample, rweight)
1195var(0) ! reference
1196+0.148701340
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.493553370, -0.561720490)
1204varMerged
1205+0.148701355
1206call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1207mean(2)
1208(+0.493553370, -0.561720490)
1209mean(0) ! reference
1210(+0.493553340, -0.561720431)
1211var(2)
1212+0.148701355
1213var(0) ! reference
1214+0.148701340
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, +7
1229ub
1230+6, +12
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.570608616, +0.675416708, -0.163809419, -0.802026868, -0.547761559, -0.428141832, +0.572813749, -0.458337426, +0.981060028, -0.695358515E-1, +0.697120309, +0.756303191
1239+0.906565428, -0.143327832, +0.664473534, +0.984296799, +0.238204002E-2, -0.258529186E-2, -0.227514029, -0.142592907, +0.709088087, -0.233941197, -0.793683529E-1, -0.150048971
1240-0.234442353, +0.343202591, -0.364820242, -0.501162410, +0.282548547, -0.394223213, +0.944659948, +0.677477837, -0.858391404, +0.300633073, +0.537209749, -0.730628252
1241+0.190780878, +0.407610297, +0.868038416, -0.713467598, -0.633225083, -0.814587235, -0.424451947, -0.432472467, +0.591823578, -0.381223917, +0.866687894, +0.506100178
1242mean(:,0) = getVar(sample, dim)
1243mean(:,0) ! reference
1244+0.372023791, +0.206266508, +0.316103399, +0.366631389
1245var(:,0) = getVar(sample, dim)
1246var(:,0) ! reference
1247+0.372023791, +0.206266508, +0.316103399, +0.366631389
1248do isam = 1, nsam
1249 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
1250 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1251end do
1252call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1253meanMerged
1254+0.535410345E-1, +0.190618947, +0.171989202E-3, +0.263441727E-2
1255varMerged
1256+0.372023761, +0.206266522, +0.316103429, +0.366631478
1257call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1258mean(:,2)
1259+0.535410345E-1, +0.190618947, +0.171989202E-3, +0.263441727E-2
1260mean(:,0) ! reference
1261+0.372023791, +0.206266508, +0.316103399, +0.366631389
1262var(:,2)
1263+0.372023761, +0.206266522, +0.316103429, +0.366631478
1264var(:,0) ! reference
1265+0.372023791, +0.206266508, +0.316103399, +0.366631389
1266
1267
1268dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1269do isam = 2, nsam
1270 lb(isam) = ub(isam - 1) + 1
1271 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1272end do
1273lb
1274+1, +7
1275ub
1276+6, +11
1277ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1278call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1279call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1280call setResized(meanMerged, ndim)
1281call setResized(varMerged, ndim)
1282sample = getUnifRand(-1., +1., ndim, ub(nsam))
1283sample
1284-0.198064446, +0.768524408, +0.742618203, +0.121566653, -0.900667667, +0.927079678, -0.633963943, -0.243025899, -0.536290526, -0.385016203, +0.517682433
1285+0.684239268, +0.452968359, -0.334908366, +0.884241700, -0.339524150, +0.318077445, +0.398446679, +0.705309868, -0.652336001, +0.873479366, -0.704910636
1286+0.231283426, -0.993956685, -0.377762198, +0.996484756, +0.922268987, -0.468881488, -0.532686472, +0.379623652, +0.192734599, -0.779746652, -0.686498404
1287+0.555513859, -0.874228358, +0.641492367, -0.966796875, -0.167724371, -0.281463385, -0.187046528, +0.462629318, -0.903140664, -0.585864186, +0.186347246
1288-0.391743898, -0.367374539, -0.208756328, +0.875955343, -0.575002909, +0.215983987, +0.113589287, +0.494155407, -0.581278324, -0.652141809, -0.327089787
1289mean(:,0) = getVar(sample, dim)
1290mean(:,0) ! reference
1291+0.366240978, +0.331890732, +0.425309509, +0.323670864, +0.220428124
1292var(:,0) = getVar(sample, dim)
1293var(:,0) ! reference
1294+0.366240978, +0.331890732, +0.425309509, +0.323670864, +0.220428124
1295do isam = 1, nsam
1296 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
1297 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1298end do
1299call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1300meanMerged
1301+0.164038837E-1, +0.207734868, -0.101557851, -0.192752868, -0.127609417
1302varMerged
1303+0.366240978, +0.331890762, +0.425309509, +0.323670864, +0.220428124
1304call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1305mean(:,2)
1306+0.164038837E-1, +0.207734868, -0.101557851, -0.192752868, -0.127609417
1307mean(:,0) ! reference
1308+0.366240978, +0.331890732, +0.425309509, +0.323670864, +0.220428124
1309var(:,2)
1310+0.366240978, +0.331890762, +0.425309509, +0.323670864, +0.220428124
1311var(:,0) ! reference
1312+0.366240978, +0.331890732, +0.425309509, +0.323670864, +0.220428124
1313
1314
1315dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1316do isam = 2, nsam
1317 lb(isam) = ub(isam - 1) + 1
1318 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1319end do
1320lb
1321+1, +6
1322ub
1323+5, +10
1324ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1325call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1326call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1327call setResized(meanMerged, ndim)
1328call setResized(varMerged, ndim)
1329sample = getUnifRand(-1., +1., ndim, ub(nsam))
1330sample
1331-0.733980417, +0.220873356, +0.705661774E-1, -0.930365682, -0.260853529, +0.121442318, -0.746704340, +0.809055090, -0.312913179, -0.379979134
1332+0.967878699, -0.995480657, -0.514481068, +0.385277390, +0.868398070, -0.232316852, -0.387186408, -0.363729596, +0.156839728, -0.657453895
1333+0.159905434, +0.936452389, -0.908508658, +0.742283940, -0.996107817, -0.376083970, -0.948874116, +0.368551731, -0.131752729, +0.268749952
1334mean(:,0) = getVar(sample, dim)
1335mean(:,0) ! reference
1336+0.253611654, +0.382840604, +0.445994347
1337var(:,0) = getVar(sample, dim)
1338var(:,0) ! reference
1339+0.253611654, +0.382840604, +0.445994347
1340do isam = 1, nsam
1341 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
1342 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1343end do
1344call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1345meanMerged
1346-0.214285940, -0.772254616E-1, -0.885383859E-1
1347varMerged
1348+0.253611684, +0.382840604, +0.445994377
1349call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1350mean(:,2)
1351-0.214285940, -0.772254616E-1, -0.885383859E-1
1352mean(:,0) ! reference
1353+0.253611654, +0.382840604, +0.445994347
1354var(:,2)
1355+0.253611684, +0.382840604, +0.445994377
1356var(:,0) ! reference
1357+0.253611654, +0.382840604, +0.445994347
1358
1359
1360dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1361do isam = 2, nsam
1362 lb(isam) = ub(isam - 1) + 1
1363 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1364end do
1365lb
1366+1, +6
1367ub
1368+5, +9
1369ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1370call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1371call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1372call setResized(meanMerged, ndim)
1373call setResized(varMerged, ndim)
1374sample = getUnifRand(-1., +1., ndim, ub(nsam))
1375sample
1376-0.391397357, -0.780349255, -0.994454741, +0.432119727, -0.498739243, +0.468208075, -0.162101746, -0.750038147, -0.421194196
1377-0.859986186, +0.905458093, -0.874813318, +0.260806799, -0.255131245, -0.267907381E-1, +0.528946638, -0.310597420E-1, +0.246540189
1378-0.824371576, -0.370334029, -0.775911689, -0.134080410, -0.629742146, +0.115792513, +0.815453649, +0.442279935, +0.325032949
1379mean(:,0) = getVar(sample, dim)
1380mean(:,0) ! reference
1381+0.233959883, +0.310982347, +0.299303383
1382var(:,0) = getVar(sample, dim)
1383var(:,0) ! reference
1384+0.233959883, +0.310982347, +0.299303383
1385do isam = 1, nsam
1386 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
1387 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1388end do
1389call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1390meanMerged
1391-0.344216347, -0.117810667E-1, -0.115097925
1392varMerged
1393+0.233959913, +0.310982287, +0.299303383
1394call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1395mean(:,2)
1396-0.344216347, -0.117810667E-1, -0.115097925
1397mean(:,0) ! reference
1398+0.233959883, +0.310982347, +0.299303383
1399var(:,2)
1400+0.233959913, +0.310982287, +0.299303383
1401var(:,0) ! reference
1402+0.233959883, +0.310982347, +0.299303383
1403
1404
1405dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1406do isam = 2, nsam
1407 lb(isam) = ub(isam - 1) + 1
1408 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1409end do
1410lb
1411+1, +7
1412ub
1413+6, +12
1414ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1415call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1416call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1417call setResized(meanMerged, ndim)
1418call setResized(varMerged, ndim)
1419sample = getUnifRand(-1., +1., ndim, ub(nsam))
1420sample
1421+0.451260448, +0.164513469, -0.960693836, -0.870253563, +0.790205956, -0.480660558, +0.349469781, -0.255658627, -0.658975244, +0.765295744, +0.696326494, -0.225577593
1422+0.644545436, -0.361717820, +0.253141046, -0.361308336, -0.304139733, -0.106402755, -0.689066410, -0.332611322, -0.630419612, +0.311856151, +0.297372699, -0.506169677
1423-0.651966453, +0.893635392, +0.769273162, +0.974689603, +0.491271257, +0.337114096, +0.880771518, -0.420863628, +0.387925386, +0.828147173, +0.746145725, -0.212368965E-1
1424-0.171720624, +0.297471642, -0.738940716, +0.352876902, +0.774282098, +0.510579348E-1, -0.386298180, -0.415090084, -0.784314513, -0.234966278, -0.503809214, +0.400666714
1425mean(:,0) = getVar(sample, dim)
1426mean(:,0) ! reference
1427+0.375417918, +0.166999549, +0.266712606, +0.220253050
1428var(:,0) = getVar(sample, dim)
1429var(:,0) ! reference
1430+0.375417918, +0.166999549, +0.266712606, +0.220253050
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.195622966E-1, -0.148743376, +0.434575558, -0.113232024
1438varMerged
1439+0.375417888, +0.166999534, +0.266712606, +0.220253065
1440call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1441mean(:,2)
1442-0.195622966E-1, -0.148743376, +0.434575558, -0.113232024
1443mean(:,0) ! reference
1444+0.375417918, +0.166999549, +0.266712606, +0.220253050
1445var(:,2)
1446+0.375417888, +0.166999534, +0.266712606, +0.220253065
1447var(:,0) ! reference
1448+0.375417918, +0.166999549, +0.266712606, +0.220253050
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.708938837, +0.980327129E-1), (-0.924321532, +0.479047537), (+0.104315042, -0.662882566), (-0.450479746, -0.201500297), (+0.158873439, -0.995260477), (+0.699761391, +0.911204696), (-0.761709929, +0.383452296), (-0.848575950, -0.539494991), (+0.271999836E-1, -0.936723351), (+0.710724354, -0.737433195), (+0.711115479, -0.725450635), (+0.972269654, +0.924230099)
1468(-0.565981865E-1, +0.815899372E-1), (+0.872570276E-1, +0.425625563), (-0.806717873, +0.125844836), (-0.557448149, -0.142672181), (-0.653195381, +0.438984632E-1), (+0.552690148, +0.368763685), (-0.980175376, +0.280068398), (-0.371327162, -0.705181599), (+0.382043242, +0.251434803), (-0.748343825, -0.987675548), (+0.744850636, -0.444601774E-1), (-0.942539215, +0.488317251)
1469(+0.161114335, +0.863405824), (-0.493856549, -0.442769885), (-0.977207303, +0.941724658), (+0.889150858, +0.110981703), (-0.359890461E-1, +0.494186878E-1), (-0.536718369E-1, -0.452726960), (-0.519217491, +0.838698626), (+0.714398623, -0.209985971), (+0.117011547, +0.412513375), (-0.108324051, +0.370464921), (-0.530766487, +0.440888882), (+0.227494478, +0.885441184)
1470mean(:,0) = getVar(sample, dim)
1471mean(:,0) ! reference
1472(+0.890501916, +0.00000000), (+0.519272327, +0.00000000), (+0.500029445, +0.00000000)
1473var(:,0) = getVar(sample, dim)
1474var(:,0) ! reference
1475+0.890501916, +0.519272327, +0.500029445
1476do isam = 1, nsam
1477 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
1478 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1479end do
1480call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1481meanMerged
1482(+0.923426002E-1, -0.166898191), (-0.279125363, +0.154627804E-1), (-0.508219115E-1, +0.317337930)
1483varMerged
1484+0.890501976, +0.519272327, +0.500029385
1485call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1486mean(:,2)
1487(+0.923426002E-1, -0.166898191), (-0.279125363, +0.154627804E-1), (-0.508219115E-1, +0.317337930)
1488mean(:,0) ! reference
1489(+0.890501916, +0.00000000), (+0.519272327, +0.00000000), (+0.500029445, +0.00000000)
1490var(:,2)
1491+0.890501976, +0.519272327, +0.500029385
1492var(:,0) ! reference
1493+0.890501916, +0.519272327, +0.500029445
1494
1495
1496dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1497do isam = 2, nsam
1498 lb(isam) = ub(isam - 1) + 1
1499 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1500end do
1501lb
1502+1, +7
1503ub
1504+6, +9
1505ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1506call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1507call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1508call setResized(meanMerged, ndim)
1509call setResized(varMerged, ndim)
1510sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), -getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
1511sample
1512(+0.311143398, +0.287746310), (+0.720918179, -0.669847727), (+0.921264529, +0.902947783), (+0.822313190, +0.115751386), (+0.172635436, -0.611301661), (-0.496295691, +0.567029834), (-0.185497999, +0.949335456), (-0.137009382, -0.287378669), (-0.327829003, +0.408045769)
1513(+0.594884634, +0.681057692), (+0.453624964, -0.169391751), (+0.722884059, -0.967143655), (+0.447205663, +0.789178729), (+0.945359588, -0.725185513), (+0.524694324, -0.753357410E-1), (+0.708276033, -0.359918952), (+0.151876926, +0.330070257E-1), (-0.518776774, -0.649529576)
1514mean(:,0) = getVar(sample, dim)
1515mean(:,0) ! reference
1516(+0.568475187, +0.00000000), (+0.482650429, +0.00000000)
1517var(:,0) = getVar(sample, dim)
1518var(:,0) ! reference
1519+0.568475187, +0.482650429
1520do isam = 1, nsam
1521 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
1522 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1523end do
1524call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1525meanMerged
1526(+0.200182498, +0.184703171), (+0.447781116, -0.160362422)
1527varMerged
1528+0.568475187, +0.482650489
1529call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1530mean(:,2)
1531(+0.200182498, +0.184703171), (+0.447781116, -0.160362422)
1532mean(:,0) ! reference
1533(+0.568475187, +0.00000000), (+0.482650429, +0.00000000)
1534var(:,2)
1535+0.568475187, +0.482650489
1536var(:,0) ! reference
1537+0.568475187, +0.482650429
1538
1539
1540dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1541do isam = 2, nsam
1542 lb(isam) = ub(isam - 1) + 1
1543 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1544end do
1545lb
1546+1, +5
1547ub
1548+4, +8
1549ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1550call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1551call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1552call setResized(meanMerged, ndim)
1553call setResized(varMerged, ndim)
1554sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), -getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
1555sample
1556(+0.306442738, +0.189242601), (-0.408270478, -0.456912518E-1), (-0.774794340, -0.182201385), (+0.774901152, -0.154981256), (+0.926655293, -0.959957838), (-0.581163883, +0.320434570), (+0.976084471, -0.166413426), (+0.963932514, -0.899747252)
1557(-0.148268223, +0.941319466), (-0.329217434, +0.995504856E-1), (+0.867909074, -0.641895890), (-0.661823273, -0.172607541), (+0.789202332, -0.522391677), (+0.344987035, -0.615784526), (+0.667946815, -0.561349392), (-0.616312027, -0.461088419)
1558(+0.776370406, +0.209825516), (-0.877985239, -0.493369102), (+0.319053888, -0.559168577), (-0.170212269, +0.105321884), (+0.215400338, +0.612124801), (+0.863628745, -0.174503326E-1), (+0.636769056, -0.809957981E-1), (-0.952144265, +0.484073400)
1559mean(:,0) = getVar(sample, dim)
1560mean(:,0) ! reference
1561(+0.681153774, +0.00000000), (+0.604365468, +0.00000000), (+0.593138516, +0.00000000)
1562var(:,0) = getVar(sample, dim)
1563var(:,0) ! reference
1564+0.681153774, +0.604365468, +0.593138516
1565do isam = 1, nsam
1566 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
1567 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1568end do
1569call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1570meanMerged
1571(+0.272973418, -0.237414405), (+0.114303038, -0.241780937), (+0.101360083, +0.325452238E-1)
1572varMerged
1573+0.681153774, +0.604365468, +0.593138516
1574call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1575mean(:,2)
1576(+0.272973418, -0.237414405), (+0.114303038, -0.241780937), (+0.101360083, +0.325452238E-1)
1577mean(:,0) ! reference
1578(+0.681153774, +0.00000000), (+0.604365468, +0.00000000), (+0.593138516, +0.00000000)
1579var(:,2)
1580+0.681153774, +0.604365468, +0.593138516
1581var(:,0) ! reference
1582+0.681153774, +0.604365468, +0.593138516
1583
1584
1585dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1586do isam = 2, nsam
1587 lb(isam) = ub(isam - 1) + 1
1588 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1589end do
1590lb
1591+1, +3
1592ub
1593+2, +5
1594ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1595call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1596call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1597call setResized(meanMerged, ndim)
1598call setResized(varMerged, ndim)
1599sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), -getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
1600sample
1601(+0.247238517, +0.610701203), (-0.640613317, -0.935794592), (+0.394376397, -0.115625262), (-0.587054491, -0.577535629), (+0.980075121, +0.346717834)
1602(+0.954605818, +0.142347932), (-0.986769915, +0.236298442), (+0.558357835, -0.868416548), (+0.314701915, -0.461686611), (-0.801762462, -0.174276114)
1603mean(:,0) = getVar(sample, dim)
1604mean(:,0) ! reference
1605(+0.705355942, +0.00000000), (+0.751724720, +0.00000000)
1606var(:,0) = getVar(sample, dim)
1607var(:,0) ! reference
1608+0.705355942, +0.751724720
1609do isam = 1, nsam
1610 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
1611 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1612end do
1613call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1614meanMerged
1615(+0.788044557E-1, -0.134307295), (+0.782663934E-2, -0.225146592)
1616varMerged
1617+0.705355942, +0.751724720
1618call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1619mean(:,2)
1620(+0.788044557E-1, -0.134307295), (+0.782663934E-2, -0.225146592)
1621mean(:,0) ! reference
1622(+0.705355942, +0.00000000), (+0.751724720, +0.00000000)
1623var(:,2)
1624+0.705355942, +0.751724720
1625var(:,0) ! reference
1626+0.705355942, +0.751724720
1627
1628
1629dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1630do isam = 2, nsam
1631 lb(isam) = ub(isam - 1) + 1
1632 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1633end do
1634lb
1635+1, +8
1636ub
1637+7, +14
1638ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1639call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1640call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1641call setResized(meanMerged, ndim)
1642call setResized(varMerged, ndim)
1643sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), -getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
1644sample
1645(+0.856890440, -0.490403175E-1), (+0.718236327, +0.524100900), (-0.248575568, +0.268548489), (+0.416871309E-1, +0.715802431), (+0.740246058, +0.924347878), (+0.884647012, -0.448606730), (+0.500938654, -0.372393489), (-0.412594795, -0.208508968E-2), (+0.113506794, -0.542204380), (+0.669341445, -0.732465744), (-0.178781509, -0.855404735), (+0.158480763, -0.499247909), (+0.834518552, +0.884781122), (-0.142487288, -0.461006999)
1646(-0.611880779, -0.993985534), (-0.522553086, -0.797483683), (+0.933434248, -0.483306527), (+0.592481017, -0.191176653), (-0.561063528, +0.138047934), (-0.257870793, +0.194875836), (-0.847551227, -0.249189138), (+0.396483064, -0.201806784), (+0.463735700, -0.123342276), (+0.726840854, -0.138390064E-2), (-0.649074316, +0.171899796E-3), (+0.864689350, +0.398747683), (+0.732292056, -0.210368633), (+0.433479428, -0.353328705)
1647(-0.596066475, +0.702168226), (-0.188647985, +0.911810160), (+0.281507850, -0.289162636), (-0.960518479, +0.269275546), (+0.534915090, -0.406154633), (+0.228640437, +0.345700979E-1), (-0.182289600, +0.754129410), (+0.458452463, -0.987875342), (+0.141619444E-1, +0.751466393), (-0.222136378, -0.706570745), (-0.665147305E-1, -0.525144339E-1), (+0.644420862, -0.619089365), (-0.595894456, -0.650249839), (+0.588416100, -0.244156480)
1648(-0.947491407, -0.563382745), (+0.752323866E-1, +0.162655711), (-0.585341215, +0.216125369), (+0.354057908, -0.403559685), (-0.717535377, +0.939658403), (-0.951790333, -0.209264755E-1), (+0.815111399E-1, +0.376382709), (+0.119042754, +0.302561879), (-0.591803551, +0.123224258E-1), (+0.290428281, -0.850999355), (-0.905217886, -0.105225444), (-0.778061271, +0.663255811), (-0.500804663, -0.361918688), (-0.243679523, -0.772237182)
1649(-0.830654383, +0.855064392E-2), (-0.668837905, -0.609842062), (+0.419236183, +0.267866254), (-0.249668717, -0.249500275), (-0.266205907, +0.994796872), (+0.664550900, -0.750518441), (-0.477214098, +0.366944194), (+0.571788549E-1, +0.474823833), (-0.818850994, +0.601587534), (-0.284951329, -0.208082199E-1), (+0.575290322, +0.134705782), (-0.734091997, -0.597382188), (-0.297503591, -0.556348681), (-0.974138498, +0.244824529)
1650(+0.504840970, +0.295762420), (+0.703120351, -0.140813828), (-0.848550200, +0.916029096), (+0.703745604, -0.670585155), (-0.504484296, -0.516318440), (+0.523175716, -0.849095225), (+0.782299399, +0.903025270), (+0.752710104E-1, +0.222058892), (-0.134832144, +0.582396984E-1), (+0.748358846, -0.567143679), (-0.822734594, +0.137550831E-1), (+0.184288621, -0.326400042), (-0.662105322, +0.947598934), (+0.766210318, +0.984210491)
1651(+0.600237846E-1, +0.634237051), (-0.369559050, +0.583212495), (+0.594230533, +0.182673454), (+0.218378663, +0.485051990), (-0.721718788, +0.299176693), (+0.358669519, -0.637195587), (+0.142412186, -0.702309251), (-0.616012573, -0.941839695), (+0.523600578, +0.556039333), (+0.322596669, +0.165075064E-1), (-0.574337006, -0.401206851), (+0.186293006, -0.686942577), (-0.586453915, -0.788111210), (+0.995441675E-1, +0.980508685)
1652mean(:,0) = getVar(sample, dim)
1653mean(:,0) ! reference
1654(+0.547388613, +0.00000000), (+0.526126087, +0.00000000), (+0.589167237, +0.00000000), (+0.466854274, +0.00000000), (+0.515594602, +0.00000000), (+0.754673123, +0.00000000), (+0.576898754, +0.00000000)
1655var(:,0) = getVar(sample, dim)
1656var(:,0) ! reference
1657+0.547388613, +0.526126087, +0.589167237, +0.466854274, +0.515594602, +0.754673123, +0.576898754
1658do isam = 1, nsam
1659 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
1660 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1661end do
1662call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1663meanMerged
1664(+0.324003845, -0.460624397E-1), (+0.120960154, -0.205252036), (-0.439666584E-2, -0.380252600E-1), (-0.378675222, -0.289490931E-1), (-0.277561516, +0.221214127E-1), (+0.144186035, +0.907374024E-1), (-0.258808751E-1, -0.300141461E-1)
1665varMerged
1666+0.547388673, +0.526126146, +0.589167178, +0.466854274, +0.515594661, +0.754673183, +0.576898754
1667call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1668mean(:,2)
1669(+0.324003845, -0.460624397E-1), (+0.120960154, -0.205252036), (-0.439666584E-2, -0.380252600E-1), (-0.378675222, -0.289490931E-1), (-0.277561516, +0.221214127E-1), (+0.144186035, +0.907374024E-1), (-0.258808751E-1, -0.300141461E-1)
1670mean(:,0) ! reference
1671(+0.547388613, +0.00000000), (+0.526126087, +0.00000000), (+0.589167237, +0.00000000), (+0.466854274, +0.00000000), (+0.515594602, +0.00000000), (+0.754673123, +0.00000000), (+0.576898754, +0.00000000)
1672var(:,2)
1673+0.547388673, +0.526126146, +0.589167178, +0.466854274, +0.515594661, +0.754673183, +0.576898754
1674var(:,0) ! reference
1675+0.547388613, +0.526126087, +0.589167237, +0.466854274, +0.515594602, +0.754673123, +0.576898754
1676
1677
1678!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1679!Compute the biased merged variance and mean of a frequency weighted multivariate sample.
1680!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1681
1682
1683dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1684do isam = 2, nsam
1685 lb(isam) = ub(isam - 1) + 1
1686 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1687end do
1688lb
1689+1, +5
1690ub
1691+4, +9
1692ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1693call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1694call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1695call setResized(meanMerged, ndim)
1696call setResized(varMerged, ndim)
1697sample = getUnifRand(-1., +1., ndim, ub(nsam))
1698sample
1699+0.522794724E-1, +0.153267503, -0.134702325, +0.373363495E-1, +0.566733122, +0.969388008, -0.616841316E-1, +0.224414587, +0.773656011
1700iweight = getUnifRand(1, 10, size(sample, dim, IK))
1701iweight
1702+6, +6, +5, +5, +1, +1, +4, +6, +4
1703mean(:,0) = getVar(sample, 2_IK, iweight)
1704mean(:,0) ! reference
1705+0.821982399E-1
1706var(:,0) = getVar(sample, 2_IK, iweight)
1707var(:,0) ! reference
1708+0.821982399E-1
1709do isam = 1, nsam
1710 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1711 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1712end do
1713call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1714meanMerged
1715+0.170446008
1716varMerged
1717+0.821982473E-1
1718call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1719mean(:,2)
1720+0.170446008
1721mean(:,0) ! reference
1722+0.821982399E-1
1723var(:,2)
1724+0.821982473E-1
1725var(:,0) ! reference
1726+0.821982399E-1
1727
1728
1729dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1730do isam = 2, nsam
1731 lb(isam) = ub(isam - 1) + 1
1732 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1733end do
1734lb
1735+1, +7
1736ub
1737+6, +9
1738ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1739call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1740call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1741call setResized(meanMerged, ndim)
1742call setResized(varMerged, ndim)
1743sample = getUnifRand(-1., +1., ndim, ub(nsam))
1744sample
1745-0.570963502, +0.964597464E-1, -0.679204464, -0.232602835, -0.343416929E-1, +0.154638767, +0.782876015E-1, +0.408737779, +0.418470860
1746-0.307726383, +0.327098966, +0.862802744, -0.440959334, +0.166064858, +0.640824199, -0.450722575, +0.597437978, +0.669330835
1747-0.603263021, +0.877526879, +0.853389502, +0.871057749, -0.964670777, +0.230766535, -0.682824969, +0.928448558, +0.677766800E-1
1748iweight = getUnifRand(1, 10, size(sample, dim, IK))
1749iweight
1750+7, +10, +6, +4, +6, +8, +7, +5, +2
1751mean(:,0) = getVar(sample, 2_IK, iweight)
1752mean(:,0) ! reference
1753+0.119153544, +0.217978030, +0.540034652
1754var(:,0) = getVar(sample, 2_IK, iweight)
1755var(:,0) ! reference
1756+0.119153544, +0.217978030, +0.540034652
1757do isam = 1, nsam
1758 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1759 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1760end do
1761call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1762meanMerged
1763-0.650560111E-1, +0.214975640, +0.167511329
1764varMerged
1765+0.119153544, +0.217978045, +0.540034652
1766call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1767mean(:,2)
1768-0.650560111E-1, +0.214975640, +0.167511329
1769mean(:,0) ! reference
1770+0.119153544, +0.217978030, +0.540034652
1771var(:,2)
1772+0.119153544, +0.217978045, +0.540034652
1773var(:,0) ! reference
1774+0.119153544, +0.217978030, +0.540034652
1775
1776
1777dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1778do isam = 2, nsam
1779 lb(isam) = ub(isam - 1) + 1
1780 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1781end do
1782lb
1783+1, +6
1784ub
1785+5, +7
1786ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1787call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1788call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1789call setResized(meanMerged, ndim)
1790call setResized(varMerged, ndim)
1791sample = getUnifRand(-1., +1., ndim, ub(nsam))
1792sample
1793+0.546933293, +0.418845415, -0.787886024, -0.172190905, +0.285366893, +0.508416176, +0.874050260
1794iweight = getUnifRand(1, 10, size(sample, dim, IK))
1795iweight
1796+10, +5, +6, +8, +2, +3, +3
1797mean(:,0) = getVar(sample, 2_IK, iweight)
1798mean(:,0) ! reference
1799+0.271063447
1800var(:,0) = getVar(sample, 2_IK, iweight)
1801var(:,0) ! reference
1802+0.271063447
1803do isam = 1, nsam
1804 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1805 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1806end do
1807call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1808meanMerged
1809+0.166941911
1810varMerged
1811+0.271063447
1812call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1813mean(:,2)
1814+0.166941911
1815mean(:,0) ! reference
1816+0.271063447
1817var(:,2)
1818+0.271063447
1819var(:,0) ! reference
1820+0.271063447
1821
1822
1823dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1824do isam = 2, nsam
1825 lb(isam) = ub(isam - 1) + 1
1826 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1827end do
1828lb
1829+1, +4
1830ub
1831+3, +7
1832ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1833call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1834call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1835call setResized(meanMerged, ndim)
1836call setResized(varMerged, ndim)
1837sample = getUnifRand(-1., +1., ndim, ub(nsam))
1838sample
1839-0.166950583, +0.194709539, +0.299114347, -0.882601023, +0.727581859, +0.414275050, +0.435259938
1840+0.730232477, +0.173224211, +0.267280817, -0.970619082, +0.199766159, +0.750456095, -0.308331966
1841-0.763034821E-2, +0.906845450, -0.960336089, -0.703998804E-1, +0.478832126, -0.195932388E-2, +0.783894062E-1
1842iweight = getUnifRand(1, 10, size(sample, dim, IK))
1843iweight
1844+9, +3, +6, +7, +3, +8, +3
1845mean(:,0) = getVar(sample, 2_IK, iweight)
1846mean(:,0) ! reference
1847+0.251949102, +0.393590778, +0.221664235
1848var(:,0) = getVar(sample, 2_IK, iweight)
1849var(:,0) ! reference
1850+0.251949102, +0.393590778, +0.221664235
1851do isam = 1, nsam
1852 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1853 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1854end do
1855call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1856meanMerged
1857+0.384814814E-1, +0.194335058, -0.499221124E-1
1858varMerged
1859+0.251949102, +0.393590778, +0.221664235
1860call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1861mean(:,2)
1862+0.384814814E-1, +0.194335058, -0.499221124E-1
1863mean(:,0) ! reference
1864+0.251949102, +0.393590778, +0.221664235
1865var(:,2)
1866+0.251949102, +0.393590778, +0.221664235
1867var(:,0) ! reference
1868+0.251949102, +0.393590778, +0.221664235
1869
1870
1871dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1872do isam = 2, nsam
1873 lb(isam) = ub(isam - 1) + 1
1874 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1875end do
1876lb
1877+1, +3
1878ub
1879+2, +8
1880ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1881call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1882call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1883call setResized(meanMerged, ndim)
1884call setResized(varMerged, ndim)
1885sample = getUnifRand(-1., +1., ndim, ub(nsam))
1886sample
1887-0.750151038, +0.876291633, -0.978852153, +0.906836033, +0.717486382, -0.649321198, +0.780832767, +0.889709830
1888-0.885969639, +0.381958008, -0.741701126, -0.931112051, -0.973423839, +0.514344215, +0.257573247, +0.119925737E-1
1889iweight = getUnifRand(1, 10, size(sample, dim, IK))
1890iweight
1891+2, +10, +4, +6, +2, +8, +7, +8
1892mean(:,0) = getVar(sample, 2_IK, iweight)
1893mean(:,0) ! reference
1894+0.552646637, +0.314502209
1895var(:,0) = getVar(sample, 2_IK, iweight)
1896var(:,0) ! reference
1897+0.552646637, +0.314502209
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.374726266, -0.518931113E-1
1905varMerged
1906+0.552646697, +0.314502209
1907call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1908mean(:,2)
1909+0.374726266, -0.518931113E-1
1910mean(:,0) ! reference
1911+0.552646637, +0.314502209
1912var(:,2)
1913+0.552646697, +0.314502209
1914var(:,0) ! reference
1915+0.552646637, +0.314502209
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, +5
1925ub
1926+4, +11
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.208862066, -0.912089229), (-0.554680943, +0.877137780), (-0.970262647, +0.892834663), (-0.831349969, -0.200182199E-1), (-0.506590605, +0.429138660), (+0.999150038, +0.794768453), (-0.218098640, -0.209721565), (+0.945099711, -0.988980055), (+0.759341478, -0.939615726), (-0.346232176, -0.872865915), (+0.233680844, -0.211771846)
1935(-0.534443974, +0.249071121), (-0.622367859E-2, +0.321066141), (+0.294412971, -0.619989157), (-0.790043592, +0.229778051), (+0.254335761, -0.823380470), (-0.399526834, +0.435020328), (-0.865563273, +0.327978492), (+0.134258270, +0.538645983E-1), (+0.280071497, +0.157401681), (+0.806430221, -0.214240670), (-0.959982872, -0.489982724)
1936iweight = getUnifRand(1, 10, size(sample, dim, IK))
1937iweight
1938+8, +7, +10, +4, +5, +5, +10, +1, +4, +7, +9
1939mean(:,0) = getVar(sample, 2_IK, iweight)
1940mean(:,0) ! reference
1941(+0.823779643, +0.00000000), (+0.526572764, +0.00000000)
1942var(:,0) = getVar(sample, 2_IK, iweight)
1943var(:,0) ! reference
1944+0.823779643, +0.526572764
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.209113017, -0.149943829E-1), (-0.223671988, -0.704117194E-1)
1952varMerged
1953+0.823779702, +0.526572824
1954call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1955mean(:,2)
1956(-0.209113017, -0.149943829E-1), (-0.223671988, -0.704117194E-1)
1957mean(:,0) ! reference
1958(+0.823779643, +0.00000000), (+0.526572764, +0.00000000)
1959var(:,2)
1960+0.823779702, +0.526572824
1961var(:,0) ! reference
1962+0.823779643, +0.526572764
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, +5
1972ub
1973+4, +10
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.363663435E-1, +0.179019094), (+0.859658003, -0.631319523), (-0.713335156, -0.687951326), (+0.193526626, +0.662741899), (-0.532924652, -0.339311361E-1), (-0.613323927, +0.378020644), (+0.495542526, -0.302612782E-1), (+0.503764987, +0.902058959), (-0.135437965, -0.915300131), (-0.126674771, +0.737047911)
1982iweight = getUnifRand(1, 10, size(sample, dim, IK))
1983iweight
1984+7, +2, +7, +7, +7, +4, +3, +9, +6, +7
1985mean(:,0) = getVar(sample, 2_IK, iweight)
1986mean(:,0) ! reference
1987(+0.587672532, +0.00000000)
1988var(:,0) = getVar(sample, 2_IK, iweight)
1989var(:,0) ! reference
1990+0.587672532
1991do isam = 1, nsam
1992 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1993 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1994end do
1995call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1996meanMerged
1997(-0.597862154E-1, +0.148879230)
1998varMerged
1999+0.587672532
2000call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
2001mean(:,2)
2002(-0.597862154E-1, +0.148879230)
2003mean(:,0) ! reference
2004(+0.587672532, +0.00000000)
2005var(:,2)
2006+0.587672532
2007var(:,0) ! reference
2008+0.587672532
2009
2010
2011dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
2012do isam = 2, nsam
2013 lb(isam) = ub(isam - 1) + 1
2014 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
2015end do
2016lb
2017+1, +6
2018ub
2019+5, +11
2020ndim = getUnifRand(1, minval(ub - lb + 1, 1))
2021call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
2022call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
2023call setResized(meanMerged, ndim)
2024call setResized(varMerged, ndim)
2025sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
2026sample
2027(+0.224186659, -0.660181999), (+0.605376601, -0.491566658), (+0.686144829E-1, -0.934639573), (+0.459144115, +0.977993727), (+0.779352069, -0.487033129), (-0.566774011, +0.956813693), (+0.347417951, -0.688874125), (+0.818248034, -0.698989868), (+0.452242732, -0.532213449), (-0.490817428, +0.152786136), (-0.524854064, +0.764613152)
2028(-0.904421091, -0.390786052), (+0.481835842, +0.699029207), (+0.522610784, -0.464681029), (-0.552640319, -0.649294257), (-0.185171247, +0.924819827), (+0.812993646, -0.365162849), (-0.608249903E-1, -0.970097899), (-0.587332726, +0.335741758), (+0.909916520, -0.221855760), (+0.985563159, -0.700494289), (+0.578056216, -0.665110469)
2029iweight = getUnifRand(1, 10, size(sample, dim, IK))
2030iweight
2031+10, +7, +1, +1, +9, +10, +9, +8, +3, +10, +1
2032mean(:,0) = getVar(sample, 2_IK, iweight)
2033mean(:,0) ! reference
2034(+0.641026437, +0.00000000), (+0.864005983, +0.00000000)
2035var(:,0) = getVar(sample, 2_IK, iweight)
2036var(:,0) ! reference
2037+0.641026437, +0.864005983
2038do isam = 1, nsam
2039 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
2040 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
2041end do
2042call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
2043meanMerged
2044(+0.202175871, -0.230587617), (+0.125787765, -0.142571658)
2045varMerged
2046+0.641026437, +0.864006102
2047call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
2048mean(:,2)
2049(+0.202175871, -0.230587617), (+0.125787765, -0.142571658)
2050mean(:,0) ! reference
2051(+0.641026437, +0.00000000), (+0.864005983, +0.00000000)
2052var(:,2)
2053+0.641026437, +0.864006102
2054var(:,0) ! reference
2055+0.641026437, +0.864005983
2056
2057
2058dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
2059do isam = 2, nsam
2060 lb(isam) = ub(isam - 1) + 1
2061 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
2062end do
2063lb
2064+1, +4
2065ub
2066+3, +9
2067ndim = getUnifRand(1, minval(ub - lb + 1, 1))
2068call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
2069call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
2070call setResized(meanMerged, ndim)
2071call setResized(varMerged, ndim)
2072sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
2073sample
2074(+0.207819104, +0.680263519), (+0.788214684, -0.476325154), (+0.896698833, -0.983384967), (-0.684253216, -0.898550272), (-0.953290701, +0.313094974), (+0.980524778, +0.117549300), (-0.385600090, -0.844888687E-1), (+0.677570224, +0.408867359), (+0.671093464, +0.802148819)
2075(-0.199645877, +0.538684487), (+0.924517632, -0.707550883), (+0.742711186, +0.538167238), (+0.718076587, -0.550828815), (-0.678061962, +0.598077416), (+0.437888026, -0.946645975), (-0.195542336, -0.629080534E-1), (+0.206509948, +0.572472811E-1), (+0.775959492E-1, +0.624972701)
2076(-0.237253428, -0.260364771), (+0.793004632, +0.745310783E-1), (-0.170262814, -0.550038576), (-0.270927787, +0.364174128), (-0.361370683, -0.331559777), (+0.178599358, +0.619416952), (-0.253077149, -0.197015405), (+0.244047523, -0.773150444), (+0.808403969, +0.382137895)
2077iweight = getUnifRand(1, 10, size(sample, dim, IK))
2078iweight
2079+4, +3, +7, +1, +10, +2, +4, +2, +10
2080mean(:,0) = getVar(sample, 2_IK, iweight)
2081mean(:,0) ! reference
2082(+0.953681231, +0.00000000), (+0.519343555, +0.00000000), (+0.393096358, +0.00000000)
2083var(:,0) = getVar(sample, 2_IK, iweight)
2084var(:,0) ! reference
2085+0.953681231, +0.519343555, +0.393096358
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.180008769, +0.125049964), (+0.556742400E-1, +0.312755764), (+0.993151367E-1, -0.113807186)
2093varMerged
2094+0.953681350, +0.519343615, +0.393096328
2095call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
2096mean(:,2)
2097(+0.180008769, +0.125049964), (+0.556742400E-1, +0.312755764), (+0.993151367E-1, -0.113807186)
2098mean(:,0) ! reference
2099(+0.953681231, +0.00000000), (+0.519343555, +0.00000000), (+0.393096358, +0.00000000)
2100var(:,2)
2101+0.953681350, +0.519343615, +0.393096328
2102var(:,0) ! reference
2103+0.953681231, +0.519343555, +0.393096358
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, +4
2113ub
2114+3, +6
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.173706532, -0.132717967), (+0.101841807, +0.634632587), (+0.492178798, -0.221426725), (+0.882768154, +0.433525801), (-0.168472290, -0.228461027E-1), (-0.445909977, +0.290242910)
2123(-0.373071432E-1, +0.555515885), (+0.444374442, -0.643647552), (-0.548377633, -0.531215191), (+0.646300316E-1, +0.160328150E-1), (+0.903712392, +0.106393099), (+0.563241720, +0.571675897)
2124iweight = getUnifRand(1, 10, size(sample, dim, IK))
2125iweight
2126+4, +5, +3, +1, +2, +4
2127mean(:,0) = getVar(sample, 2_IK, iweight)
2128mean(:,0) ! reference
2129(+0.243850037, +0.00000000), (+0.483842641, +0.00000000)
2130var(:,0) = getVar(sample, 2_IK, iweight)
2131var(:,0) ! reference
2132+0.243850037, +0.483842641
2133do isam = 1, nsam
2134 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
2135 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
2136end do
2137call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
2138meanMerged
2139(+0.279488415E-2, +0.185621917), (+0.239607021, -0.391037762E-2)
2140varMerged
2141+0.243850037, +0.483842671
2142call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
2143mean(:,2)
2144(+0.279488415E-2, +0.185621917), (+0.239607021, -0.391037762E-2)
2145mean(:,0) ! reference
2146(+0.243850037, +0.00000000), (+0.483842641, +0.00000000)
2147var(:,2)
2148+0.243850037, +0.483842671
2149var(:,0) ! reference
2150+0.243850037, +0.483842641
2151
2152
2153!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2154!Compute the biased merged variance and mean of a reliability weighted multivariate sample.
2155!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2156
2157
2158dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
2159do isam = 2, nsam
2160 lb(isam) = ub(isam - 1) + 1
2161 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
2162end do
2163lb
2164+1, +8
2165ub
2166+7, +11
2167ndim = getUnifRand(1, minval(ub - lb + 1, 1))
2168call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
2169call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
2170call setResized(meanMerged, ndim)
2171call setResized(varMerged, ndim)
2172sample = getUnifRand(-1., +1., ndim, ub(nsam))
2173sample
2174-0.284593940, -0.376217365, -0.838131189, -0.502919674, -0.438279033, -0.820526838, -0.801545262, +0.990628004E-1, +0.399278641, +0.413167477E-2, +0.454891682
2175-0.891867042, -0.657481551, -0.295625091, +0.170825601, +0.677194238, +0.589847684, +0.766815066, -0.582439899E-1, -0.369101882, -0.239699244, +0.485229492E-2
2176+0.412126899, -0.390726328, -0.167113543E-1, +0.770393133, -0.290992141, -0.301892757, -0.990508914, -0.945830464, +0.887224555, -0.435471773, +0.819362283
2177-0.920768619, -0.472522855, +0.587427497, +0.321975827, +0.725931883, -0.345705986, +0.221906900E-1, -0.828227520, -0.488600731E-1, +0.822665930, +0.174420476
2178rweight = getUnifRand(1., 2., size(sample, dim, IK))
2179rweight
2180+1.85642612, +1.70403528, +1.71007812, +1.88212049, +1.57610798, +1.44118750, +1.69854236, +1.13881183, +1.17917895, +1.96925735, +1.90334260
2181mean(:,0) = getVar(sample, 2_IK, rweight)
2182mean(:,0) ! reference
2183+0.191329300, +0.270823240, +0.399483740, +0.326058477
2184var(:,0) = getVar(sample, 2_IK, rweight)
2185var(:,0) ! reference
2186+0.191329300, +0.270823240, +0.399483740, +0.326058477
2187do isam = 1, nsam
2188 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2189 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2190end do
2191call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2192meanMerged
2193-0.294944048, -0.390144177E-1, -0.212872811E-1, +0.404690504E-1
2194varMerged
2195+0.191329300, +0.270823270, +0.399483681, +0.326058477
2196call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2197mean(:,2)
2198-0.294944048, -0.390144177E-1, -0.212872811E-1, +0.404690504E-1
2199mean(:,0) ! reference
2200+0.191329300, +0.270823240, +0.399483740, +0.326058477
2201var(:,2)
2202+0.191329300, +0.270823270, +0.399483681, +0.326058477
2203var(:,0) ! reference
2204+0.191329300, +0.270823240, +0.399483740, +0.326058477
2205
2206
2207dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
2208do isam = 2, nsam
2209 lb(isam) = ub(isam - 1) + 1
2210 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
2211end do
2212lb
2213+1, +5
2214ub
2215+4, +6
2216ndim = getUnifRand(1, minval(ub - lb + 1, 1))
2217call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
2218call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
2219call setResized(meanMerged, ndim)
2220call setResized(varMerged, ndim)
2221sample = getUnifRand(-1., +1., ndim, ub(nsam))
2222sample
2223+0.671632886, +0.380900621, -0.282849193, -0.138298631, +0.312813878, +0.239338160
2224rweight = getUnifRand(1., 2., size(sample, dim, IK))
2225rweight
2226+1.37127507, +1.22815049, +1.18249559, +1.95378542, +1.92833543, +1.00096726
2227mean(:,0) = getVar(sample, 2_IK, rweight)
2228mean(:,0) ! reference
2229+0.100323029
2230var(:,0) = getVar(sample, 2_IK, rweight)
2231var(:,0) ! reference
2232+0.100323029
2233do isam = 1, nsam
2234 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2235 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2236end do
2237call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2238meanMerged
2239+0.187755451
2240varMerged
2241+0.100323021
2242call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2243mean(:,2)
2244+0.187755451
2245mean(:,0) ! reference
2246+0.100323029
2247var(:,2)
2248+0.100323021
2249var(:,0) ! reference
2250+0.100323029
2251
2252
2253dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
2254do isam = 2, nsam
2255 lb(isam) = ub(isam - 1) + 1
2256 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
2257end do
2258lb
2259+1, +6
2260ub
2261+5, +7
2262ndim = getUnifRand(1, minval(ub - lb + 1, 1))
2263call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
2264call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
2265call setResized(meanMerged, ndim)
2266call setResized(varMerged, ndim)
2267sample = getUnifRand(-1., +1., ndim, ub(nsam))
2268sample
2269+0.812691689, -0.891878843, -0.378430605, +0.214101553, +0.616113424, +0.413034439, +0.737403393
2270+0.211582899, +0.366318226, +0.205284238, +0.835027695, -0.341731668, -0.179800510, -0.309357643E-1
2271rweight = getUnifRand(1., 2., size(sample, dim, IK))
2272rweight
2273+1.66719043, +1.91018629, +1.74283361, +1.45532823, +1.04822552, +1.49562824, +1.85455394
2274mean(:,0) = getVar(sample, 2_IK, rweight)
2275mean(:,0) ! reference
2276+0.381555855, +0.112273403
2277var(:,0) = getVar(sample, 2_IK, rweight)
2278var(:,0) ! reference
2279+0.381555855, +0.112273403
2280do isam = 1, nsam
2281 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2282 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2283end do
2284call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2285meanMerged
2286+0.173119664, +0.173707843
2287varMerged
2288+0.381555885, +0.112273410
2289call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2290mean(:,2)
2291+0.173119664, +0.173707843
2292mean(:,0) ! reference
2293+0.381555855, +0.112273403
2294var(:,2)
2295+0.381555885, +0.112273410
2296var(:,0) ! reference
2297+0.381555855, +0.112273403
2298
2299
2300dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
2301do isam = 2, nsam
2302 lb(isam) = ub(isam - 1) + 1
2303 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
2304end do
2305lb
2306+1, +6
2307ub
2308+5, +10
2309ndim = getUnifRand(1, minval(ub - lb + 1, 1))
2310call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
2311call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
2312call setResized(meanMerged, ndim)
2313call setResized(varMerged, ndim)
2314sample = getUnifRand(-1., +1., ndim, ub(nsam))
2315sample
2316-0.312663317, -0.964891315, -0.840632439, +0.915693521, +0.579682589, -0.562995553, -0.426136255E-1, +0.124618411, +0.731004477E-1, +0.287528992
2317+0.267002821, +0.484284639, +0.534442663E-1, -0.778726339E-1, +0.606197238, +0.775249600, +0.468033195, -0.104506612, +0.212953687, +0.748147368
2318+0.593747497, +0.609687209, -0.446239591, -0.257184267, +0.225347996, -0.547156930, -0.621430635, +0.892420888, -0.826904774, +0.412945628
2319rweight = getUnifRand(1., 2., size(sample, dim, IK))
2320rweight
2321+1.63256824, +1.90892601, +1.27840853, +1.87382460, +1.28879046, +1.16493452, +1.36018205, +1.67773211, +1.62594128, +1.23594928
2322mean(:,0) = getVar(sample, 2_IK, rweight)
2323mean(:,0) ! reference
2324+0.351386338, +0.908482075E-1, +0.348341584
2325var(:,0) = getVar(sample, 2_IK, rweight)
2326var(:,0) ! reference
2327+0.351386338, +0.908482075E-1, +0.348341584
2328do isam = 1, nsam
2329 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2330 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2331end do
2332call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2333meanMerged
2334-0.660980344E-1, +0.312305599, +0.366629139E-1
2335varMerged
2336+0.351386368, +0.908482000E-1, +0.348341554
2337call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2338mean(:,2)
2339-0.660980344E-1, +0.312305599, +0.366629139E-1
2340mean(:,0) ! reference
2341+0.351386338, +0.908482075E-1, +0.348341584
2342var(:,2)
2343+0.351386368, +0.908482000E-1, +0.348341554
2344var(:,0) ! reference
2345+0.351386338, +0.908482075E-1, +0.348341584
2346
2347
2348dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
2349do isam = 2, nsam
2350 lb(isam) = ub(isam - 1) + 1
2351 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
2352end do
2353lb
2354+1, +8
2355ub
2356+7, +11
2357ndim = getUnifRand(1, minval(ub - lb + 1, 1))
2358call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
2359call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
2360call setResized(meanMerged, ndim)
2361call setResized(varMerged, ndim)
2362sample = getUnifRand(-1., +1., ndim, ub(nsam))
2363sample
2364-0.217494845, -0.578302860, -0.249555230, -0.136977315, +0.627079368, -0.757295728, +0.261470079, +0.256169081, -0.571295738, +0.133304000, +0.935536504
2365+0.222222447, -0.264512658, +0.339568734, -0.462561607, -0.619896531, +0.258700967, +0.926312327, +0.567416787, +0.698592544, -0.561848521, -0.999722481E-1
2366+0.314589024, +0.653716803, +0.235366344, -0.916491628, -0.101718545, -0.223344326, -0.618490815, -0.794533372, -0.105417013, -0.743038177, +0.892489314
2367+0.696246266, +0.836609244, +0.148966074, +0.570006609, +0.194148183, -0.861823082, +0.608136654E-1, -0.458341718, -0.313068628E-1, -0.964954734, -0.279715657
2368rweight = getUnifRand(1., 2., size(sample, dim, IK))
2369rweight
2370+1.59514999, +1.02023077, +1.95046866, +1.28882861, +1.75924492, +1.71871233, +1.81527948, +1.77411795, +1.02529657, +1.36932588, +1.82582521
2371mean(:,0) = getVar(sample, 2_IK, rweight)
2372mean(:,0) ! reference
2373+0.258201897, +0.250725687, +0.329954624, +0.295204312
2374var(:,0) = getVar(sample, 2_IK, rweight)
2375var(:,0) ! reference
2376+0.258201897, +0.250725687, +0.329954624, +0.295204312
2377do isam = 1, nsam
2378 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2379 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2380end do
2381call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2382meanMerged
2383+0.253997371E-1, +0.114184842, -0.125100046, -0.418394879E-1
2384varMerged
2385+0.258201897, +0.250725716, +0.329954594, +0.295204282
2386call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2387mean(:,2)
2388+0.253997371E-1, +0.114184842, -0.125100046, -0.418394879E-1
2389mean(:,0) ! reference
2390+0.258201897, +0.250725687, +0.329954624, +0.295204312
2391var(:,2)
2392+0.258201897, +0.250725716, +0.329954594, +0.295204282
2393var(:,0) ! reference
2394+0.258201897, +0.250725687, +0.329954624, +0.295204312
2395
2396
2397dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
2398do isam = 2, nsam
2399 lb(isam) = ub(isam - 1) + 1
2400 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
2401end do
2402lb
2403+1, +7
2404ub
2405+6, +11
2406ndim = getUnifRand(1, minval(ub - lb + 1, 1))
2407call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
2408call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
2409call setResized(meanMerged, ndim)
2410call setResized(varMerged, ndim)
2411sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
2412sample
2413(+0.645020008, -0.341980457E-1), (+0.565591097, +0.917729378), (-0.748798490, +0.463211536E-2), (+0.510244727, -0.287107348), (+0.369766712, +0.178591132), (-0.677330136, +0.967271209), (+0.284009218, -0.678990602), (+0.163771272, -0.887318373), (+0.621319294, -0.165565729), (-0.861570954, +0.638419271), (-0.313933969, +0.957999825)
2414(-0.868892550, -0.939743161), (-0.515036702, +0.331195474), (-0.879184008, -0.697263479E-1), (-0.105485916, +0.496301889), (-0.584872127, +0.276893497), (+0.384403110, -0.958448529), (-0.882581592, -0.354345083), (-0.102845430, -0.251335144), (+0.586157560, -0.707629442), (+0.355878949, -0.430166125), (-0.126538277, -0.724577069)
2415(-0.804555774, -0.204235911), (-0.669721365, -0.492212653), (-0.453438759, +0.572158217), (-0.809339762, +0.919830799E-1), (-0.960985780, +0.208398461), (-0.579146147E-1, +0.344034195), (+0.952541351, +0.279082656), (-0.737143397, -0.823198676), (+0.181450963, +0.982076764), (+0.915264726, +0.923985481), (-0.456094861, +0.873239160)
2416(+0.627269268, +0.743935585), (+0.809938312, -0.724542975), (+0.263653636, +0.432159424), (+0.143147707E-1, +0.297922492), (-0.438034892, +0.654304385), (-0.713558197, +0.138546228), (-0.347998500, +0.697772622), (-0.105093241, -0.867257237), (-0.599765539, -0.524559617), (-0.576482654, -0.232013464E-1), (-0.122146964, +0.792723298)
2417(-0.412777662E-1, -0.927904487), (+0.842604518, -0.503285170), (-0.796951413, +0.153278470), (-0.799455881, -0.735363245), (-0.831637383E-1, +0.527289629), (+0.720392942, +0.957725048E-1), (-0.284155846, +0.207677364), (-0.452443719, -0.696767807), (+0.900398016, +0.517714262), (-0.328857422, +0.573575258), (+0.417899966, +0.362102151)
2418rweight = getUnifRand(1., 2., size(sample, dim, IK))
2419rweight
2420+1.57300973, +1.51263595, +1.85189199, +1.27623796, +1.08162498, +1.24040806, +1.95426178, +1.97470045, +1.90011883, +1.10989547, +1.38084292
2421mean(:,0) = getVar(sample, 2_IK, rweight)
2422mean(:,0) ! reference
2423(+0.697870255, +0.00000000), (+0.492337316, +0.00000000), (+0.756473422, +0.00000000), (+0.594182968, +0.00000000), (+0.652684629, +0.00000000)
2424var(:,0) = getVar(sample, 2_IK, rweight)
2425var(:,0) ! reference
2426+0.697870255, +0.492337316, +0.756473422, +0.594182968, +0.652684629
2427do isam = 1, nsam
2428 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2429 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2430end do
2431call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2432meanMerged
2433(+0.809047297E-1, +0.597577542E-1), (-0.276362896, -0.318806678), (-0.244773060, +0.224289566), (-0.875825062E-1, +0.110203728), (-0.518925488E-3, -0.614705607E-1)
2434varMerged
2435+0.697870255, +0.492337346, +0.756473482, +0.594182968, +0.652684689
2436call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2437mean(:,2)
2438(+0.809047297E-1, +0.597577542E-1), (-0.276362896, -0.318806678), (-0.244773060, +0.224289566), (-0.875825062E-1, +0.110203728), (-0.518925488E-3, -0.614705607E-1)
2439mean(:,0) ! reference
2440(+0.697870255, +0.00000000), (+0.492337316, +0.00000000), (+0.756473422, +0.00000000), (+0.594182968, +0.00000000), (+0.652684629, +0.00000000)
2441var(:,2)
2442+0.697870255, +0.492337346, +0.756473482, +0.594182968, +0.652684689
2443var(:,0) ! reference
2444+0.697870255, +0.492337316, +0.756473422, +0.594182968, +0.652684629
2445
2446
2447dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
2448do isam = 2, nsam
2449 lb(isam) = ub(isam - 1) + 1
2450 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
2451end do
2452lb
2453+1, +7
2454ub
2455+6, +12
2456ndim = getUnifRand(1, minval(ub - lb + 1, 1))
2457call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
2458call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
2459call setResized(meanMerged, ndim)
2460call setResized(varMerged, ndim)
2461sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
2462sample
2463(+0.142034411, +0.160980344), (+0.369875431E-1, +0.981586814), (+0.105790377, -0.565202832), (+0.152119279, -0.620056391), (-0.327002168, +0.996489882), (-0.611622095, +0.209688544), (+0.179161668, -0.483384252), (-0.252569675, -0.664561629), (-0.372253299, -0.748488307), (+0.489185572, -0.340502381), (+0.263861656, -0.791427493), (+0.244919419, +0.926432490)
2464(-0.752447605, +0.969436765), (-0.981066227E-1, -0.724415660), (-0.545927882, -0.701067448E-1), (+0.998093605, +0.544534922), (+0.858969212, -0.318234205), (-0.439846277, +0.662521005), (-0.342905045, +0.913200498), (+0.944367766, +0.854278803), (+0.846370578, +0.938096642), (+0.396739244, -0.504644275), (+0.848442316E-1, +0.710892677), (-0.969488025, -0.728698969E-1)
2465rweight = getUnifRand(1., 2., size(sample, dim, IK))
2466rweight
2467+1.32291150, +1.75670505, +1.38162351, +1.06594884, +1.78503144, +1.02002108, +1.24218750, +1.96179271, +1.08769417, +1.75344324, +1.80781078, +1.76312709
2468mean(:,0) = getVar(sample, 2_IK, rweight)
2469mean(:,0) ! reference
2470(+0.589825630, +0.00000000), (+0.829578817, +0.00000000)
2471var(:,0) = getVar(sample, 2_IK, rweight)
2472var(:,0) ! reference
2473+0.589825630, +0.829578817
2474do isam = 1, nsam
2475 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2476 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2477end do
2478call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2479meanMerged
2480(+0.246470533E-1, -0.347982198E-1), (+0.954699814E-1, +0.262067676)
2481varMerged
2482+0.589825630, +0.829578817
2483call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2484mean(:,2)
2485(+0.246470533E-1, -0.347982198E-1), (+0.954699814E-1, +0.262067676)
2486mean(:,0) ! reference
2487(+0.589825630, +0.00000000), (+0.829578817, +0.00000000)
2488var(:,2)
2489+0.589825630, +0.829578817
2490var(:,0) ! reference
2491+0.589825630, +0.829578817
2492
2493
2494dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
2495do isam = 2, nsam
2496 lb(isam) = ub(isam - 1) + 1
2497 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
2498end do
2499lb
2500+1, +4
2501ub
2502+3, +6
2503ndim = getUnifRand(1, minval(ub - lb + 1, 1))
2504call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
2505call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
2506call setResized(meanMerged, ndim)
2507call setResized(varMerged, ndim)
2508sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
2509sample
2510(-0.837234020, -0.879429579E-1), (+0.119923949, +0.299916267), (+0.822871447, +0.829436064), (+0.508189201E-1, +0.546453834), (-0.554243207, +0.372794271), (+0.431161284, -0.325396657)
2511rweight = getUnifRand(1., 2., size(sample, dim, IK))
2512rweight
2513+1.44678485, +1.12744749, +1.16462874, +1.91143572, +1.56257582, +1.06318521
2514mean(:,0) = getVar(sample, 2_IK, rweight)
2515mean(:,0) ! reference
2516(+0.430602998, +0.00000000)
2517var(:,0) = getVar(sample, 2_IK, rweight)
2518var(:,0) ! reference
2519+0.430602998
2520do isam = 1, nsam
2521 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2522 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2523end do
2524call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2525meanMerged
2526(-0.517463125E-1, +0.296996981)
2527varMerged
2528+0.430602968
2529call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2530mean(:,2)
2531(-0.517463125E-1, +0.296996981)
2532mean(:,0) ! reference
2533(+0.430602998, +0.00000000)
2534var(:,2)
2535+0.430602968
2536var(:,0) ! reference
2537+0.430602998
2538
2539
2540dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
2541do isam = 2, nsam
2542 lb(isam) = ub(isam - 1) + 1
2543 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
2544end do
2545lb
2546+1, +4
2547ub
2548+3, +10
2549ndim = getUnifRand(1, minval(ub - lb + 1, 1))
2550call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
2551call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
2552call setResized(meanMerged, ndim)
2553call setResized(varMerged, ndim)
2554sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
2555sample
2556(+0.710711002, +0.351775169), (+0.690672040, -0.178470254), (+0.390344620, +0.726344109), (-0.380795836, +0.280645370), (-0.120415449, +0.518473744), (-0.349879146, -0.400770903E-1), (+0.615331173, +0.214161634), (-0.617952824, +0.711326003), (-0.971410871, +0.222307086), (-0.858716846, -0.249802589)
2557(-0.977458835, -0.933983326E-1), (-0.586850166, -0.934563875E-1), (-0.659101009, +0.582410812), (+0.587332487, +0.597048163), (+0.280270457, +0.643824339), (-0.996059179E-1, -0.105419278), (+0.360788226, +0.141775370), (-0.505479574, -0.636328340), (-0.571124315, +0.389086604), (-0.799497366E-1, +0.522091985)
2558rweight = getUnifRand(1., 2., size(sample, dim, IK))
2559rweight
2560+1.88294244, +1.73324895, +1.87769783, +1.80087471, +1.48382509, +1.80694723, +1.16106284, +1.16088963, +1.35887432, +1.86761379
2561mean(:,0) = getVar(sample, 2_IK, rweight)
2562mean(:,0) ! reference
2563(+0.481315076, +0.00000000), (+0.391309768, +0.00000000)
2564var(:,0) = getVar(sample, 2_IK, rweight)
2565var(:,0) ! reference
2566+0.481315076, +0.391309768
2567do isam = 1, nsam
2568 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2569 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2570end do
2571call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2572meanMerged
2573(-0.715932995E-1, +0.237336814), (-0.241413265, +0.218512684)
2574varMerged
2575+0.481315076, +0.391309798
2576call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2577mean(:,2)
2578(-0.715932995E-1, +0.237336814), (-0.241413265, +0.218512684)
2579mean(:,0) ! reference
2580(+0.481315076, +0.00000000), (+0.391309768, +0.00000000)
2581var(:,2)
2582+0.481315076, +0.391309798
2583var(:,0) ! reference
2584+0.481315076, +0.391309768
2585
2586
2587dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
2588do isam = 2, nsam
2589 lb(isam) = ub(isam - 1) + 1
2590 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
2591end do
2592lb
2593+1, +4
2594ub
2595+3, +8
2596ndim = getUnifRand(1, minval(ub - lb + 1, 1))
2597call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
2598call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
2599call setResized(meanMerged, ndim)
2600call setResized(varMerged, ndim)
2601sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
2602sample
2603(-0.595271587E-2, +0.647974253), (-0.647785664, +0.956015825), (+0.468748927, +0.835835934E-1), (-0.457286358, +0.210659742), (-0.964948058, +0.483144403), (-0.996561646, +0.346832037), (-0.906093597, +0.506442547), (+0.591597557E-1, +0.444268465)
2604rweight = getUnifRand(1., 2., size(sample, dim, IK))
2605rweight
2606+1.63751602, +1.39747596, +1.18853736, +1.21335363, +1.95354390, +1.68325424, +1.28674114, +1.60847330
2607mean(:,0) = getVar(sample, 2_IK, rweight)
2608mean(:,0) ! reference
2609(+0.313637435, +0.00000000)
2610var(:,0) = getVar(sample, 2_IK, rweight)
2611var(:,0) ! reference
2612+0.313637435
2613do isam = 1, nsam
2614 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2615 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2616end do
2617call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2618meanMerged
2619(-0.463369608, +0.471716762)
2620varMerged
2621+0.313637406
2622call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2623mean(:,2)
2624(-0.463369608, +0.471716762)
2625mean(:,0) ! reference
2626(+0.313637435, +0.00000000)
2627var(:,2)
2628+0.313637406
2629var(:,0) ! reference
2630+0.313637435
2631
2632
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 Austin

Definition at line 9374 of file pm_sampleVar.F90.


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