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.200851798, +0.572806478, +0.809714198E-1, +0.993951619, +0.280199111, +0.555935800
19mean(0) = getMean(sample)
20mean(0) ! reference
21+0.447452694
22var(0) = getVar(sample)
23var(0) ! reference
24+0.915395841E-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.447452664
32varMerged
33+0.915395766E-1
34call setVarMeanMerged(var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
35mean(2)
36+0.447452664
37mean(0) ! reference
38+0.447452694
39var(2)
40+0.915395766E-1
41var(0) ! reference
42+0.915395841E-1
43
44
45lb(1) = 1; ub(1) = getUnifRand(2, 7)
46do isam = 2, nsam
47 lb(isam) = ub(isam - 1) + 1
48 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
49end do
50lb
51+1, +6
52ub
53+5, +12
54sample = getUnifRand(0., 1., ub(nsam))
55sample
56+0.924269497, +0.609037876E-1, +0.887540996, +0.694496095, +0.710785210, +0.879381359, +0.846093297E-1, +0.999936819, +0.311553478E-2, +0.565628588, +0.395244241, +0.414751947
57mean(0) = getMean(sample)
58mean(0) ! reference
59+0.551721990
60var(0) = getVar(sample)
61var(0) ! reference
62+0.117417835
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.551721990
70varMerged
71+0.117417842
72call setVarMeanMerged(var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
73mean(2)
74+0.551721990
75mean(0) ! reference
76+0.551721990
77var(2)
78+0.117417842
79var(0) ! reference
80+0.117417835
81
82
83lb(1) = 1; ub(1) = getUnifRand(2, 7)
84do isam = 2, nsam
85 lb(isam) = ub(isam - 1) + 1
86 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
87end do
88lb
89+1, +7
90ub
91+6, +10
92sample = getUnifRand(0., 1., ub(nsam))
93sample
94+0.140664577E-1, +0.708589852, +0.221097648, +0.897931397, +0.998017192E-1, +0.632832110, +0.704573989, +0.583664298, +0.892986417, +0.548574805
95mean(0) = getMean(sample)
96mean(0) ! reference
97+0.530411839
98var(0) = getVar(sample)
99var(0) ! reference
100+0.889979377E-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.530411839
108varMerged
109+0.889979377E-1
110call setVarMeanMerged(var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
111mean(2)
112+0.530411839
113mean(0) ! reference
114+0.530411839
115var(2)
116+0.889979377E-1
117var(0) ! reference
118+0.889979377E-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, +13
130sample = getUnifRand(0., 1., ub(nsam))
131sample
132+0.808821857, +0.570990682, +0.203528047, +0.442615509, +0.534200788, +0.676456094, +0.349953413, +0.212845087, +0.537539721, +0.321134865, +0.954890847, +0.470433414, +0.952123880
133mean(0) = getMean(sample)
134mean(0) ! reference
135+0.541194916
136var(0) = getVar(sample)
137var(0) ! reference
138+0.578795485E-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.541194916
146varMerged
147+0.578795448E-1
148call setVarMeanMerged(var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
149mean(2)
150+0.541194916
151mean(0) ! reference
152+0.541194916
153var(2)
154+0.578795448E-1
155var(0) ! reference
156+0.578795485E-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, +7
166ub
167+6, +10
168sample = getUnifRand(0., 1., ub(nsam))
169sample
170+0.594048262, +0.168521941, +0.655064940, +0.409299135, +0.949578047, +0.313089252, +0.321656287, +0.589823425, +0.804741502, +0.248471200
171mean(0) = getMean(sample)
172mean(0) ! reference
173+0.505429387
174var(0) = getVar(sample)
175var(0) ! reference
176+0.583764724E-1
177do isam = 1, nsam
178 var(isam) = getVar(sample(lb(isam):ub(isam)))
179 mean(isam) = getMean(sample(lb(isam):ub(isam)))
180end do
181call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
182meanMerged
183+0.505429387
184varMerged
185+0.583764687E-1
186call setVarMeanMerged(var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
187mean(2)
188+0.505429387
189mean(0) ! reference
190+0.505429387
191var(2)
192+0.583764687E-1
193var(0) ! reference
194+0.583764724E-1
195
196
197lb(1) = 1; ub(1) = getUnifRand(2, 7)
198do isam = 2, nsam
199 lb(isam) = ub(isam - 1) + 1
200 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
201end do
202lb
203+1, +3
204ub
205+2, +8
206sample = cmplx(getUnifRand(-1., +1., ub(nsam)), getUnifRand(-1., +1., ub(nsam)), TKG)
207sample
208(-0.178100467, -0.475627899), (+0.462234497, +0.505606771), (-0.542045236, -0.159744859), (-0.737872481, +0.613011003), (-0.902582765, -0.947648406), (+0.171509266, -0.613091350), (-0.466444612, -0.968566537), (-0.917932510, -0.205489635)
209mean(0) = getMean(sample)
210mean(0) ! reference
211(-0.388904274, -0.281443864)
212var(0) = getVar(sample)
213var(0) ! reference
214+0.535207510
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.388904274, -0.281443894)
222varMerged
223+0.535207510
224call setVarMeanMerged(var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
225mean(2)
226(-0.388904274, -0.281443894)
227mean(0) ! reference
228(-0.388904274, -0.281443864)
229var(2)
230+0.535207510
231var(0) ! reference
232+0.535207510
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, +4
242ub
243+3, +6
244sample = cmplx(getUnifRand(-1., +1., ub(nsam)), getUnifRand(-1., +1., ub(nsam)), TKG)
245sample
246(+0.184595704, +0.808030725), (+0.938716292, +0.761529803), (-0.634616256, +0.118241072), (+0.390368223, -0.272072673), (-0.826574802, -0.327698231), (+0.525363088, -0.432061672)
247mean(0) = getMean(sample)
248mean(0) ! reference
249(+0.963087082E-1, +0.109328173)
250var(0) = getVar(sample)
251var(0) ! reference
252+0.652860403
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.963087082E-1, +0.109328181)
260varMerged
261+0.652860343
262call setVarMeanMerged(var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
263mean(2)
264(+0.963087082E-1, +0.109328181)
265mean(0) ! reference
266(+0.963087082E-1, +0.109328173)
267var(2)
268+0.652860343
269var(0) ! reference
270+0.652860403
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, +6
280ub
281+5, +11
282sample = cmplx(getUnifRand(-1., +1., ub(nsam)), getUnifRand(-1., +1., ub(nsam)), TKG)
283sample
284(-0.945807338, -0.827649832), (-0.495253801, +0.125231385), (-0.989343882, -0.220150590), (+0.392381549, +0.657070637), (-0.484611392, +0.189493775), (-0.503352761, +0.900670171), (+0.382282019, -0.545822263), (+0.387243390, +0.885169625), (+0.524429917, +0.686525941), (-0.851874113, +0.994481444), (-0.967620254, -0.153042674)
285mean(0) = getMean(sample)
286mean(0) ! reference
287(-0.322866052, +0.244725227)
288var(0) = getVar(sample)
289var(0) ! reference
290+0.707421362
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.322866052, +0.244725212)
298varMerged
299+0.707421303
300call setVarMeanMerged(var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
301mean(2)
302(-0.322866052, +0.244725212)
303mean(0) ! reference
304(-0.322866052, +0.244725227)
305var(2)
306+0.707421303
307var(0) ! reference
308+0.707421362
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, +5
318ub
319+4, +11
320sample = cmplx(getUnifRand(-1., +1., ub(nsam)), getUnifRand(-1., +1., ub(nsam)), TKG)
321sample
322(-0.784211755, -0.911043763), (+0.694231987E-1, +0.330007672), (+0.274449706, -0.765672922), (-0.916378021, +0.780590057), (-0.348470449, -0.562322140), (+0.448318720E-1, -0.862534046E-1), (-0.629948378E-1, -0.845730186), (+0.692299485, -0.606672525), (+0.280877233, +0.491319895E-1), (+0.531605482, +0.617623806), (+0.812768579, +0.739634871)
323mean(0) = getMean(sample)
324mean(0) ! reference
325(+0.540182255E-1, -0.114609689)
326var(0) = getVar(sample)
327var(0) ! reference
328+0.678131044
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.540182069E-1, -0.114609711)
336varMerged
337+0.678130984
338call setVarMeanMerged(var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
339mean(2)
340(+0.540182069E-1, -0.114609711)
341mean(0) ! reference
342(+0.540182255E-1, -0.114609689)
343var(2)
344+0.678130984
345var(0) ! reference
346+0.678131044
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, +8
356ub
357+7, +10
358sample = cmplx(getUnifRand(-1., +1., ub(nsam)), getUnifRand(-1., +1., ub(nsam)), TKG)
359sample
360(-0.537506104, +0.371669531E-1), (+0.744607687, -0.893359423), (-0.686774850, +0.662396908), (-0.404218554, +0.941802263), (+0.812268972, -0.666044950), (+0.938305259, +0.562648773E-1), (-0.170007110, +0.879422426), (+0.538799047, +0.852028012), (+0.177195668, -0.424322367), (+0.740751505, -0.251009941)
361mean(0) = getMean(sample)
362mean(0) ! reference
363(+0.215342134, +0.119434476)
364var(0) = getVar(sample)
365var(0) ! reference
366+0.762595952
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.215342164, +0.119434483)
374varMerged
375+0.762596011
376call setVarMeanMerged(var(2), mean(2), var(1), mean(1), ub(1) / real(ub(2), TKG))
377mean(2)
378(+0.215342164, +0.119434483)
379mean(0) ! reference
380(+0.215342134, +0.119434476)
381var(2)
382+0.762596011
383var(0) ! reference
384+0.762595952
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, +11
401sample = getUnifRand(0., 1., ub(nsam))
402sample
403+0.903895617, +0.214919686, +0.876100302, +0.493033171, +0.251036882E-1, +0.204394579, +0.752516389, +0.951565206, +0.169180512, +0.439697504E-1, +0.422798514
404iweight = getUnifRand(1, 10, size(sample, 1, IK))
405iweight
406+1, +8, +6, +2, +1, +8, +9, +3, +5, +3, +2
407mean(0) = getMean(sample, iweight)
408mean(0) ! reference
409+0.457852751
410var(0) = getVar(sample, iweight)
411var(0) ! reference
412+0.101459526
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.457852781
420varMerged
421+0.101459526
422call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
423mean(2)
424+0.457852781
425mean(0) ! reference
426+0.457852751
427var(2)
428+0.101459526
429var(0) ! reference
430+0.101459526
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, +9
442sample = getUnifRand(0., 1., ub(nsam))
443sample
444+0.467798173, +0.856897712, +0.271427393, +0.961686850, +0.111807287, +0.855364919, +0.915367723, +0.440921605, +0.761218786
445iweight = getUnifRand(1, 10, size(sample, 1, IK))
446iweight
447+7, +1, +3, +3, +1, +10, +2, +10, +10
448mean(0) = getMean(sample, iweight)
449mean(0) ! reference
450+0.645711184
451var(0) = getVar(sample, iweight)
452var(0) ! reference
453+0.512509607E-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.645711184
461varMerged
462+0.512509644E-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.645711184
466mean(0) ! reference
467+0.645711184
468var(2)
469+0.512509644E-1
470var(0) ! reference
471+0.512509607E-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, +5
481ub
482+4, +11
483sample = getUnifRand(0., 1., ub(nsam))
484sample
485+0.163099110, +0.504783213, +0.130226374, +0.685247838, +0.602915287E-1, +0.255020499, +0.817313313, +0.871151090E-1, +0.593378007, +0.514933467, +0.735664248
486iweight = getUnifRand(1, 10, size(sample, 1, IK))
487iweight
488+5, +5, +7, +10, +4, +5, +8, +10, +7, +8, +4
489mean(0) = getMean(sample, iweight)
490mean(0) ! reference
491+0.428016037
492var(0) = getVar(sample, iweight)
493var(0) ! reference
494+0.734016225E-1
495do isam = 1, nsam
496 var(isam) = getVar(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
497 mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
498end do
499call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
500meanMerged
501+0.428016007
502varMerged
503+0.734016225E-1
504call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
505mean(2)
506+0.428016007
507mean(0) ! reference
508+0.428016037
509var(2)
510+0.734016225E-1
511var(0) ! reference
512+0.734016225E-1
513
514
515lb(1) = 1; ub(1) = getUnifRand(2, 7)
516do isam = 2, nsam
517 lb(isam) = ub(isam - 1) + 1
518 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
519end do
520lb
521+1, +6
522ub
523+5, +12
524sample = getUnifRand(0., 1., ub(nsam))
525sample
526+0.949460745, +0.556708813, +0.752778709, +0.628312528, +0.338411927, +0.779694915E-1, +0.845854878E-1, +0.338948965, +0.246537268, +0.864101470, +0.745544016, +0.425787389
527iweight = getUnifRand(1, 10, size(sample, 1, IK))
528iweight
529+1, +9, +10, +4, +1, +6, +5, +6, +4, +5, +6, +7
530mean(0) = getMean(sample, iweight)
531mean(0) ! reference
532+0.500377476
533var(0) = getVar(sample, iweight)
534var(0) ! reference
535+0.682678446E-1
536do isam = 1, nsam
537 var(isam) = getVar(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
538 mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
539end do
540call setVarMeanMerged(varMerged, meanMerged, var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
541meanMerged
542+0.500377476
543varMerged
544+0.682678521E-1
545call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
546mean(2)
547+0.500377476
548mean(0) ! reference
549+0.500377476
550var(2)
551+0.682678521E-1
552var(0) ! reference
553+0.682678446E-1
554
555
556lb(1) = 1; ub(1) = getUnifRand(2, 7)
557do isam = 2, nsam
558 lb(isam) = ub(isam - 1) + 1
559 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
560end do
561lb
562+1, +6
563ub
564+5, +11
565sample = getUnifRand(0., 1., ub(nsam))
566sample
567+0.836892843, +0.915888965, +0.773990452, +0.619586766, +0.384789467, +0.162275910, +0.831802547, +0.244149148, +0.901111364E-1, +0.852571726, +0.909529984
568iweight = getUnifRand(1, 10, size(sample, 1, IK))
569iweight
570+9, +5, +2, +7, +2, +3, +8, +6, +8, +9, +8
571mean(0) = getMean(sample, iweight)
572mean(0) ! reference
573+0.642426372
574var(0) = getVar(sample, iweight)
575var(0) ! reference
576+0.928984582E-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.642426312
584varMerged
585+0.928984508E-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.642426312
589mean(0) ! reference
590+0.642426372
591var(2)
592+0.928984508E-1
593var(0) ! reference
594+0.928984582E-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, +7
604ub
605+6, +12
606sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
607sample
608(+0.979446054, -0.383508503), (+0.506957412, -0.660209656), (+0.623704493, -0.879626751), (+0.291406453, -0.546322346), (+0.184023261, -0.480437219), (+0.569747090E-1, -0.715929270E-2), (+0.407034457, -0.231066346), (+0.606558681, -0.657379210), (+0.508647323, -0.444424152E-1), (+0.324186027, -0.758225620), (+0.653161407, -0.950176477), (+0.299967349, -0.715626299)
609iweight = getUnifRand(1, 10, size(sample, 1, IK))
610iweight
611+9, +3, +5, +7, +4, +10, +5, +10, +1, +5, +2, +6
612mean(0) = getMean(sample, iweight)
613mean(0) ! reference
614(+0.449799418, -0.498608083)
615var(0) = getVar(sample, iweight)
616var(0) ! reference
617+0.155839652
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.449799418, -0.498608142)
625varMerged
626+0.155839652
627call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
628mean(2)
629(+0.449799418, -0.498608142)
630mean(0) ! reference
631(+0.449799418, -0.498608083)
632var(2)
633+0.155839652
634var(0) ! reference
635+0.155839652
636
637
638lb(1) = 1; ub(1) = getUnifRand(2, 7)
639do isam = 2, nsam
640 lb(isam) = ub(isam - 1) + 1
641 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
642end do
643lb
644+1, +6
645ub
646+5, +8
647sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
648sample
649(+0.974221826, -0.146405101), (+0.382506609, -0.588483572), (+0.499791920, -0.801332653), (+0.531912148, -0.963387072), (+0.174744427, -0.543173611), (+0.830358148, -0.254289746), (+0.618817389, -0.960018456), (+0.972893715, -0.956946194)
650iweight = getUnifRand(1, 10, size(sample, 1, IK))
651iweight
652+7, +8, +9, +1, +7, +7, +9, +8
653mean(0) = getMean(sample, iweight)
654mean(0) ! reference
655(+0.630319118, -0.639036834)
656var(0) = getVar(sample, iweight)
657var(0) ! reference
658+0.161661282
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.630319118, -0.639036894)
666varMerged
667+0.161661312
668call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
669mean(2)
670(+0.630319118, -0.639036894)
671mean(0) ! reference
672(+0.630319118, -0.639036834)
673var(2)
674+0.161661312
675var(0) ! reference
676+0.161661282
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, +7
686ub
687+6, +11
688sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
689sample
690(+0.778597534, -0.596625268), (+0.709808171, -0.119227052), (+0.608688116, -0.755870223), (+0.844127893, -0.842393279), (+0.584063649, -0.169711411), (+0.665680170E-1, -0.436128378), (+0.991321504, -0.919052780), (+0.139252722, -0.707693696E-1), (+0.164822280, -0.961625576E-1), (+0.998659551, -0.841777325), (+0.856759667, -0.599280834)
691iweight = getUnifRand(1, 10, size(sample, 1, IK))
692iweight
693+3, +2, +8, +7, +3, +6, +8, +8, +7, +2, +2
694mean(0) = getMean(sample, iweight)
695mean(0) ! reference
696(+0.546332061, -0.510210395)
697var(0) = getVar(sample, iweight)
698var(0) ! reference
699+0.233304739
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.546332121, -0.510210335)
707varMerged
708+0.233304724
709call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
710mean(2)
711(+0.546332121, -0.510210335)
712mean(0) ! reference
713(+0.546332061, -0.510210395)
714var(2)
715+0.233304724
716var(0) ! reference
717+0.233304739
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, +6
727ub
728+5, +12
729sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
730sample
731(+0.818285823, -0.964869857), (+0.371096611, -0.154111862), (+0.525586307, -0.147264242), (+0.378397346, -0.325292826), (+0.522062123, -0.740061820), (+0.592523158, -0.942233801E-1), (+0.409388959, -0.568853438), (+0.270209491, -0.148931205), (+0.288694084, -0.232788563), (+0.495090485, -0.245112538), (+0.748253167, -0.346257627), (+0.977144301, -0.785989165E-1)
732iweight = getUnifRand(1, 10, size(sample, 1, IK))
733iweight
734+4, +6, +10, +1, +6, +1, +1, +6, +10, +2, +9, +4
735mean(0) = getMean(sample, iweight)
736mean(0) ! reference
737(+0.523491740, -0.313799083)
738var(0) = getVar(sample, iweight)
739var(0) ! reference
740+0.108999297
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.523491740, -0.313799113)
748varMerged
749+0.108999290
750call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
751mean(2)
752(+0.523491740, -0.313799113)
753mean(0) ! reference
754(+0.523491740, -0.313799083)
755var(2)
756+0.108999290
757var(0) ! reference
758+0.108999297
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, +3
768ub
769+2, +8
770sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
771sample
772(+0.184834003, -0.738316000), (+0.491419733, -0.957243085), (+0.838361800, -0.825599790), (+0.143154263E-1, -0.608394146), (+0.287742198, -0.660126448), (+0.606837749, -0.934058249), (+0.854936838, -0.159732103), (+0.874617517, -0.707857549)
773iweight = getUnifRand(1, 10, size(sample, 1, IK))
774iweight
775+4, +3, +4, +9, +1, +5, +10, +1
776mean(0) = getMean(sample, iweight)
777mean(0) ! reference
778(+0.498426944, -0.601041496)
779var(0) = getVar(sample, iweight)
780var(0) ! reference
781+0.206914112
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.498426944, -0.601041496)
789varMerged
790+0.206914127
791call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
792mean(2)
793(+0.498426944, -0.601041496)
794mean(0) ! reference
795(+0.498426944, -0.601041496)
796var(2)
797+0.206914127
798var(0) ! reference
799+0.206914112
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, +5
814ub
815+4, +10
816sample = getUnifRand(0., 1., ub(nsam))
817sample
818+0.740289927, +0.743210852, +0.715136886, +0.864179313, +0.169074535, +0.990731478, +0.221419275, +0.634170532, +0.617979765E-1, +0.962650776E-2
819rweight = getUnifRand(1., 2., size(sample, 1, IK))
820rweight
821+1.99867868, +1.32987761, +1.20925546, +1.76199257, +1.74124444, +1.39110935, +1.99231601, +1.42210197, +1.81641042, +1.24184680
822mean(0) = getMean(sample, rweight)
823mean(0) ! reference
824+0.502693415
825var(0) = getVar(sample, rweight)
826var(0) ! reference
827+0.115494862
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.502693415
835varMerged
836+0.115494877
837call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
838mean(2)
839+0.502693415
840mean(0) ! reference
841+0.502693415
842var(2)
843+0.115494877
844var(0) ! reference
845+0.115494862
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, +9
857sample = getUnifRand(0., 1., ub(nsam))
858sample
859+0.252501547, +0.326490581, +0.480392694, +0.402474701, +0.905523717, +0.219062388, +0.490448058, +0.524937928, +0.518147886
860rweight = getUnifRand(1., 2., size(sample, 1, IK))
861rweight
862+1.03331399, +1.78697848, +1.62393332, +1.85302210, +1.06469250, +1.25558686, +1.62212038, +1.07608449, +1.51326036
863mean(0) = getMean(sample, rweight)
864mean(0) ! reference
865+0.448512107
866var(0) = getVar(sample, rweight)
867var(0) ! reference
868+0.293737147E-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.448512048
876varMerged
877+0.293737128E-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.448512048
881mean(0) ! reference
882+0.448512107
883var(2)
884+0.293737128E-1
885var(0) ! reference
886+0.293737147E-1
887
888
889lb(1) = 1; ub(1) = getUnifRand(2, 7)
890do isam = 2, nsam
891 lb(isam) = ub(isam - 1) + 1
892 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
893end do
894lb
895+1, +8
896ub
897+7, +14
898sample = getUnifRand(0., 1., ub(nsam))
899sample
900+0.894503891, +0.823110342, +0.725180626, +0.702682853, +0.648299634, +0.378768682, +0.662343502E-1, +0.117061436, +0.565388799, +0.434017658, +0.776768148, +0.419143021, +0.984891057, +0.196148455
901rweight = getUnifRand(1., 2., size(sample, 1, IK))
902rweight
903+1.19550872, +1.23238623, +1.58138251, +1.60399008, +1.38550067, +1.20499921, +1.39218473, +1.69176435, +1.52099609, +1.70641875, +1.68306708, +1.98715281, +1.30924821, +1.36585271
904mean(0) = getMean(sample, rweight)
905mean(0) ! reference
906+0.541730821
907var(0) = getVar(sample, rweight)
908var(0) ! reference
909+0.753800720E-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.541730821
917varMerged
918+0.753800869E-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.541730821
922mean(0) ! reference
923+0.541730821
924var(2)
925+0.753800869E-1
926var(0) ! reference
927+0.753800720E-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, +6
937ub
938+5, +9
939sample = getUnifRand(0., 1., ub(nsam))
940sample
941+0.236991465, +0.741779089, +0.302841842, +0.821172237, +0.790544331, +0.898901880, +0.379115760, +0.565049946, +0.152680218
942rweight = getUnifRand(1., 2., size(sample, 1, IK))
943rweight
944+1.04268491, +1.12654269, +1.13937640, +1.69498825, +1.87189865, +1.35337090, +1.33987451, +1.26670122, +1.83323324
945mean(0) = getMean(sample, rweight)
946mean(0) ! reference
947+0.554096222
948var(0) = getVar(sample, rweight)
949var(0) ! reference
950+0.741586462E-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.554096222
958varMerged
959+0.741586387E-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.554096222
963mean(0) ! reference
964+0.554096222
965var(2)
966+0.741586387E-1
967var(0) ! reference
968+0.741586462E-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, +7
978ub
979+6, +13
980sample = getUnifRand(0., 1., ub(nsam))
981sample
982+0.883783698, +0.384115458, +0.393767834, +0.891632497, +0.511717379, +0.497207046E-1, +0.897514641, +0.736753941, +0.556704521, +0.560593128, +0.634373724, +0.893603921, +0.586842358
983rweight = getUnifRand(1., 2., size(sample, 1, IK))
984rweight
985+1.98605096, +1.13532770, +1.63621807, +1.04954696, +1.49020004, +1.02287769, +1.65186524, +1.75122046, +1.66621232, +1.03494763, +1.56044936, +1.91813636, +1.39190149
986mean(0) = getMean(sample, rweight)
987mean(0) ! reference
988+0.641940296
989var(0) = getVar(sample, rweight)
990var(0) ! reference
991+0.523582846E-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.641940236
999varMerged
1000+0.523582920E-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.641940236
1004mean(0) ! reference
1005+0.641940296
1006var(2)
1007+0.523582920E-1
1008var(0) ! reference
1009+0.523582846E-1
1010
1011
1012lb(1) = 1; ub(1) = getUnifRand(2, 7)
1013do isam = 2, nsam
1014 lb(isam) = ub(isam - 1) + 1
1015 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1016end do
1017lb
1018+1, +5
1019ub
1020+4, +8
1021sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
1022sample
1023(+0.400269568, -0.290355444), (+0.359329283, -0.852218449), (+0.102082431, -0.633658111), (+0.875857115, -0.523871183E-1), (+0.170351267E-1, -0.200701714), (+0.801868618, -0.524662256), (+0.762762249, -0.653745174), (+0.812259614, -0.490344644)
1024rweight = getUnifRand(1., 2., size(sample, 1, IK))
1025rweight
1026+1.39876413, +1.47152996, +1.05815196, +1.74349189, +1.93153846, +1.49240208, +1.09331512, +1.89573169
1027mean(0) = getMean(sample, rweight)
1028mean(0) ! reference
1029(+0.523552656, -0.433352113)
1030var(0) = getVar(sample, rweight)
1031var(0) ! reference
1032+0.170093894
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.523552656, -0.433352143)
1040varMerged
1041+0.170093879
1042call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1043mean(2)
1044(+0.523552656, -0.433352143)
1045mean(0) ! reference
1046(+0.523552656, -0.433352113)
1047var(2)
1048+0.170093879
1049var(0) ! reference
1050+0.170093894
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, +4
1060ub
1061+3, +10
1062sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
1063sample
1064(+0.842240751, -0.517739773), (+0.868643582, -0.666956902), (+0.726323724E-1, -0.745351672), (+0.932425797, -0.101829529), (+0.151692092, -0.996390641), (+0.932229340, -0.926955462), (+0.744042397E-1, -0.849833310), (+0.356694639, -0.428798795), (+0.661884546, -0.612749219), (+0.796621978, -0.989794910)
1065rweight = getUnifRand(1., 2., size(sample, 1, IK))
1066rweight
1067+1.38626981, +1.79436672, +1.69679582, +1.89001262, +1.84190369, +1.70601845, +1.73598814, +1.49563956, +1.50059342, +1.34142208
1068mean(0) = getMean(sample, rweight)
1069mean(0) ! reference
1070(+0.561721265, -0.680466235)
1071var(0) = getVar(sample, rweight)
1072var(0) ! reference
1073+0.201113060
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.561721385, -0.680466294)
1081varMerged
1082+0.201113105
1083call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1084mean(2)
1085(+0.561721385, -0.680466294)
1086mean(0) ! reference
1087(+0.561721265, -0.680466235)
1088var(2)
1089+0.201113105
1090var(0) ! reference
1091+0.201113060
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, +7
1101ub
1102+6, +11
1103sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
1104sample
1105(+0.815769792, -0.848542333), (+0.498610318, -0.938892365E-3), (+0.476293862, -0.377286017), (+0.460958481E-1, -0.495536447), (+0.678566694E-1, -0.189381182), (+0.402245879, -0.273891211), (+0.323076963, -0.957354188), (+0.911892653, -0.285224676), (+0.645704508, -0.831460059), (+0.487029552E-1, -0.257370710), (+0.192047417, -0.208824873E-1)
1106rweight = getUnifRand(1., 2., size(sample, 1, IK))
1107rweight
1108+1.67890310, +1.41673279, +1.73196173, +1.56048274, +1.35188270, +1.98547649, +1.81049240, +1.20745778, +1.65946496, +1.35727894, +1.07389128
1109mean(0) = getMean(sample, rweight)
1110mean(0) ! reference
1111(+0.409474313, -0.444439471)
1112var(0) = getVar(sample, rweight)
1113var(0) ! reference
1114+0.178474069
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.409474283, -0.444439441)
1122varMerged
1123+0.178474039
1124call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1125mean(2)
1126(+0.409474283, -0.444439441)
1127mean(0) ! reference
1128(+0.409474313, -0.444439471)
1129var(2)
1130+0.178474039
1131var(0) ! reference
1132+0.178474069
1133
1134
1135lb(1) = 1; ub(1) = getUnifRand(2, 7)
1136do isam = 2, nsam
1137 lb(isam) = ub(isam - 1) + 1
1138 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1139end do
1140lb
1141+1, +8
1142ub
1143+7, +10
1144sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
1145sample
1146(+0.864963531E-1, -0.323551297E-1), (+0.178147078, -0.342260182), (+0.380834877, -0.949555814), (+0.437801659, -0.566372931), (+0.829360485, -0.874211192E-1), (+0.697696984, -0.204266906E-1), (+0.244971037, -0.723711252), (+0.503694713, -0.458314121), (+0.281191707, -0.872024536), (+0.107646406, -0.356941283)
1147rweight = getUnifRand(1., 2., size(sample, 1, IK))
1148rweight
1149+1.42334747, +1.30258799, +1.47458065, +1.64016390, +1.22520733, +1.71741295, +1.86275160, +1.26411414, +1.93566132, +1.93666077
1150mean(0) = getMean(sample, rweight)
1151mean(0) ! reference
1152(+0.360842437, -0.460629612)
1153var(0) = getVar(sample, rweight)
1154var(0) ! reference
1155+0.154787749
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.360842407, -0.460629642)
1163varMerged
1164+0.154787749
1165call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1166mean(2)
1167(+0.360842407, -0.460629642)
1168mean(0) ! reference
1169(+0.360842437, -0.460629612)
1170var(2)
1171+0.154787749
1172var(0) ! reference
1173+0.154787749
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, +12
1185sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
1186sample
1187(+0.633342147, -0.181385875), (+0.136871636, -0.548522174), (+0.936547816, -0.132468522), (+0.130550921, -0.775045753E-1), (+0.254243612E-1, -0.874990046), (+0.215184689, -0.414006114), (+0.816592932, -0.201483905), (+0.307206333, -0.271723568), (+0.692880690, -0.982248783E-1), (+0.294271827, -0.849735975), (+0.266250134, -0.905585945), (+0.891574144, -0.619935334)
1188rweight = getUnifRand(1., 2., size(sample, 1, IK))
1189rweight
1190+1.35495520, +1.01631594, +1.33610117, +1.66275740, +1.12912822, +1.47720051, +1.98319495, +1.60756195, +1.17538929, +1.72016394, +1.77500582, +1.36331451
1191mean(0) = getMean(sample, rweight)
1192mean(0) ! reference
1193(+0.450781077, -0.430357993)
1194var(0) = getVar(sample, rweight)
1195var(0) ! reference
1196+0.188968927
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.450781047, -0.430357993)
1204varMerged
1205+0.188968927
1206call setVarMeanMerged(var(2), mean(2), var(1), mean(1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1207mean(2)
1208(+0.450781047, -0.430357993)
1209mean(0) ! reference
1210(+0.450781077, -0.430357993)
1211var(2)
1212+0.188968927
1213var(0) ! reference
1214+0.188968927
1215
1216
1217!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1218!Compute the biased merged variance and mean of a multivariate sample.
1219!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1220
1221
1222dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1223do isam = 2, nsam
1224 lb(isam) = ub(isam - 1) + 1
1225 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1226end do
1227lb
1228+1, +4
1229ub
1230+3, +8
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.673878193, -0.822478533E-1, -0.121752024, +0.602098107, -0.816865087, +0.286071777, -0.647420049, -0.569746017
1239-0.413405657, -0.102172732, +0.282871127, -0.480239749, -0.980863333, -0.569934964, +0.207841396E-1, +0.195160985
1240+0.920181870, +0.847525597E-1, +0.427275658, +0.984964848, -0.635676861, -0.591207743E-1, -0.138723612, -0.825031996E-1
1241mean(:,0) = getVar(sample, dim)
1242mean(:,0) ! reference
1243+0.284246475, +0.161655322, +0.269823492
1244var(:,0) = getVar(sample, dim)
1245var(:,0) ! reference
1246+0.284246475, +0.161655322, +0.269823492
1247do isam = 1, nsam
1248 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
1249 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1250end do
1251call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1252meanMerged
1253-0.844978690E-1, -0.255975038, +0.187643811
1254varMerged
1255+0.284246475, +0.161655322, +0.269823462
1256call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1257mean(:,2)
1258-0.844978690E-1, -0.255975038, +0.187643811
1259mean(:,0) ! reference
1260+0.284246475, +0.161655322, +0.269823492
1261var(:,2)
1262+0.284246475, +0.161655322, +0.269823462
1263var(:,0) ! reference
1264+0.284246475, +0.161655322, +0.269823492
1265
1266
1267dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1268do isam = 2, nsam
1269 lb(isam) = ub(isam - 1) + 1
1270 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1271end do
1272lb
1273+1, +4
1274ub
1275+3, +5
1276ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1277call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1278call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1279call setResized(meanMerged, ndim)
1280call setResized(varMerged, ndim)
1281sample = getUnifRand(-1., +1., ndim, ub(nsam))
1282sample
1283+0.316623449, +0.806839466E-1, +0.890358686E-1, +0.814008594, -0.131149411
1284+0.522686958, +0.475092769, +0.296270967, -0.117463112, +0.144895077
1285mean(:,0) = getVar(sample, dim)
1286mean(:,0) ! reference
1287+0.104218200, +0.544440337E-1
1288var(:,0) = getVar(sample, dim)
1289var(:,0) ! reference
1290+0.104218200, +0.544440337E-1
1291do isam = 1, nsam
1292 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
1293 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1294end do
1295call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1296meanMerged
1297+0.233840495, +0.264296561
1298varMerged
1299+0.104218185, +0.544440299E-1
1300call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1301mean(:,2)
1302+0.233840495, +0.264296561
1303mean(:,0) ! reference
1304+0.104218200, +0.544440337E-1
1305var(:,2)
1306+0.104218185, +0.544440299E-1
1307var(:,0) ! reference
1308+0.104218200, +0.544440337E-1
1309
1310
1311dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1312do isam = 2, nsam
1313 lb(isam) = ub(isam - 1) + 1
1314 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1315end do
1316lb
1317+1, +7
1318ub
1319+6, +9
1320ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1321call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1322call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1323call setResized(meanMerged, ndim)
1324call setResized(varMerged, ndim)
1325sample = getUnifRand(-1., +1., ndim, ub(nsam))
1326sample
1327+0.871185064E-1, -0.629873872, +0.854349852, +0.388035655, -0.194378495, -0.709634900, -0.191579342, +0.118307352, +0.106641173
1328-0.809958339, -0.944280386, -0.863182545E-2, -0.700746059, +0.561275482, +0.705862045E-1, -0.687666893, -0.882070422, -0.463394284
1329+0.361158848E-1, +0.150267124, -0.744659662, +0.211884975E-1, -0.949161410, +0.536733747, +0.723189116E-1, +0.175078154, +0.725513101
1330mean(:,0) = getVar(sample, dim)
1331mean(:,0) ! reference
1332+0.209444776, +0.240532562, +0.258892536
1333var(:,0) = getVar(sample, dim)
1334var(:,0) ! reference
1335+0.209444776, +0.240532562, +0.258892536
1336do isam = 1, nsam
1337 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
1338 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1339end do
1340call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1341meanMerged
1342-0.190015640E-1, -0.429431826, +0.259935856E-2
1343varMerged
1344+0.209444776, +0.240532577, +0.258892566
1345call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1346mean(:,2)
1347-0.190015640E-1, -0.429431826, +0.259935856E-2
1348mean(:,0) ! reference
1349+0.209444776, +0.240532562, +0.258892536
1350var(:,2)
1351+0.209444776, +0.240532577, +0.258892566
1352var(:,0) ! reference
1353+0.209444776, +0.240532562, +0.258892536
1354
1355
1356dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1357do isam = 2, nsam
1358 lb(isam) = ub(isam - 1) + 1
1359 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1360end do
1361lb
1362+1, +8
1363ub
1364+7, +10
1365ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1366call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1367call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1368call setResized(meanMerged, ndim)
1369call setResized(varMerged, ndim)
1370sample = getUnifRand(-1., +1., ndim, ub(nsam))
1371sample
1372-0.275074720, -0.101843476, +0.669331431, -0.407834172, +0.904187202, -0.558673739, +0.319072008, -0.339912176E-1, +0.370397806, -0.124195218
1373+0.954245687, +0.209650159, -0.406650662, -0.795715809, -0.214869499, +0.636410594, +0.693832517, -0.509878635, +0.860945344, +0.643084168
1374mean(:,0) = getVar(sample, dim)
1375mean(:,0) ! reference
1376+0.202765450, +0.367149174
1377var(:,0) = getVar(sample, dim)
1378var(:,0) ! reference
1379+0.202765450, +0.367149174
1380do isam = 1, nsam
1381 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
1382 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1383end do
1384call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1385meanMerged
1386+0.761375949E-1, +0.207105398
1387varMerged
1388+0.202765450, +0.367149144
1389call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1390mean(:,2)
1391+0.761375949E-1, +0.207105398
1392mean(:,0) ! reference
1393+0.202765450, +0.367149174
1394var(:,2)
1395+0.202765450, +0.367149144
1396var(:,0) ! reference
1397+0.202765450, +0.367149174
1398
1399
1400dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1401do isam = 2, nsam
1402 lb(isam) = ub(isam - 1) + 1
1403 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1404end do
1405lb
1406+1, +6
1407ub
1408+5, +8
1409ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1410call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1411call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1412call setResized(meanMerged, ndim)
1413call setResized(varMerged, ndim)
1414sample = getUnifRand(-1., +1., ndim, ub(nsam))
1415sample
1416+0.980465055, -0.420908451, -0.774960518E-1, +0.844089150, +0.200681567, -0.675600648, +0.673182964, +0.408302546
1417+0.966446996, -0.170338511, +0.558085322, -0.952000141, +0.385434628, -0.182349801, +0.295474052, -0.218785882
1418mean(:,0) = getVar(sample, dim)
1419mean(:,0) ! reference
1420+0.313329905, +0.304955900
1421var(:,0) = getVar(sample, dim)
1422var(:,0) ! reference
1423+0.313329905, +0.304955900
1424do isam = 1, nsam
1425 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
1426 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1427end do
1428call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1429meanMerged
1430+0.241589516, +0.852458328E-1
1431varMerged
1432+0.313329935, +0.304955900
1433call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1434mean(:,2)
1435+0.241589516, +0.852458328E-1
1436mean(:,0) ! reference
1437+0.313329905, +0.304955900
1438var(:,2)
1439+0.313329935, +0.304955900
1440var(:,0) ! reference
1441+0.313329905, +0.304955900
1442
1443
1444dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1445do isam = 2, nsam
1446 lb(isam) = ub(isam - 1) + 1
1447 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1448end do
1449lb
1450+1, +5
1451ub
1452+4, +9
1453ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1454call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1455call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1456call setResized(meanMerged, ndim)
1457call setResized(varMerged, ndim)
1458sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), -getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
1459sample
1460(-0.378144979, +0.784786463), (-0.158752084, +0.635889292), (+0.345385432, +0.635727286), (-0.280241966, +0.264153242), (-0.104096413, -0.652617812), (+0.990574837, -0.293915272), (+0.555421352, -0.991181135), (+0.256773710, +0.707726598), (-0.745195150E-1, +0.371135354)
1461(-0.860789180, +0.566175222), (+0.795145988, +0.924334288), (-0.471353531E-3, +0.288523197), (-0.759034991, -0.561781645), (-0.801919341, -0.570302844), (-0.881265998, -0.595435023), (+0.330778480, +0.916667223), (+0.714109659, -0.905136943), (-0.621619105, +0.226464868)
1462mean(:,0) = getVar(sample, dim)
1463mean(:,0) ! reference
1464(+0.553404987, +0.00000000), (+0.871875763, +0.00000000)
1465var(:,0) = getVar(sample, dim)
1466var(:,0) ! reference
1467+0.553404987, +0.871875763
1468do isam = 1, nsam
1469 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
1470 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1471end do
1472call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1473meanMerged
1474(+0.128044501, +0.162411556), (-0.231673986, +0.321675912E-1)
1475varMerged
1476+0.553405106, +0.871875823
1477call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1478mean(:,2)
1479(+0.128044501, +0.162411556), (-0.231673986, +0.321675912E-1)
1480mean(:,0) ! reference
1481(+0.553404987, +0.00000000), (+0.871875763, +0.00000000)
1482var(:,2)
1483+0.553405106, +0.871875823
1484var(:,0) ! reference
1485+0.553404987, +0.871875763
1486
1487
1488dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1489do isam = 2, nsam
1490 lb(isam) = ub(isam - 1) + 1
1491 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1492end do
1493lb
1494+1, +8
1495ub
1496+7, +10
1497ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1498call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1499call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1500call setResized(meanMerged, ndim)
1501call setResized(varMerged, ndim)
1502sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), -getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
1503sample
1504(+0.363544822, +0.285536766), (+0.545240641, +0.655256748), (-0.916536331, +0.490805387), (-0.628100038, +0.762518048), (-0.136824369, -0.720312476), (-0.246749163, -0.558044910E-1), (-0.724772692, +0.491334319), (-0.380319357, +0.133233905), (-0.720827341, +0.345874429), (-0.960930347, -0.879554152)
1505(+0.926000953, +0.115115404), (-0.627913475E-1, +0.346830726), (+0.656529784, +0.845539808), (+0.318310380, -0.615681648), (-0.902001858E-1, +0.375699162), (-0.402588129, +0.616224289), (+0.263877034, -0.318373799), (-0.785951734, -0.901307106), (-0.856879711, +0.801743746), (+0.885992050E-1, +0.714808702E-1)
1506(+0.239124656, +0.302460313), (-0.760285735, +0.658087730), (+0.215479612, +0.540213227), (+0.863287091, +0.689703345), (+0.735254049, -0.172420859), (-0.871239066, -0.733389854), (-0.430110335, -0.326155066), (+0.667143822, -0.455365181E-1), (-0.358660817, +0.409818530), (-0.873613954, +0.236648321)
1507mean(:,0) = getVar(sample, dim)
1508mean(:,0) ! reference
1509(+0.518766344, +0.00000000), (+0.612434626, +0.00000000), (+0.616447270, +0.00000000)
1510var(:,0) = getVar(sample, dim)
1511var(:,0) ! reference
1512+0.518766344, +0.612434626, +0.616447270
1513do isam = 1, nsam
1514 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
1515 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1516end do
1517call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1518meanMerged
1519(-0.380627453, +0.150888845), (+0.549061596E-2, +0.133727148), (-0.573620722E-1, +0.155942902)
1520varMerged
1521+0.518766344, +0.612434506, +0.616447270
1522call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1523mean(:,2)
1524(-0.380627453, +0.150888845), (+0.549061596E-2, +0.133727148), (-0.573620722E-1, +0.155942902)
1525mean(:,0) ! reference
1526(+0.518766344, +0.00000000), (+0.612434626, +0.00000000), (+0.616447270, +0.00000000)
1527var(:,2)
1528+0.518766344, +0.612434506, +0.616447270
1529var(:,0) ! reference
1530+0.518766344, +0.612434626, +0.616447270
1531
1532
1533dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1534do isam = 2, nsam
1535 lb(isam) = ub(isam - 1) + 1
1536 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1537end do
1538lb
1539+1, +5
1540ub
1541+4, +9
1542ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1543call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1544call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1545call setResized(meanMerged, ndim)
1546call setResized(varMerged, ndim)
1547sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), -getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
1548sample
1549(+0.817202568, -0.396354795), (+0.101139545E-1, -0.390070677E-1), (-0.118330240, +0.729845047), (-0.564297795, +0.189411640E-1), (-0.885322571, -0.517827749), (-0.991574764, -0.192674041), (+0.132183313, -0.598806262), (+0.648195028, -0.660595894), (+0.481981039E-1, +0.285105228)
1550mean(:,0) = getVar(sample, dim)
1551mean(:,0) ! reference
1552(+0.531199455, +0.00000000)
1553var(:,0) = getVar(sample, dim)
1554var(:,0) ! reference
1555+0.531199455
1556do isam = 1, nsam
1557 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
1558 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1559end do
1560call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1561meanMerged
1562(-0.100403607, -0.152374953)
1563varMerged
1564+0.531199515
1565call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1566mean(:,2)
1567(-0.100403607, -0.152374953)
1568mean(:,0) ! reference
1569(+0.531199455, +0.00000000)
1570var(:,2)
1571+0.531199515
1572var(:,0) ! reference
1573+0.531199455
1574
1575
1576dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1577do isam = 2, nsam
1578 lb(isam) = ub(isam - 1) + 1
1579 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1580end do
1581lb
1582+1, +5
1583ub
1584+4, +6
1585ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1586call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1587call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1588call setResized(meanMerged, ndim)
1589call setResized(varMerged, ndim)
1590sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), -getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
1591sample
1592(+0.803731799, +0.760030746), (+0.239833355, -0.823025227), (+0.948057294, -0.986279607), (-0.120705962, +0.434778452), (-0.249415994, -0.212378144), (+0.867885709, +0.389903665)
1593mean(:,0) = getVar(sample, dim)
1594mean(:,0) ! reference
1595(+0.663597226, +0.00000000)
1596var(:,0) = getVar(sample, dim)
1597var(:,0) ! reference
1598+0.663597226
1599do isam = 1, nsam
1600 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
1601 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1602end do
1603call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1604meanMerged
1605(+0.414897710, -0.728283525E-1)
1606varMerged
1607+0.663597226
1608call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1609mean(:,2)
1610(+0.414897710, -0.728283525E-1)
1611mean(:,0) ! reference
1612(+0.663597226, +0.00000000)
1613var(:,2)
1614+0.663597226
1615var(:,0) ! reference
1616+0.663597226
1617
1618
1619dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1620do isam = 2, nsam
1621 lb(isam) = ub(isam - 1) + 1
1622 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1623end do
1624lb
1625+1, +6
1626ub
1627+5, +12
1628ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1629call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1630call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1631call setResized(meanMerged, ndim)
1632call setResized(varMerged, ndim)
1633sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), -getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
1634sample
1635(+0.661868572, +0.675979853), (-0.113221407, +0.103214979E-1), (+0.551070213, +0.199885845), (-0.382801056, -0.728746057), (+0.685754657, -0.947849393), (+0.746979713, +0.675976992), (-0.778337717E-1, -0.339349270), (+0.202113986, +0.140822291), (+0.158392787, -0.241889238), (-0.676987171, +0.568593144), (+0.991729021, -0.916088820), (+0.765277624, -0.167193532)
1636(+0.487781525, +0.113389134), (+0.867295623, -0.670327187), (+0.281141996, -0.246339917), (-0.489654422, -0.775077701), (+0.448069096, +0.612316251), (+0.649372816, -0.360358000), (-0.192307472, +0.508874893), (+0.856851816, -0.792933226), (+0.478189707, -0.921753645E-1), (+0.712410688, -0.744082093), (+0.196723819, +0.468205452), (+0.754296422, -0.455669045)
1637mean(:,0) = getVar(sample, dim)
1638mean(:,0) ! reference
1639(+0.556072414, +0.00000000), (+0.411034644, +0.00000000)
1640var(:,0) = getVar(sample, dim)
1641var(:,0) ! reference
1642+0.556072414, +0.411034644
1643do isam = 1, nsam
1644 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
1645 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1646end do
1647call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1648meanMerged
1649(+0.292695284, -0.891280547E-1), (+0.420847654, -0.202848077)
1650varMerged
1651+0.556072414, +0.411034644
1652call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1653mean(:,2)
1654(+0.292695284, -0.891280547E-1), (+0.420847654, -0.202848077)
1655mean(:,0) ! reference
1656(+0.556072414, +0.00000000), (+0.411034644, +0.00000000)
1657var(:,2)
1658+0.556072414, +0.411034644
1659var(:,0) ! reference
1660+0.556072414, +0.411034644
1661
1662
1663!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1664!Compute the biased merged variance and mean of a frequency weighted multivariate sample.
1665!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1666
1667
1668dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1669do isam = 2, nsam
1670 lb(isam) = ub(isam - 1) + 1
1671 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1672end do
1673lb
1674+1, +5
1675ub
1676+4, +9
1677ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1678call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1679call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1680call setResized(meanMerged, ndim)
1681call setResized(varMerged, ndim)
1682sample = getUnifRand(-1., +1., ndim, ub(nsam))
1683sample
1684-0.660417914, -0.859262466, -0.411357164, -0.514616013, -0.183404684E-1, +0.298111916, -0.532041192, +0.270842075, +0.907958031
1685+0.204561591, -0.636654019, +0.595976353, +0.477079749, +0.147745252, +0.913274765, +0.505717754, -0.589249015, +0.998367310
1686iweight = getUnifRand(1, 10, size(sample, dim, IK))
1687iweight
1688+8, +3, +6, +1, +2, +4, +5, +7, +9
1689mean(:,0) = getVar(sample, 2_IK, iweight)
1690mean(:,0) ! reference
1691+0.368293315, +0.330908120
1692var(:,0) = getVar(sample, 2_IK, iweight)
1693var(:,0) ! reference
1694+0.368293315, +0.330908120
1695do isam = 1, nsam
1696 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1697 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1698end do
1699call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1700meanMerged
1701-0.506846756E-1, +0.335938007
1702varMerged
1703+0.368293285, +0.330908149
1704call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1705mean(:,2)
1706-0.506846756E-1, +0.335938007
1707mean(:,0) ! reference
1708+0.368293315, +0.330908120
1709var(:,2)
1710+0.368293285, +0.330908149
1711var(:,0) ! reference
1712+0.368293315, +0.330908120
1713
1714
1715dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1716do isam = 2, nsam
1717 lb(isam) = ub(isam - 1) + 1
1718 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1719end do
1720lb
1721+1, +6
1722ub
1723+5, +8
1724ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1725call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1726call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1727call setResized(meanMerged, ndim)
1728call setResized(varMerged, ndim)
1729sample = getUnifRand(-1., +1., ndim, ub(nsam))
1730sample
1731-0.427000165, -0.985792041, -0.926127434E-1, +0.154768229, -0.484859467, +0.672785044E-1, -0.958394170, -0.557077527
1732+0.839395523, -0.892483711, -0.123130560, -0.264866352E-1, -0.778559446E-1, -0.987114668, +0.640638113, -0.677311182
1733-0.715264797, -0.263892651, +0.951863050, -0.787857890, +0.270392179, -0.798095226, -0.107612729, +0.648488164
1734iweight = getUnifRand(1, 10, size(sample, dim, IK))
1735iweight
1736+2, +7, +2, +5, +10, +4, +5, +7
1737mean(:,0) = getVar(sample, 2_IK, iweight)
1738mean(:,0) ! reference
1739+0.154608235, +0.315404683, +0.300709367
1740var(:,0) = getVar(sample, 2_IK, iweight)
1741var(:,0) ! reference
1742+0.154608235, +0.315404683, +0.300709367
1743do isam = 1, nsam
1744 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1745 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1746end do
1747call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1748meanMerged
1749-0.486593425, -0.266959429, -0.428677946E-1
1750varMerged
1751+0.154608220, +0.315404743, +0.300709367
1752call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1753mean(:,2)
1754-0.486593425, -0.266959429, -0.428677946E-1
1755mean(:,0) ! reference
1756+0.154608235, +0.315404683, +0.300709367
1757var(:,2)
1758+0.154608220, +0.315404743, +0.300709367
1759var(:,0) ! reference
1760+0.154608235, +0.315404683, +0.300709367
1761
1762
1763dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1764do isam = 2, nsam
1765 lb(isam) = ub(isam - 1) + 1
1766 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1767end do
1768lb
1769+1, +7
1770ub
1771+6, +8
1772ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1773call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1774call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1775call setResized(meanMerged, ndim)
1776call setResized(varMerged, ndim)
1777sample = getUnifRand(-1., +1., ndim, ub(nsam))
1778sample
1779-0.869674087, +0.183364630, -0.685518861, -0.614286780, +0.569463491, -0.614001393, +0.385738611, -0.607689619
1780+0.279607892, +0.368283391, +0.701190948, +0.854333758, +0.758232713, -0.503564358, -0.926779509E-1, +0.818706751E-1
1781iweight = getUnifRand(1, 10, size(sample, dim, IK))
1782iweight
1783+8, +6, +1, +5, +10, +5, +1, +9
1784mean(:,0) = getVar(sample, 2_IK, iweight)
1785mean(:,0) ! reference
1786+0.310450584, +0.168456733
1787var(:,0) = getVar(sample, 2_IK, iweight)
1788var(:,0) ! reference
1789+0.310450584, +0.168456733
1790do isam = 1, nsam
1791 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1792 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1793end do
1794call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1795meanMerged
1796-0.268288851, +0.336179703
1797varMerged
1798+0.310450584, +0.168456703
1799call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1800mean(:,2)
1801-0.268288851, +0.336179703
1802mean(:,0) ! reference
1803+0.310450584, +0.168456733
1804var(:,2)
1805+0.310450584, +0.168456703
1806var(:,0) ! reference
1807+0.310450584, +0.168456733
1808
1809
1810dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1811do isam = 2, nsam
1812 lb(isam) = ub(isam - 1) + 1
1813 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1814end do
1815lb
1816+1, +3
1817ub
1818+2, +9
1819ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1820call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1821call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1822call setResized(meanMerged, ndim)
1823call setResized(varMerged, ndim)
1824sample = getUnifRand(-1., +1., ndim, ub(nsam))
1825sample
1826+0.842086673, +0.392747164, +0.703353286, +0.757509470, -0.496723056, -0.636933088, +0.610530376E-1, +0.901387095, -0.431204200
1827+0.964926124, -0.477820277, -0.494387507, -0.533403873, +0.299304128, -0.410095453E-1, +0.340351105, -0.391834021, +0.279610276
1828iweight = getUnifRand(1, 10, size(sample, dim, IK))
1829iweight
1830+8, +2, +8, +1, +7, +5, +3, +10, +6
1831mean(:,0) = getVar(sample, 2_IK, iweight)
1832mean(:,0) ! reference
1833+0.393623918, +0.259180933
1834var(:,0) = getVar(sample, 2_IK, iweight)
1835var(:,0) ! reference
1836+0.393623918, +0.259180933
1837do isam = 1, nsam
1838 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1839 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1840end do
1841call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1842meanMerged
1843+0.277092040, +0.589144006E-1
1844varMerged
1845+0.393623918, +0.259180933
1846call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1847mean(:,2)
1848+0.277092040, +0.589144006E-1
1849mean(:,0) ! reference
1850+0.393623918, +0.259180933
1851var(:,2)
1852+0.393623918, +0.259180933
1853var(:,0) ! reference
1854+0.393623918, +0.259180933
1855
1856
1857dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1858do isam = 2, nsam
1859 lb(isam) = ub(isam - 1) + 1
1860 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1861end do
1862lb
1863+1, +8
1864ub
1865+7, +13
1866ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1867call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1868call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1869call setResized(meanMerged, ndim)
1870call setResized(varMerged, ndim)
1871sample = getUnifRand(-1., +1., ndim, ub(nsam))
1872sample
1873-0.975788355, +0.697630763, +0.647995591, -0.105427027, +0.235918999, -0.348901629, -0.408542156E-1, -0.489205718, -0.710437536, +0.729631901, -0.363224745E-1, +0.641984701, -0.599397898
1874-0.140144467, -0.808325052, -0.434179664, +0.633736730, -0.216481805, +0.606680393, +0.309311867, -0.913462043, +0.275460362, -0.778099418, -0.810211420, +0.673360467, +0.396342278
1875+0.162907600, -0.362729311, +0.238808870, +0.664463758, +0.454615474, -0.311160088E-2, -0.193928003, +0.121584773, +0.939483285, +0.915882587, +0.593599677, +0.676163912, +0.477783084
1876-0.531190991, -0.371241093, +0.810835600, +0.417845249E-1, +0.310258746, -0.505951524, -0.928792119, -0.269016623, +0.232921243, +0.458641648, +0.896361947, +0.843256712, -0.320005774
1877+0.754305363, -0.161245942, -0.173393846, +0.802477598E-1, -0.393825650, +0.414924145, +0.417127967, -0.978541017, -0.469788313, +0.326799154, +0.618826032, -0.611207485, +0.177711368
1878iweight = getUnifRand(1, 10, size(sample, dim, IK))
1879iweight
1880+7, +10, +7, +1, +8, +2, +1, +8, +3, +3, +4, +8, +10
1881mean(:,0) = getVar(sample, 2_IK, iweight)
1882mean(:,0) ! reference
1883+0.376159191, +0.323172987, +0.134796619, +0.290565819, +0.260407686
1884var(:,0) = getVar(sample, 2_IK, iweight)
1885var(:,0) ! reference
1886+0.376159191, +0.323172987, +0.134796619, +0.290565819, +0.260407686
1887do isam = 1, nsam
1888 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1889 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1890end do
1891call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1892meanMerged
1893+0.120218322E-1, -0.199793279, +0.310920507, +0.816980451E-1, -0.114777751
1894varMerged
1895+0.376159221, +0.323172987, +0.134796649, +0.290565848, +0.260407656
1896call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1897mean(:,2)
1898+0.120218322E-1, -0.199793279, +0.310920507, +0.816980451E-1, -0.114777751
1899mean(:,0) ! reference
1900+0.376159191, +0.323172987, +0.134796619, +0.290565819, +0.260407686
1901var(:,2)
1902+0.376159221, +0.323172987, +0.134796649, +0.290565848, +0.260407656
1903var(:,0) ! reference
1904+0.376159191, +0.323172987, +0.134796619, +0.290565819, +0.260407686
1905
1906
1907dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1908do isam = 2, nsam
1909 lb(isam) = ub(isam - 1) + 1
1910 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1911end do
1912lb
1913+1, +5
1914ub
1915+4, +9
1916ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1917call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1918call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1919call setResized(meanMerged, ndim)
1920call setResized(varMerged, ndim)
1921sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
1922sample
1923(-0.731144309, +0.635938764), (+0.374867797, -0.717543960), (-0.671098351, +0.851646662E-1), (-0.674366951E-3, +0.510704517E-2), (+0.772323728, +0.603280425), (+0.759138346, +0.208294630), (-0.563650131, -0.478124619E-2), (+0.903382301, +0.467202663), (-0.948218942, -0.991014361)
1924(+0.950211406, +0.943210244), (+0.972982883, +0.467387676), (+0.692174315, +0.619947314), (+0.139020562, +0.305938721E-1), (-0.282817006, -0.477673292), (+0.676947236, +0.341394186), (+0.932187796, -0.677003860E-1), (+0.870296836, -0.608647823), (-0.461613059, -0.239146352)
1925(-0.613898396, -0.528833151), (-0.462549925E-1, -0.202037454), (+0.284729123, -0.572853446), (-0.614354730, +0.466781855), (-0.976721048E-1, +0.770081282E-1), (-0.342673182, -0.133515239), (+0.482106090, +0.295907259), (+0.255154252, -0.508087754), (+0.726756692, -0.314780116)
1926iweight = getUnifRand(1, 10, size(sample, dim, IK))
1927iweight
1928+3, +2, +9, +5, +3, +1, +2, +6, +1
1929mean(:,0) = getVar(sample, 2_IK, iweight)
1930mean(:,0) ! reference
1931(+0.613335133, +0.00000000), (+0.466964006, +0.00000000), (+0.323487073, +0.00000000)
1932var(:,0) = getVar(sample, 2_IK, iweight)
1933var(:,0) ! reference
1934+0.613335133, +0.466964006, +0.323487073
1935do isam = 1, nsam
1936 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1937 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1938end do
1939call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1940meanMerged
1941(-0.333146751E-1, +0.158922523), (+0.567947268, +0.136838809), (+0.446213037E-2, -0.233947799)
1942varMerged
1943+0.613335192, +0.466964036, +0.323487103
1944call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1945mean(:,2)
1946(-0.333146751E-1, +0.158922523), (+0.567947268, +0.136838809), (+0.446213037E-2, -0.233947799)
1947mean(:,0) ! reference
1948(+0.613335133, +0.00000000), (+0.466964006, +0.00000000), (+0.323487073, +0.00000000)
1949var(:,2)
1950+0.613335192, +0.466964036, +0.323487103
1951var(:,0) ! reference
1952+0.613335133, +0.466964006, +0.323487073
1953
1954
1955dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1956do isam = 2, nsam
1957 lb(isam) = ub(isam - 1) + 1
1958 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1959end do
1960lb
1961+1, +7
1962ub
1963+6, +11
1964ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1965call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1966call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1967call setResized(meanMerged, ndim)
1968call setResized(varMerged, ndim)
1969sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
1970sample
1971(+0.919542193, -0.590044498), (-0.117025852, +0.346031308), (-0.313919902, -0.481535554), (-0.430748940, -0.319551945), (+0.699633956, -0.260073781), (+0.554611087, +0.720292330), (+0.740971565E-1, +0.562696457E-1), (-0.837767601, -0.458710551), (-0.473090410E-1, +0.672225952E-1), (-0.778945327, +0.273230076), (-0.784938216, +0.589613318)
1972iweight = getUnifRand(1, 10, size(sample, dim, IK))
1973iweight
1974+9, +5, +2, +7, +5, +10, +9, +6, +9, +3, +2
1975mean(:,0) = getVar(sample, 2_IK, iweight)
1976mean(:,0) ! reference
1977(+0.513820112, +0.00000000)
1978var(:,0) = getVar(sample, 2_IK, iweight)
1979var(:,0) ! reference
1980+0.513820112
1981do isam = 1, nsam
1982 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1983 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1984end do
1985call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1986meanMerged
1987(+0.656675398E-1, -0.775433332E-2)
1988varMerged
1989+0.513820231
1990call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1991mean(:,2)
1992(+0.656675398E-1, -0.775433332E-2)
1993mean(:,0) ! reference
1994(+0.513820112, +0.00000000)
1995var(:,2)
1996+0.513820231
1997var(:,0) ! reference
1998+0.513820112
1999
2000
2001dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
2002do isam = 2, nsam
2003 lb(isam) = ub(isam - 1) + 1
2004 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
2005end do
2006lb
2007+1, +7
2008ub
2009+6, +13
2010ndim = getUnifRand(1, minval(ub - lb + 1, 1))
2011call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
2012call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
2013call setResized(meanMerged, ndim)
2014call setResized(varMerged, ndim)
2015sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
2016sample
2017(-0.916586399, +0.394285917), (+0.313057184, -0.279248118), (-0.537662506, +0.504914522E-1), (+0.938301206, -0.600413680), (-0.281049132, +0.316900492), (-0.127742290E-1, -0.439381957), (+0.953676701, +0.757459760), (+0.132838130, -0.131430626), (+0.204635859, -0.636905670), (+0.631716013, +0.338219643), (-0.623654485, +0.509447336), (-0.237762928E-1, +0.666531086), (+0.835105658, -0.987496257)
2018(-0.309421539, +0.358498454), (-0.176324844E-1, -0.392213464), (+0.283795595E-1, +0.299593210), (+0.870936990, +0.559759021), (-0.418530941, +0.264498591), (+0.746543288, -0.835966349), (+0.527251005, +0.472137809), (-0.793615341, -0.979268670), (-0.993414521, +0.928194523E-1), (-0.988624215, +0.670853734), (-0.941670656, -0.493599176), (+0.447170377, -0.370711327), (-0.958852410, +0.706814885)
2019(-0.876813173, +0.301994085), (-0.789593816, +0.994130373), (-0.262838602, -0.383614302), (+0.576882362, -0.524369001), (+0.892165184, -0.712896705), (+0.415541768, -0.453322172), (+0.538908243, +0.865387201), (+0.869148970E-1, +0.722499251), (-0.104638934, -0.245761871E-2), (-0.173080325, +0.963731408), (+0.784659147, -0.239925981), (+0.365721464, +0.708905578), (-0.382956266E-1, -0.669354081)
2020iweight = getUnifRand(1, 10, size(sample, dim, IK))
2021iweight
2022+8, +4, +4, +3, +10, +4, +9, +6, +8, +9, +1, +5, +3
2023mean(:,0) = getVar(sample, 2_IK, iweight)
2024mean(:,0) ! reference
2025(+0.591418028, +0.00000000), (+0.666445255, +0.00000000), (+0.713460088, +0.00000000)
2026var(:,0) = getVar(sample, 2_IK, iweight)
2027var(:,0) ! reference
2028+0.591418028, +0.666445255, +0.713460088
2029do isam = 1, nsam
2030 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
2031 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
2032end do
2033call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
2034meanMerged
2035(+0.137670681, +0.906269699E-1), (-0.263006091, +0.113581896), (+0.887221545E-1, +0.221845865)
2036varMerged
2037+0.591417909, +0.666445196, +0.713460147
2038call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
2039mean(:,2)
2040(+0.137670681, +0.906269699E-1), (-0.263006091, +0.113581896), (+0.887221545E-1, +0.221845865)
2041mean(:,0) ! reference
2042(+0.591418028, +0.00000000), (+0.666445255, +0.00000000), (+0.713460088, +0.00000000)
2043var(:,2)
2044+0.591417909, +0.666445196, +0.713460147
2045var(:,0) ! reference
2046+0.591418028, +0.666445255, +0.713460088
2047
2048
2049dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
2050do isam = 2, nsam
2051 lb(isam) = ub(isam - 1) + 1
2052 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
2053end do
2054lb
2055+1, +8
2056ub
2057+7, +12
2058ndim = getUnifRand(1, minval(ub - lb + 1, 1))
2059call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
2060call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
2061call setResized(meanMerged, ndim)
2062call setResized(varMerged, ndim)
2063sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
2064sample
2065(-0.365330696, +0.917771101), (+0.645596147, +0.882356167), (+0.369055390, -0.128067732), (+0.578531623, +0.200191379), (-0.877238989, -0.464088202), (+0.958694935, +0.837901235), (+0.792880535, +0.943241358), (+0.283083797, +0.561653018), (+0.673828602, -0.376172900), (+0.829086185, -0.953635812), (+0.570432305, -0.337052107), (+0.478179455E-1, -0.721283078)
2066(+0.413644314E-2, -0.550962210), (-0.225916982, +0.396037102E-2), (-0.862558126, -0.842077374), (-0.786230326, +0.344249249), (+0.574318409, +0.746545553), (+0.465992928, +0.656222343), (-0.345471025, -0.109551907), (+0.367994666, -0.556458235), (-0.543261528, +0.202458143), (+0.188379049, +0.239189863), (-0.835844874, +0.995811224), (-0.321888328, -0.304212809)
2067iweight = getUnifRand(1, 10, size(sample, dim, IK))
2068iweight
2069+10, +2, +4, +3, +5, +1, +6, +5, +5, +5, +9, +10
2070mean(:,0) = getVar(sample, 2_IK, iweight)
2071mean(:,0) ! reference
2072(+0.728218198, +0.00000000), (+0.535279453, +0.00000000)
2073var(:,0) = getVar(sample, 2_IK, iweight)
2074var(:,0) ! reference
2075+0.728218198, +0.535279453
2076do isam = 1, nsam
2077 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
2078 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
2079end do
2080call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
2081meanMerged
2082(+0.257254571, +0.172393471E-1), (-0.240470141, +0.190845802E-1)
2083varMerged
2084+0.728218079, +0.535279393
2085call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
2086mean(:,2)
2087(+0.257254571, +0.172393471E-1), (-0.240470141, +0.190845802E-1)
2088mean(:,0) ! reference
2089(+0.728218198, +0.00000000), (+0.535279453, +0.00000000)
2090var(:,2)
2091+0.728218079, +0.535279393
2092var(:,0) ! reference
2093+0.728218198, +0.535279453
2094
2095
2096dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
2097do isam = 2, nsam
2098 lb(isam) = ub(isam - 1) + 1
2099 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
2100end do
2101lb
2102+1, +5
2103ub
2104+4, +10
2105ndim = getUnifRand(1, minval(ub - lb + 1, 1))
2106call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
2107call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
2108call setResized(meanMerged, ndim)
2109call setResized(varMerged, ndim)
2110sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
2111sample
2112(-0.163674712, +0.618901134), (-0.602144003, -0.383658409E-1), (+0.759015799, +0.873760462), (+0.681569219, +0.446096301), (-0.950332642, +0.448791742), (+0.123718858, +0.155826330), (-0.826570749, +0.160135508), (+0.851955533, +0.199545264), (-0.603564262, -0.280654788), (-0.183007717, -0.399822593)
2113(-0.275792480, +0.775499344), (+0.279319882, +0.544058204), (+0.727163434, +0.223751068E-1), (+0.889981270, +0.776767373), (+0.172757149, -0.747571468), (-0.960935712, +0.705681801), (-0.495451331, +0.779838204), (+0.626795292E-1, -0.398020267), (-0.125649333, -0.564246297), (+0.298560619, +0.430756330)
2114(-0.766203761, +0.561641455E-1), (+0.508560777, +0.127017498E-2), (+0.501844287, -0.378099918), (-0.744539976, -0.544650078), (+0.128742933, -0.959893703), (+0.727654099, -0.903180242), (-0.727039814, +0.292088151), (-0.285273790, +0.414487243), (+0.622250915, +0.132292986), (+0.827427506, +0.486079335)
2115iweight = getUnifRand(1, 10, size(sample, dim, IK))
2116iweight
2117+8, +9, +3, +2, +3, +2, +5, +3, +1, +1
2118mean(:,0) = getVar(sample, 2_IK, iweight)
2119mean(:,0) ! reference
2120(+0.460536003, +0.00000000), (+0.472161531, +0.00000000), (+0.544010162, +0.00000000)
2121var(:,0) = getVar(sample, 2_IK, iweight)
2122var(:,0) ! reference
2123+0.460536003, +0.472161531, +0.544010162
2124do isam = 1, nsam
2125 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
2126 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
2127end do
2128call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
2129meanMerged
2130(-0.217719674, +0.283682555), (+0.202455372E-1, +0.390850544), (-0.739442036E-1, -0.845033079E-1)
2131varMerged
2132+0.460536093, +0.472161591, +0.544010282
2133call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
2134mean(:,2)
2135(-0.217719674, +0.283682555), (+0.202455372E-1, +0.390850544), (-0.739442036E-1, -0.845033079E-1)
2136mean(:,0) ! reference
2137(+0.460536003, +0.00000000), (+0.472161531, +0.00000000), (+0.544010162, +0.00000000)
2138var(:,2)
2139+0.460536093, +0.472161591, +0.544010282
2140var(:,0) ! reference
2141+0.460536003, +0.472161531, +0.544010162
2142
2143
2144!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2145!Compute the biased merged variance and mean of a reliability weighted multivariate sample.
2146!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2147
2148
2149dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
2150do isam = 2, nsam
2151 lb(isam) = ub(isam - 1) + 1
2152 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
2153end do
2154lb
2155+1, +4
2156ub
2157+3, +7
2158ndim = getUnifRand(1, minval(ub - lb + 1, 1))
2159call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
2160call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
2161call setResized(meanMerged, ndim)
2162call setResized(varMerged, ndim)
2163sample = getUnifRand(-1., +1., ndim, ub(nsam))
2164sample
2165-0.982082129, +0.623544812, +0.764284730, +0.329686403, -0.357688308, -0.153028846, +0.626349449E-2
2166-0.116614223, -0.505707502, +0.705406785, +0.375628591, -0.848742366, -0.297226787, -0.896399140
2167rweight = getUnifRand(1., 2., size(sample, dim, IK))
2168rweight
2169+1.75152540, +1.71670938, +1.61362839, +1.38533998, +1.67360497, +1.34315097, +1.64866054
2170mean(:,0) = getVar(sample, 2_IK, rweight)
2171mean(:,0) ! reference
2172+0.331469446, +0.309894949
2173var(:,0) = getVar(sample, 2_IK, rweight)
2174var(:,0) ! reference
2175+0.331469446, +0.309894949
2176do isam = 1, nsam
2177 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2178 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2179end do
2180call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2181meanMerged
2182+0.221384801E-1, -0.243546009
2183varMerged
2184+0.331469417, +0.309894890
2185call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2186mean(:,2)
2187+0.221384801E-1, -0.243546009
2188mean(:,0) ! reference
2189+0.331469446, +0.309894949
2190var(:,2)
2191+0.331469417, +0.309894890
2192var(:,0) ! reference
2193+0.331469446, +0.309894949
2194
2195
2196dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
2197do isam = 2, nsam
2198 lb(isam) = ub(isam - 1) + 1
2199 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
2200end do
2201lb
2202+1, +7
2203ub
2204+6, +10
2205ndim = getUnifRand(1, minval(ub - lb + 1, 1))
2206call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
2207call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
2208call setResized(meanMerged, ndim)
2209call setResized(varMerged, ndim)
2210sample = getUnifRand(-1., +1., ndim, ub(nsam))
2211sample
2212+0.274299383, +0.661277294, -0.831468105E-1, +0.827208161, +0.430616140, +0.542174339, -0.706470013E-1, +0.182949305E-1, -0.588049531, +0.685019851
2213-0.463211536E-1, +0.506441593, -0.842996120, -0.120617986, -0.338768125, +0.552918911E-1, -0.944549680, -0.112939596, +0.985349417, +0.729394913
2214+0.763636112, -0.873452544, +0.784015536, -0.917551517E-1, -0.857350230, +0.729512572, -0.903003216, +0.936365485, +0.196956038, +0.693060875
2215rweight = getUnifRand(1., 2., size(sample, dim, IK))
2216rweight
2217+1.25234604, +1.73891270, +1.22004032, +1.98462963, +1.43620944, +1.07657146, +1.39615846, +1.23243237, +1.82100368, +1.53318954
2218mean(:,0) = getVar(sample, 2_IK, rweight)
2219mean(:,0) ! reference
2220+0.203808531, +0.363111854, +0.503614664
2221var(:,0) = getVar(sample, 2_IK, rweight)
2222var(:,0) ! reference
2223+0.203808531, +0.363111854, +0.503614664
2224do isam = 1, nsam
2225 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2226 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2227end do
2228call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2229meanMerged
2230+0.281738758, +0.396456644E-1, +0.735439211E-1
2231varMerged
2232+0.203808531, +0.363111824, +0.503614604
2233call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2234mean(:,2)
2235+0.281738758, +0.396456644E-1, +0.735439211E-1
2236mean(:,0) ! reference
2237+0.203808531, +0.363111854, +0.503614664
2238var(:,2)
2239+0.203808531, +0.363111824, +0.503614604
2240var(:,0) ! reference
2241+0.203808531, +0.363111854, +0.503614664
2242
2243
2244dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
2245do isam = 2, nsam
2246 lb(isam) = ub(isam - 1) + 1
2247 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
2248end do
2249lb
2250+1, +7
2251ub
2252+6, +13
2253ndim = getUnifRand(1, minval(ub - lb + 1, 1))
2254call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
2255call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
2256call setResized(meanMerged, ndim)
2257call setResized(varMerged, ndim)
2258sample = getUnifRand(-1., +1., ndim, ub(nsam))
2259sample
2260-0.317219138, +0.750610471, +0.955867529, +0.607682347, -0.387092113, +0.869016647E-1, -0.561905026, -0.417291641, +0.830054045, +0.774396420, +0.161512375, -0.998729229, -0.661590457
2261rweight = getUnifRand(1., 2., size(sample, dim, IK))
2262rweight
2263+1.61111450, +1.54739463, +1.94677329, +1.10728455, +1.93806839, +1.51433229, +1.38230801, +1.75879025, +1.51757860, +1.58400583, +1.11013913, +1.52023149, +1.66686583
2264mean(:,0) = getVar(sample, 2_IK, rweight)
2265mean(:,0) ! reference
2266+0.419538498
2267var(:,0) = getVar(sample, 2_IK, rweight)
2268var(:,0) ! reference
2269+0.419538498
2270do isam = 1, nsam
2271 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2272 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2273end do
2274call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2275meanMerged
2276+0.544136241E-1
2277varMerged
2278+0.419538558
2279call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2280mean(:,2)
2281+0.544136241E-1
2282mean(:,0) ! reference
2283+0.419538498
2284var(:,2)
2285+0.419538558
2286var(:,0) ! reference
2287+0.419538498
2288
2289
2290dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
2291do isam = 2, nsam
2292 lb(isam) = ub(isam - 1) + 1
2293 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
2294end do
2295lb
2296+1, +8
2297ub
2298+7, +14
2299ndim = getUnifRand(1, minval(ub - lb + 1, 1))
2300call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
2301call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
2302call setResized(meanMerged, ndim)
2303call setResized(varMerged, ndim)
2304sample = getUnifRand(-1., +1., ndim, ub(nsam))
2305sample
2306+0.607494235, -0.165949821, -0.142598510, +0.850447774, -0.634366274, +0.582190633, -0.476611614, +0.527684689, +0.620674849, -0.743140936, +0.785668373, +0.472816825, +0.840611696, +0.172432184
2307-0.512434006, +0.531857014, +0.145378947, +0.873920918, -0.923945189, -0.876726866, +0.918671846, +0.292662263, +0.285474539, +0.744919538, +0.961494446, -0.219825983, +0.557058930, +0.610025167
2308+0.940311193, -0.709459543, -0.931045651, +0.172073841E-1, +0.924601316, +0.956797481, +0.440733075, +0.227105618E-2, +0.952031732, +0.495552897, +0.878595710, -0.857586026, +0.308278203, +0.999333501
2309-0.441064358, +0.250727057, +0.149476528, -0.485374928, -0.230774641, +0.338187695, +0.624521255, -0.589175105, +0.765150547, +0.715684891E-2, -0.858852386, +0.498782039, -0.956908226, +0.671118617
2310+0.564697385, -0.778937340E-1, -0.664189339, -0.937845349, +0.781230092, +0.824882269, -0.754821181, +0.312067270, -0.727440000, -0.900135875, -0.413869381, +0.777412653, -0.764509559, -0.908112407
2311rweight = getUnifRand(1., 2., size(sample, dim, IK))
2312rweight
2313+1.01125002, +1.74103308, +1.30329490, +1.06219494, +1.61957049, +1.01800978, +1.19749498, +1.68256664, +1.40686429, +1.29850304, +1.66846085, +1.43326402, +1.39087272, +1.12443686
2314mean(:,0) = getVar(sample, 2_IK, rweight)
2315mean(:,0) ! reference
2316+0.298292607, +0.367862642, +0.483256638, +0.316260308, +0.442686051
2317var(:,0) = getVar(sample, 2_IK, rweight)
2318var(:,0) ! reference
2319+0.298292607, +0.367862642, +0.483256638, +0.316260308, +0.442686051
2320do isam = 1, nsam
2321 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2322 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2323end do
2324call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2325meanMerged
2326+0.220760256, +0.255721927, +0.279341519, -0.428225249E-1, -0.187425360
2327varMerged
2328+0.298292607, +0.367862612, +0.483256698, +0.316260248, +0.442686081
2329call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2330mean(:,2)
2331+0.220760256, +0.255721927, +0.279341519, -0.428225249E-1, -0.187425360
2332mean(:,0) ! reference
2333+0.298292607, +0.367862642, +0.483256638, +0.316260308, +0.442686051
2334var(:,2)
2335+0.298292607, +0.367862612, +0.483256698, +0.316260248, +0.442686081
2336var(:,0) ! reference
2337+0.298292607, +0.367862642, +0.483256638, +0.316260308, +0.442686051
2338
2339
2340dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
2341do isam = 2, nsam
2342 lb(isam) = ub(isam - 1) + 1
2343 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
2344end do
2345lb
2346+1, +6
2347ub
2348+5, +8
2349ndim = getUnifRand(1, minval(ub - lb + 1, 1))
2350call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
2351call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
2352call setResized(meanMerged, ndim)
2353call setResized(varMerged, ndim)
2354sample = getUnifRand(-1., +1., ndim, ub(nsam))
2355sample
2356+0.627146363, +0.120776415, +0.725728273, -0.680622578, +0.977323532, -0.892225385, -0.449848771, -0.372520924
2357rweight = getUnifRand(1., 2., size(sample, dim, IK))
2358rweight
2359+1.78119159, +1.91572928, +1.50962913, +1.72119772, +1.71979928, +1.53738284, +1.65615225, +1.11592269
2360mean(:,0) = getVar(sample, 2_IK, rweight)
2361mean(:,0) ! reference
2362+0.437123924
2363var(:,0) = getVar(sample, 2_IK, rweight)
2364var(:,0) ! reference
2365+0.437123924
2366do isam = 1, nsam
2367 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2368 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2369end do
2370call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2371meanMerged
2372+0.324861407E-1
2373varMerged
2374+0.437123924
2375call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2376mean(:,2)
2377+0.324861407E-1
2378mean(:,0) ! reference
2379+0.437123924
2380var(:,2)
2381+0.437123924
2382var(:,0) ! reference
2383+0.437123924
2384
2385
2386dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
2387do isam = 2, nsam
2388 lb(isam) = ub(isam - 1) + 1
2389 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
2390end do
2391lb
2392+1, +4
2393ub
2394+3, +9
2395ndim = getUnifRand(1, minval(ub - lb + 1, 1))
2396call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
2397call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
2398call setResized(meanMerged, ndim)
2399call setResized(varMerged, ndim)
2400sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
2401sample
2402(-0.316663623, +0.275202751), (+0.987753868E-1, +0.451062679), (+0.970239043, -0.138799310), (-0.446255088, -0.840598822), (-0.713391781, +0.871676683), (+0.293758273, -0.659651756), (+0.648916841, +0.366239548E-1), (-0.103673100, +0.456334114), (+0.315085053, +0.208772779)
2403rweight = getUnifRand(1., 2., size(sample, dim, IK))
2404rweight
2405+1.47349191, +1.83794427, +1.86806631, +1.82155466, +1.84178329, +1.76672399, +1.34201860, +1.67137873, +1.03929400
2406mean(:,0) = getVar(sample, 2_IK, rweight)
2407mean(:,0) ! reference
2408(+0.567260265, +0.00000000)
2409var(:,0) = getVar(sample, 2_IK, rweight)
2410var(:,0) ! reference
2411+0.567260265
2412do isam = 1, nsam
2413 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2414 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2415end do
2416call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2417meanMerged
2418(+0.644279942E-1, +0.622622147E-1)
2419varMerged
2420+0.567260206
2421call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2422mean(:,2)
2423(+0.644279942E-1, +0.622622147E-1)
2424mean(:,0) ! reference
2425(+0.567260265, +0.00000000)
2426var(:,2)
2427+0.567260206
2428var(:,0) ! reference
2429+0.567260265
2430
2431
2432dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
2433do isam = 2, nsam
2434 lb(isam) = ub(isam - 1) + 1
2435 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
2436end do
2437lb
2438+1, +7
2439ub
2440+6, +13
2441ndim = getUnifRand(1, minval(ub - lb + 1, 1))
2442call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
2443call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
2444call setResized(meanMerged, ndim)
2445call setResized(varMerged, ndim)
2446sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
2447sample
2448(-0.854922652, +0.685009837), (+0.209030271, +0.928070664), (+0.771534801, +0.230129004), (-0.671383262, -0.693250537), (-0.135417461, +0.389636636), (+0.943656445, -0.769681454), (+0.603015065, +0.968237638), (+0.454288006, +0.786259413), (-0.376930118, +0.371167421), (-0.191927552, -0.991053581E-1), (+0.346604705, -0.442582965), (+0.151486278, -0.198310494), (-0.981475592, +0.151388168)
2449rweight = getUnifRand(1., 2., size(sample, dim, IK))
2450rweight
2451+1.63629222, +1.91390920, +1.33814025, +1.75103736, +1.16539943, +1.83755445, +1.69644260, +1.25225425, +1.05151772, +1.03055429, +1.97811413, +1.96993375, +1.22121859
2452mean(:,0) = getVar(sample, 2_IK, rweight)
2453mean(:,0) ! reference
2454(+0.713792503, +0.00000000)
2455var(:,0) = getVar(sample, 2_IK, rweight)
2456var(:,0) ! reference
2457+0.713792503
2458do isam = 1, nsam
2459 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2460 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2461end do
2462call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2463meanMerged
2464(+0.613505542E-1, +0.144385949)
2465varMerged
2466+0.713792562
2467call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2468mean(:,2)
2469(+0.613505542E-1, +0.144385949)
2470mean(:,0) ! reference
2471(+0.713792503, +0.00000000)
2472var(:,2)
2473+0.713792562
2474var(:,0) ! reference
2475+0.713792503
2476
2477
2478dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
2479do isam = 2, nsam
2480 lb(isam) = ub(isam - 1) + 1
2481 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
2482end do
2483lb
2484+1, +7
2485ub
2486+6, +13
2487ndim = getUnifRand(1, minval(ub - lb + 1, 1))
2488call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
2489call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
2490call setResized(meanMerged, ndim)
2491call setResized(varMerged, ndim)
2492sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
2493sample
2494(+0.108817220, +0.363823771), (+0.641188622, -0.150366902), (+0.606234312, -0.551155925), (+0.379562616, +0.217301607), (-0.404160023E-1, +0.272214174), (+0.691327929, -0.180970788), (+0.532469511, +0.664100647), (+0.343018413, -0.504473448), (-0.321130157, +0.327320814), (+0.597354293, -0.351878881), (-0.640478134, +0.671858191), (-0.308007360, +0.337965727), (-0.262040377, +0.955906868)
2495rweight = getUnifRand(1., 2., size(sample, dim, IK))
2496rweight
2497+1.00762343, +1.96695685, +1.34550571, +1.49060988, +1.29590786, +1.31156850, +1.27552819, +1.82608521, +1.06028748, +1.82158375, +1.06347847, +1.99231768, +1.57703257
2498mean(:,0) = getVar(sample, 2_IK, rweight)
2499mean(:,0) ! reference
2500(+0.390965313, +0.00000000)
2501var(:,0) = getVar(sample, 2_IK, rweight)
2502var(:,0) ! reference
2503+0.390965313
2504do isam = 1, nsam
2505 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2506 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2507end do
2508call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2509meanMerged
2510(+0.207614183, +0.120615423)
2511varMerged
2512+0.390965343
2513call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2514mean(:,2)
2515(+0.207614183, +0.120615423)
2516mean(:,0) ! reference
2517(+0.390965313, +0.00000000)
2518var(:,2)
2519+0.390965343
2520var(:,0) ! reference
2521+0.390965313
2522
2523
2524dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
2525do isam = 2, nsam
2526 lb(isam) = ub(isam - 1) + 1
2527 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
2528end do
2529lb
2530+1, +5
2531ub
2532+4, +7
2533ndim = getUnifRand(1, minval(ub - lb + 1, 1))
2534call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
2535call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
2536call setResized(meanMerged, ndim)
2537call setResized(varMerged, ndim)
2538sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
2539sample
2540(-0.595860004, +0.718538046), (+0.386664033, -0.167610526), (-0.285278797, -0.493270874), (+0.905725002, +0.717651725), (+0.576187015, +0.205332041), (-0.461650610, -0.323320985), (-0.677595258, -0.356346011)
2541rweight = getUnifRand(1., 2., size(sample, dim, IK))
2542rweight
2543+1.00983119, +1.80715346, +1.04127216, +1.28687489, +1.99026108, +1.93013167, +1.47397387
2544mean(:,0) = getVar(sample, 2_IK, rweight)
2545mean(:,0) ! reference
2546(+0.519343257, +0.00000000)
2547var(:,0) = getVar(sample, 2_IK, rweight)
2548var(:,0) ! reference
2549+0.519343257
2550do isam = 1, nsam
2551 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2552 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2553end do
2554call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2555meanMerged
2556(+0.211113989E-1, +0.872626156E-2)
2557varMerged
2558+0.519343197
2559call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2560mean(:,2)
2561(+0.211113989E-1, +0.872626156E-2)
2562mean(:,0) ! reference
2563(+0.519343257, +0.00000000)
2564var(:,2)
2565+0.519343197
2566var(:,0) ! reference
2567+0.519343257
2568
2569
2570dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
2571do isam = 2, nsam
2572 lb(isam) = ub(isam - 1) + 1
2573 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
2574end do
2575lb
2576+1, +6
2577ub
2578+5, +9
2579ndim = getUnifRand(1, minval(ub - lb + 1, 1))
2580call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
2581call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
2582call setResized(meanMerged, ndim)
2583call setResized(varMerged, ndim)
2584sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
2585sample
2586(-0.399465799, +0.805737138), (-0.670384645, +0.450753093), (+0.760041356, +0.798533678), (-0.895020485, +0.158817410), (+0.334000468, +0.477781177), (+0.321211576, +0.459164500), (-0.590761185, +0.600361228), (-0.573776960E-1, -0.502976775), (-0.265902162, +0.477034807)
2587(+0.884325385, +0.758517981), (+0.337760925, -0.789697170E-1), (+0.285779357, +0.969059587), (+0.626209021, +0.604893923), (+0.713520408, +0.111462951), (-0.411785126, -0.295901895), (-0.481327534, +0.709588408), (+0.367950320, +0.710855365), (-0.143604994, -0.279899716)
2588(-0.755078435, +0.385718226), (-0.921173334, +0.469400287), (-0.476433277, -0.250603199), (+0.299037457, +0.277624130), (-0.696409106, -0.928103805), (-0.433218718, -0.874181867), (+0.704674482, -0.387940884), (-0.146068096, +0.740733266), (-0.221473098, +0.855007291)
2589rweight = getUnifRand(1., 2., size(sample, dim, IK))
2590rweight
2591+1.69291270, +1.32933092, +1.86057067, +1.50831687, +1.02239108, +1.47969985, +1.08773375, +1.92927599, +1.13953114
2592mean(:,0) = getVar(sample, 2_IK, rweight)
2593mean(:,0) ! reference
2594(+0.455939174, +0.00000000), (+0.410605192, +0.00000000), (+0.580197811, +0.00000000)
2595var(:,0) = getVar(sample, 2_IK, rweight)
2596var(:,0) ! reference
2597+0.455939174, +0.410605192, +0.580197811
2598do isam = 1, nsam
2599 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2600 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2601end do
2602call setVarMeanMerged(varMerged, meanMerged, var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2603meanMerged
2604(-0.133550614, +0.389483750), (+0.273198336, +0.413412929), (-0.311035544, +0.742123723E-1)
2605varMerged
2606+0.455939144, +0.410605162, +0.580197752
2607call setVarMeanMerged(var(:,2), mean(:,2), var(:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2608mean(:,2)
2609(-0.133550614, +0.389483750), (+0.273198336, +0.413412929), (-0.311035544, +0.742123723E-1)
2610mean(:,0) ! reference
2611(+0.455939174, +0.00000000), (+0.410605192, +0.00000000), (+0.580197811, +0.00000000)
2612var(:,2)
2613+0.455939144, +0.410605162, +0.580197752
2614var(:,0) ! reference
2615+0.455939174, +0.410605192, +0.580197811
2616
2617
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: