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

Return the (weighted) merged variance 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 of a complex or real sample resulting from the merger of two separate (weighted) samples \(A\) and \(B\).

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

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 varA, 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.)
[in,out]varB: The input or input/output object of the same type and kind and rank and shape as the input argument varA, 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]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 meanDiff, containing the biased variance of the first sample that must be merged with the second sample.
[in]meanDiff: The input object 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 difference of mean of the two samples meanDiff = meanA - meanB.
The subtraction order is immaterial.
[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 setVarMerged( varB, varA, meanDiff, fracA)
call setVarMerged(varMerged, varB, varA, meanDiff, fracA)
! ndim-dimensional sample
call setVarMerged( varB(1:ndim), varA(1:ndim), meanDiff(1:ndim), fracA)
call setVarMerged(varMerged(1:ndim), varB(1:ndim), varA(1:ndim), meanDiff(1:ndim), fracA)
Return the (weighted) merged variance of a complex or real sample resulting from the merger of two se...
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(meanDiff) 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


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 of a univariate sample.")
26 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
27 call disp%skip()
28
29 block
30 real(TKG) :: mean(1:nsam)
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("var(0) = getVar(sample)")
54 var(0) = getVar(sample)
55 call disp%show("var(0) ! reference")
56 call disp%show( var(0) )
57 call disp%show("do isam = 1, nsam")
58 call disp%show(" var(isam) = getVar(sample(lb(isam):ub(isam)))")
59 call disp%show(" mean(isam) = getMean(sample(lb(isam):ub(isam)))")
60 call disp%show("end do")
61 do isam = 1, nsam
62 var(isam) = getVar(sample(lb(isam):ub(isam)))
63 mean(isam) = getMean(sample(lb(isam):ub(isam)))
64 end do
65 call disp%show("call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), ub(1) / real(ub(2), TKG))")
66 call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), ub(1) / real(ub(2), TKG))
67 call disp%show("varMerged")
68 call disp%show( varMerged )
69 call disp%show("call setVarMerged(var(2), var(1), mean(1) - mean(2), ub(1) / real(ub(2), TKG))")
70 call setVarMerged(var(2), var(1), mean(1) - mean(2), ub(1) / real(ub(2), TKG))
71 call disp%show("var(2)")
72 call disp%show( var(2) )
73 call disp%show("var(0) ! reference")
74 call disp%show( var(0) )
75 call disp%skip()
76 end do
77 end block
78
79 block
80 complex(TKG) :: mean(1:nsam)
81 complex(TKG), allocatable :: sample(:)
82 real(TKG) :: var(0:nsam), varMerged
83 do itry = 1, ntry
84 call disp%skip()
85 call disp%show("lb(1) = 1; ub(1) = getUnifRand(2, 7)")
86 lb(1) = 1; ub(1) = getUnifRand(2, 7)
87 call disp%show("do isam = 2, nsam")
88 call disp%show(" lb(isam) = ub(isam - 1) + 1")
89 call disp%show(" ub(isam) = ub(isam - 1) + getUnifRand(2, 7)")
90 call disp%show("end do")
91 do isam = 2, nsam
92 lb(isam) = ub(isam - 1) + 1
93 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
94 end do
95 call disp%show("lb")
96 call disp%show( lb )
97 call disp%show("ub")
98 call disp%show( ub )
99 call disp%show("sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)")
100 sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
101 call disp%show("sample")
102 call disp%show( sample )
103 call disp%show("var(0) = getVar(sample)")
104 var(0) = getVar(sample)
105 call disp%show("var(0) ! reference")
106 call disp%show( var(0) )
107 call disp%show("do isam = 1, nsam")
108 call disp%show(" var(isam) = getVar(sample(lb(isam):ub(isam)))")
109 call disp%show(" mean(isam) = getMean(sample(lb(isam):ub(isam)))")
110 call disp%show("end do")
111 do isam = 1, nsam
112 var(isam) = getVar(sample(lb(isam):ub(isam)))
113 mean(isam) = getMean(sample(lb(isam):ub(isam)))
114 end do
115 call disp%show("call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), ub(1) / real(ub(2), TKG))")
116 call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), ub(1) / real(ub(2), TKG))
117 call disp%show("varMerged")
118 call disp%show( varMerged )
119 call disp%show("call setVarMerged(var(2), var(1), mean(1) - mean(2), ub(1) / real(ub(2), TKG))")
120 call setVarMerged(var(2), var(1), mean(1) - mean(2), ub(1) / real(ub(2), TKG))
121 call disp%show("var(2)")
122 call disp%show( var(2) )
123 call disp%show("var(0) ! reference")
124 call disp%show( var(0) )
125 call disp%skip()
126 end do
127 end block
128
129 call disp%skip()
130 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
131 call disp%show("!Compute the biased merged variance of a frequency weighted univariate sample.")
132 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
133 call disp%skip()
134
135 block
136 real(TKG) :: mean(1:nsam)
137 real(TKG), allocatable :: sample(:)
138 real(TKG) :: var(0:nsam), varMerged
139 do itry = 1, ntry
140 call disp%skip()
141 call disp%show("lb(1) = 1; ub(1) = getUnifRand(2, 7)")
142 lb(1) = 1; ub(1) = getUnifRand(2, 7)
143 call disp%show("do isam = 2, nsam")
144 call disp%show(" lb(isam) = ub(isam - 1) + 1")
145 call disp%show(" ub(isam) = ub(isam - 1) + getUnifRand(2, 7)")
146 call disp%show("end do")
147 do isam = 2, nsam
148 lb(isam) = ub(isam - 1) + 1
149 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
150 end do
151 call disp%show("lb")
152 call disp%show( lb )
153 call disp%show("ub")
154 call disp%show( ub )
155 call disp%show("sample = getUnifRand(0., 1., ub(nsam))")
156 sample = getUnifRand(0., 1., ub(nsam))
157 call disp%show("sample")
158 call disp%show( sample )
159 call disp%show("iweight = getUnifRand(1, 10, size(sample, 1, IK))")
160 iweight = getUnifRand(1, 10, size(sample, 1, IK))
161 call disp%show("iweight")
162 call disp%show( iweight )
163 call disp%show("var(0) = getVar(sample, iweight)")
164 var(0) = getVar(sample, iweight)
165 call disp%show("var(0) ! reference")
166 call disp%show( var(0) )
167 call disp%show("do isam = 1, nsam")
168 call disp%show(" var(isam) = getVar(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))")
169 call disp%show(" mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))")
170 call disp%show("end do")
171 do isam = 1, nsam
172 var(isam) = getVar(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
173 mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
174 end do
175 call disp%show("call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))")
176 call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
177 call disp%show("varMerged")
178 call disp%show( varMerged )
179 call disp%show("call setVarMerged(var(2), var(1), mean(1) - mean(2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))")
180 call setVarMerged(var(2), var(1), mean(1) - mean(2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
181 call disp%show("var(2)")
182 call disp%show( var(2) )
183 call disp%show("var(0) ! reference")
184 call disp%show( var(0) )
185 call disp%skip()
186 end do
187 end block
188
189 block
190 complex(TKG) :: mean(1:nsam)
191 complex(TKG), allocatable :: sample(:)
192 real(TKG) :: var(0:nsam), varMerged
193 do itry = 1, ntry
194 call disp%skip()
195 call disp%show("lb(1) = 1; ub(1) = getUnifRand(2, 7)")
196 lb(1) = 1; ub(1) = getUnifRand(2, 7)
197 call disp%show("do isam = 2, nsam")
198 call disp%show(" lb(isam) = ub(isam - 1) + 1")
199 call disp%show(" ub(isam) = ub(isam - 1) + getUnifRand(2, 7)")
200 call disp%show("end do")
201 do isam = 2, nsam
202 lb(isam) = ub(isam - 1) + 1
203 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
204 end do
205 call disp%show("lb")
206 call disp%show( lb )
207 call disp%show("ub")
208 call disp%show( ub )
209 call disp%show("sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)")
210 sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
211 call disp%show("sample")
212 call disp%show( sample )
213 call disp%show("iweight = getUnifRand(1, 10, size(sample, 1, IK))")
214 iweight = getUnifRand(1, 10, size(sample, 1, IK))
215 call disp%show("iweight")
216 call disp%show( iweight )
217 call disp%show("var(0) = getVar(sample, iweight)")
218 var(0) = getVar(sample, iweight)
219 call disp%show("var(0) ! reference")
220 call disp%show( var(0) )
221 call disp%show("do isam = 1, nsam")
222 call disp%show(" var(isam) = getVar(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))")
223 call disp%show(" mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))")
224 call disp%show("end do")
225 do isam = 1, nsam
226 var(isam) = getVar(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
227 mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
228 end do
229 call disp%show("call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))")
230 call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
231 call disp%show("varMerged")
232 call disp%show( varMerged )
233 call disp%show("call setVarMerged(var(2), var(1), mean(1) - mean(2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))")
234 call setVarMerged(var(2), var(1), mean(1) - mean(2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
235 call disp%show("var(2)")
236 call disp%show( var(2) )
237 call disp%show("var(0) ! reference")
238 call disp%show( var(0) )
239 call disp%skip()
240 end do
241 end block
242
243 call disp%skip()
244 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
245 call disp%show("!Compute the biased merged variance of a reliability weighted univariate sample.")
246 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
247 call disp%skip()
248
249 block
250 real(TKG) :: mean(1:nsam)
251 real(TKG), allocatable :: sample(:)
252 real(TKG), allocatable :: rweight(:)
253 real(TKG) :: var(0:nsam), varMerged
254 do itry = 1, ntry
255 call disp%skip()
256 call disp%show("lb(1) = 1; ub(1) = getUnifRand(2, 7)")
257 lb(1) = 1; ub(1) = getUnifRand(2, 7)
258 call disp%show("do isam = 2, nsam")
259 call disp%show(" lb(isam) = ub(isam - 1) + 1")
260 call disp%show(" ub(isam) = ub(isam - 1) + getUnifRand(2, 7)")
261 call disp%show("end do")
262 do isam = 2, nsam
263 lb(isam) = ub(isam - 1) + 1
264 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
265 end do
266 call disp%show("lb")
267 call disp%show( lb )
268 call disp%show("ub")
269 call disp%show( ub )
270 call disp%show("sample = getUnifRand(0., 1., ub(nsam))")
271 sample = getUnifRand(0., 1., ub(nsam))
272 call disp%show("sample")
273 call disp%show( sample )
274 call disp%show("rweight = getUnifRand(1., 2., size(sample, 1, IK))")
275 rweight = getUnifRand(1., 2., size(sample, 1, IK))
276 call disp%show("rweight")
277 call disp%show( rweight )
278 call disp%show("var(0) = getVar(sample, rweight)")
279 var(0) = getVar(sample, rweight)
280 call disp%show("var(0) ! reference")
281 call disp%show( var(0) )
282 call disp%show("do isam = 1, nsam")
283 call disp%show(" var(isam) = getVar(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))")
284 call disp%show(" mean(isam) = getMean(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))")
285 call disp%show("end do")
286 do isam = 1, nsam
287 var(isam) = getVar(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
288 mean(isam) = getMean(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
289 end do
290 call disp%show("call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))")
291 call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
292 call disp%show("varMerged")
293 call disp%show( varMerged )
294 call disp%show("call setVarMerged(var(2), var(1), mean(1) - mean(2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))")
295 call setVarMerged(var(2), var(1), mean(1) - mean(2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
296 call disp%show("var(2)")
297 call disp%show( var(2) )
298 call disp%show("var(0) ! reference")
299 call disp%show( var(0) )
300 call disp%skip()
301 end do
302 end block
303
304 block
305 complex(TKG) :: mean(1:nsam)
306 complex(TKG), allocatable :: sample(:)
307 real(TKG), allocatable :: rweight(:)
308 real(TKG) :: var(0:nsam), varMerged
309 do itry = 1, ntry
310 call disp%skip()
311 call disp%show("lb(1) = 1; ub(1) = getUnifRand(2, 7)")
312 lb(1) = 1; ub(1) = getUnifRand(2, 7)
313 call disp%show("do isam = 2, nsam")
314 call disp%show(" lb(isam) = ub(isam - 1) + 1")
315 call disp%show(" ub(isam) = ub(isam - 1) + getUnifRand(2, 7)")
316 call disp%show("end do")
317 do isam = 2, nsam
318 lb(isam) = ub(isam - 1) + 1
319 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
320 end do
321 call disp%show("lb")
322 call disp%show( lb )
323 call disp%show("ub")
324 call disp%show( ub )
325 call disp%show("sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)")
326 sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
327 call disp%show("sample")
328 call disp%show( sample )
329 call disp%show("rweight = getUnifRand(1., 2., size(sample, 1, IK))")
330 rweight = getUnifRand(1., 2., size(sample, 1, IK))
331 call disp%show("rweight")
332 call disp%show( rweight )
333 call disp%show("var(0) = getVar(sample, rweight)")
334 var(0) = getVar(sample, rweight)
335 call disp%show("var(0) ! reference")
336 call disp%show( var(0) )
337 call disp%show("do isam = 1, nsam")
338 call disp%show(" var(isam) = getVar(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))")
339 call disp%show(" mean(isam) = getMean(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))")
340 call disp%show("end do")
341 do isam = 1, nsam
342 var(isam) = getVar(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
343 mean(isam) = getMean(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
344 end do
345 call disp%show("call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))")
346 call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
347 call disp%show("varMerged")
348 call disp%show( varMerged )
349 call disp%show("call setVarMerged(var(2), var(1), mean(1) - mean(2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))")
350 call setVarMerged(var(2), var(1), mean(1) - mean(2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
351 call disp%show("var(2)")
352 call disp%show( var(2) )
353 call disp%show("var(0) ! reference")
354 call disp%show( var(0) )
355 call disp%skip()
356 end do
357 end block
358
359 call disp%skip()
360 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
361 call disp%show("!Compute the biased merged variance of a multivariate sample.")
362 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
363 call disp%skip()
364
365 block
366 real(TKG), allocatable :: mean(:,:)
367 real(TKG), allocatable :: sample(:,:)
368 real(TKG), allocatable :: var(:,:), varMerged(:)
369 do itry = 1, ntry
370 call disp%skip()
371 call disp%show("dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)")
372 dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
373 call disp%show("do isam = 2, nsam")
374 call disp%show(" lb(isam) = ub(isam - 1) + 1")
375 call disp%show(" ub(isam) = ub(isam - 1) + getUnifRand(2, 7)")
376 call disp%show("end do")
377 do isam = 2, nsam
378 lb(isam) = ub(isam - 1) + 1
379 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
380 end do
381 call disp%show("lb")
382 call disp%show( lb )
383 call disp%show("ub")
384 call disp%show( ub )
385 call disp%show("ndim = getUnifRand(1, minval(ub - lb + 1, 1))")
386 ndim = getUnifRand(1, minval(ub - lb + 1, 1))
387 call disp%show("call setRebound(var, [1_IK, 0_IK], [ndim, nsam])")
388 call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
389 call disp%show("call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])")
390 call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
391 call disp%show("call setResized(varMerged, ndim)")
392 call setResized(varMerged, ndim)
393 call disp%show("sample = getUnifRand(-1., +1., ndim, ub(nsam))")
394 sample = getUnifRand(-1., +1., ndim, ub(nsam))
395 call disp%show("sample")
396 call disp%show( sample )
397 call disp%show("var(:,0) = getVar(sample, dim)")
398 var(:,0) = getVar(sample, dim)
399 call disp%show("var(:,0) ! reference")
400 call disp%show( var(:,0) )
401 call disp%show("do isam = 1, nsam")
402 call disp%show(" var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)")
403 call disp%show(" mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)")
404 call disp%show("end do")
405 do isam = 1, nsam
406 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
407 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
408 end do
409 call disp%show("call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))")
410 call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
411 call disp%show("varMerged")
412 call disp%show( varMerged )
413 call disp%show("call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))")
414 call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
415 call disp%show("var(:,2)")
416 call disp%show( var(:,2) )
417 call disp%show("var(:,0) ! reference")
418 call disp%show( var(:,0) )
419 call disp%skip()
420 end do
421 end block
422
423 block
424 complex(TKG), allocatable :: mean(:,:)
425 complex(TKG), allocatable :: sample(:,:)
426 real(TKG), allocatable :: var(:,:), varMerged(:)
427 do itry = 1, ntry
428 call disp%skip()
429 call disp%show("dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)")
430 dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
431 call disp%show("do isam = 2, nsam")
432 call disp%show(" lb(isam) = ub(isam - 1) + 1")
433 call disp%show(" ub(isam) = ub(isam - 1) + getUnifRand(2, 7)")
434 call disp%show("end do")
435 do isam = 2, nsam
436 lb(isam) = ub(isam - 1) + 1
437 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
438 end do
439 call disp%show("lb")
440 call disp%show( lb )
441 call disp%show("ub")
442 call disp%show( ub )
443 call disp%show("ndim = getUnifRand(1, minval(ub - lb + 1, 1))")
444 ndim = getUnifRand(1, minval(ub - lb + 1, 1))
445 call disp%show("call setRebound(var, [1_IK, 0_IK], [ndim, nsam])")
446 call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
447 call disp%show("call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])")
448 call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
449 call disp%show("call setResized(varMerged, ndim)")
450 call setResized(varMerged, ndim)
451 call disp%show("sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), -getUnifRand(-1., +1., ndim, ub(nsam)), TKG)")
452 sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), -getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
453 call disp%show("sample")
454 call disp%show( sample )
455 call disp%show("var(:,0) = getVar(sample, dim)")
456 var(:,0) = getVar(sample, dim)
457 call disp%show("var(:,0) ! reference")
458 call disp%show( var(:,0) )
459 call disp%show("do isam = 1, nsam")
460 call disp%show(" var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)")
461 call disp%show(" mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)")
462 call disp%show("end do")
463 do isam = 1, nsam
464 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
465 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
466 end do
467 call disp%show("call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))")
468 call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
469 call disp%show("varMerged")
470 call disp%show( varMerged )
471 call disp%show("call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))")
472 call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
473 call disp%show("var(:,2)")
474 call disp%show( var(:,2) )
475 call disp%show("var(:,0) ! reference")
476 call disp%show( var(:,0) )
477 call disp%skip()
478 end do
479 end block
480
481 call disp%skip()
482 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
483 call disp%show("!Compute the biased merged variance of a frequency weighted multivariate sample.")
484 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
485 call disp%skip()
486
487 block
488 real(TKG), allocatable :: mean(:,:)
489 real(TKG), allocatable :: sample(:,:)
490 real(TKG), allocatable :: var(:,:), varMerged(:)
491 do itry = 1, ntry
492 call disp%skip()
493 call disp%show("dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)")
494 dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
495 call disp%show("do isam = 2, nsam")
496 call disp%show(" lb(isam) = ub(isam - 1) + 1")
497 call disp%show(" ub(isam) = ub(isam - 1) + getUnifRand(2, 7)")
498 call disp%show("end do")
499 do isam = 2, nsam
500 lb(isam) = ub(isam - 1) + 1
501 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
502 end do
503 call disp%show("lb")
504 call disp%show( lb )
505 call disp%show("ub")
506 call disp%show( ub )
507 call disp%show("ndim = getUnifRand(1, minval(ub - lb + 1, 1))")
508 ndim = getUnifRand(1, minval(ub - lb + 1, 1))
509 call disp%show("call setRebound(var, [1_IK, 0_IK], [ndim, nsam])")
510 call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
511 call disp%show("call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])")
512 call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
513 call disp%show("call setResized(varMerged, ndim)")
514 call setResized(varMerged, ndim)
515 call disp%show("sample = getUnifRand(-1., +1., ndim, ub(nsam))")
516 sample = getUnifRand(-1., +1., ndim, ub(nsam))
517 call disp%show("sample")
518 call disp%show( sample )
519 call disp%show("iweight = getUnifRand(1, 10, size(sample, dim, IK))")
520 iweight = getUnifRand(1, 10, size(sample, dim, IK))
521 call disp%show("iweight")
522 call disp%show( iweight )
523 call disp%show("var(:,0) = getVar(sample, 2_IK, iweight)")
524 var(:,0) = getVar(sample, 2_IK, iweight)
525 call disp%show("var(:,0) ! reference")
526 call disp%show( var(:,0) )
527 call disp%show("do isam = 1, nsam")
528 call disp%show(" var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))")
529 call disp%show(" mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))")
530 call disp%show("end do")
531 do isam = 1, nsam
532 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
533 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
534 end do
535 call disp%show("call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))")
536 call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
537 call disp%show("varMerged")
538 call disp%show( varMerged )
539 call disp%show("call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))")
540 call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
541 call disp%show("var(:,2)")
542 call disp%show( var(:,2) )
543 call disp%show("var(:,0) ! reference")
544 call disp%show( var(:,0) )
545 call disp%skip()
546 end do
547 end block
548
549 block
550 complex(TKG), allocatable :: mean(:,:)
551 complex(TKG), allocatable :: sample(:,:)
552 real(TKG), allocatable :: var(:,:), varMerged(:)
553 do itry = 1, ntry
554 call disp%skip()
555 call disp%show("dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)")
556 dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
557 call disp%show("do isam = 2, nsam")
558 call disp%show(" lb(isam) = ub(isam - 1) + 1")
559 call disp%show(" ub(isam) = ub(isam - 1) + getUnifRand(2, 7)")
560 call disp%show("end do")
561 do isam = 2, nsam
562 lb(isam) = ub(isam - 1) + 1
563 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
564 end do
565 call disp%show("lb")
566 call disp%show( lb )
567 call disp%show("ub")
568 call disp%show( ub )
569 call disp%show("ndim = getUnifRand(1, minval(ub - lb + 1, 1))")
570 ndim = getUnifRand(1, minval(ub - lb + 1, 1))
571 call disp%show("call setRebound(var, [1_IK, 0_IK], [ndim, nsam])")
572 call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
573 call disp%show("call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])")
574 call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
575 call disp%show("call setResized(varMerged, ndim)")
576 call setResized(varMerged, ndim)
577 call disp%show("sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)")
578 sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
579 call disp%show("sample")
580 call disp%show( sample )
581 call disp%show("iweight = getUnifRand(1, 10, size(sample, dim, IK))")
582 iweight = getUnifRand(1, 10, size(sample, dim, IK))
583 call disp%show("iweight")
584 call disp%show( iweight )
585 call disp%show("var(:,0) = getVar(sample, 2_IK, iweight)")
586 var(:,0) = getVar(sample, 2_IK, iweight)
587 call disp%show("var(:,0) ! reference")
588 call disp%show( var(:,0) )
589 call disp%show("do isam = 1, nsam")
590 call disp%show(" var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))")
591 call disp%show(" mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))")
592 call disp%show("end do")
593 do isam = 1, nsam
594 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
595 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
596 end do
597 call disp%show("call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))")
598 call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
599 call disp%show("varMerged")
600 call disp%show( varMerged )
601 call disp%show("call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))")
602 call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
603 call disp%show("var(:,2)")
604 call disp%show( var(:,2) )
605 call disp%show("var(:,0) ! reference")
606 call disp%show( var(:,0) )
607 call disp%skip()
608 end do
609 end block
610
611 call disp%skip()
612 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
613 call disp%show("!Compute the biased merged variance of a reliability weighted multivariate sample.")
614 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
615 call disp%skip()
616
617 block
618 real(TKG), allocatable :: mean(:,:)
619 real(TKG), allocatable :: sample(:,:)
620 real(TKG), allocatable :: var(:,:), varMerged(:)
621 real(TKG), allocatable :: rweight(:)
622 do itry = 1, ntry
623 call disp%skip()
624 call disp%show("dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)")
625 dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
626 call disp%show("do isam = 2, nsam")
627 call disp%show(" lb(isam) = ub(isam - 1) + 1")
628 call disp%show(" ub(isam) = ub(isam - 1) + getUnifRand(2, 7)")
629 call disp%show("end do")
630 do isam = 2, nsam
631 lb(isam) = ub(isam - 1) + 1
632 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
633 end do
634 call disp%show("lb")
635 call disp%show( lb )
636 call disp%show("ub")
637 call disp%show( ub )
638 call disp%show("ndim = getUnifRand(1, minval(ub - lb + 1, 1))")
639 ndim = getUnifRand(1, minval(ub - lb + 1, 1))
640 call disp%show("call setRebound(var, [1_IK, 0_IK], [ndim, nsam])")
641 call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
642 call disp%show("call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])")
643 call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
644 call disp%show("call setResized(varMerged, ndim)")
645 call setResized(varMerged, ndim)
646 call disp%show("sample = getUnifRand(-1., +1., ndim, ub(nsam))")
647 sample = getUnifRand(-1., +1., ndim, ub(nsam))
648 call disp%show("sample")
649 call disp%show( sample )
650 call disp%show("rweight = getUnifRand(1., 2., size(sample, dim, IK))")
651 rweight = getUnifRand(1., 2., size(sample, dim, IK))
652 call disp%show("rweight")
653 call disp%show( rweight )
654 call disp%show("var(:,0) = getVar(sample, 2_IK, rweight)")
655 var(:,0) = getVar(sample, 2_IK, rweight)
656 call disp%show("var(:,0) ! reference")
657 call disp%show( var(:,0) )
658 call disp%show("do isam = 1, nsam")
659 call disp%show(" var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))")
660 call disp%show(" mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))")
661 call disp%show("end do")
662 do isam = 1, nsam
663 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
664 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
665 end do
666 call disp%show("call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))")
667 call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
668 call disp%show("varMerged")
669 call disp%show( varMerged )
670 call disp%show("call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))")
671 call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
672 call disp%show("var(:,2)")
673 call disp%show( var(:,2) )
674 call disp%show("var(:,0) ! reference")
675 call disp%show( var(:,0) )
676 call disp%skip()
677 end do
678 end block
679
680 block
681 complex(TKG), allocatable :: mean(:,:)
682 complex(TKG), allocatable :: sample(:,:)
683 real(TKG), allocatable :: var(:,:), varMerged(:)
684 real(TKG), allocatable :: rweight(:)
685 do itry = 1, ntry
686 call disp%skip()
687 call disp%show("dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)")
688 dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
689 call disp%show("do isam = 2, nsam")
690 call disp%show(" lb(isam) = ub(isam - 1) + 1")
691 call disp%show(" ub(isam) = ub(isam - 1) + getUnifRand(2, 7)")
692 call disp%show("end do")
693 do isam = 2, nsam
694 lb(isam) = ub(isam - 1) + 1
695 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
696 end do
697 call disp%show("lb")
698 call disp%show( lb )
699 call disp%show("ub")
700 call disp%show( ub )
701 call disp%show("ndim = getUnifRand(1, minval(ub - lb + 1, 1))")
702 ndim = getUnifRand(1, minval(ub - lb + 1, 1))
703 call disp%show("call setRebound(var, [1_IK, 0_IK], [ndim, nsam])")
704 call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
705 call disp%show("call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])")
706 call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
707 call disp%show("call setResized(varMerged, ndim)")
708 call setResized(varMerged, ndim)
709 call disp%show("sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)")
710 sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
711 call disp%show("sample")
712 call disp%show( sample )
713 call disp%show("rweight = getUnifRand(1., 2., size(sample, dim, IK))")
714 rweight = getUnifRand(1., 2., size(sample, dim, IK))
715 call disp%show("rweight")
716 call disp%show( rweight )
717 call disp%show("var(:,0) = getVar(sample, 2_IK, rweight)")
718 var(:,0) = getVar(sample, 2_IK, rweight)
719 call disp%show("var(:,0) ! reference")
720 call disp%show( var(:,0) )
721 call disp%show("do isam = 1, nsam")
722 call disp%show(" var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))")
723 call disp%show(" mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))")
724 call disp%show("end do")
725 do isam = 1, nsam
726 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
727 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
728 end do
729 call disp%show("call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))")
730 call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
731 call disp%show("varMerged")
732 call disp%show( varMerged )
733 call disp%show("call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))")
734 call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
735 call disp%show("var(:,2)")
736 call disp%show( var(:,2) )
737 call disp%show("var(:,0) ! reference")
738 call disp%show( var(:,0) )
739 call disp%skip()
740 end do
741 end block
742
743end 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 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, +10
16sample = getUnifRand(0., 1., ub(nsam))
17sample
18+0.164151967, +0.699272633, +0.862817764, +0.376528263, +0.534596741, +0.294695497E-1, +0.889389098, +0.715736091, +0.475658476, +0.611594260
19var(0) = getVar(sample)
20var(0) ! reference
21+0.720289573E-1
22do isam = 1, nsam
23 var(isam) = getVar(sample(lb(isam):ub(isam)))
24 mean(isam) = getMean(sample(lb(isam):ub(isam)))
25end do
26call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), ub(1) / real(ub(2), TKG))
27varMerged
28+0.720289499E-1
29call setVarMerged(var(2), var(1), mean(1) - mean(2), ub(1) / real(ub(2), TKG))
30var(2)
31+0.720289499E-1
32var(0) ! reference
33+0.720289573E-1
34
35
36lb(1) = 1; ub(1) = getUnifRand(2, 7)
37do isam = 2, nsam
38 lb(isam) = ub(isam - 1) + 1
39 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
40end do
41lb
42+1, +3
43ub
44+2, +6
45sample = getUnifRand(0., 1., ub(nsam))
46sample
47+0.434075296, +0.330543101, +0.773452222, +0.254093409, +0.986161292, +0.615804732
48var(0) = getVar(sample)
49var(0) ! reference
50+0.653636083E-1
51do isam = 1, nsam
52 var(isam) = getVar(sample(lb(isam):ub(isam)))
53 mean(isam) = getMean(sample(lb(isam):ub(isam)))
54end do
55call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), ub(1) / real(ub(2), TKG))
56varMerged
57+0.653636009E-1
58call setVarMerged(var(2), var(1), mean(1) - mean(2), ub(1) / real(ub(2), TKG))
59var(2)
60+0.653636009E-1
61var(0) ! reference
62+0.653636083E-1
63
64
65lb(1) = 1; ub(1) = getUnifRand(2, 7)
66do isam = 2, nsam
67 lb(isam) = ub(isam - 1) + 1
68 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
69end do
70lb
71+1, +5
72ub
73+4, +8
74sample = getUnifRand(0., 1., ub(nsam))
75sample
76+0.183619320, +0.253177941, +0.813970685, +0.469569981, +0.426874161E-1, +0.665751100E-1, +0.445553541, +0.119808137
77var(0) = getVar(sample)
78var(0) ! reference
79+0.603756644E-1
80do isam = 1, nsam
81 var(isam) = getVar(sample(lb(isam):ub(isam)))
82 mean(isam) = getMean(sample(lb(isam):ub(isam)))
83end do
84call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), ub(1) / real(ub(2), TKG))
85varMerged
86+0.603756644E-1
87call setVarMerged(var(2), var(1), mean(1) - mean(2), ub(1) / real(ub(2), TKG))
88var(2)
89+0.603756644E-1
90var(0) ! reference
91+0.603756644E-1
92
93
94lb(1) = 1; ub(1) = getUnifRand(2, 7)
95do isam = 2, nsam
96 lb(isam) = ub(isam - 1) + 1
97 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
98end do
99lb
100+1, +5
101ub
102+4, +7
103sample = getUnifRand(0., 1., ub(nsam))
104sample
105+0.681556582, +0.781108320, +0.188434124E-1, +0.719868779, +0.230368555, +0.232569277, +0.380671501
106var(0) = getVar(sample)
107var(0) ! reference
108+0.743887797E-1
109do isam = 1, nsam
110 var(isam) = getVar(sample(lb(isam):ub(isam)))
111 mean(isam) = getMean(sample(lb(isam):ub(isam)))
112end do
113call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), ub(1) / real(ub(2), TKG))
114varMerged
115+0.743887722E-1
116call setVarMerged(var(2), var(1), mean(1) - mean(2), ub(1) / real(ub(2), TKG))
117var(2)
118+0.743887722E-1
119var(0) ! reference
120+0.743887797E-1
121
122
123lb(1) = 1; ub(1) = getUnifRand(2, 7)
124do isam = 2, nsam
125 lb(isam) = ub(isam - 1) + 1
126 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
127end do
128lb
129+1, +8
130ub
131+7, +13
132sample = getUnifRand(0., 1., ub(nsam))
133sample
134+0.717068911, +0.940654099, +0.183019102, +0.757230997, +0.475270569, +0.127272129, +0.813057840, +0.927254856, +0.639357269, +0.753042042, +0.326402128, +0.532595575, +0.513611674
135var(0) = getVar(sample)
136var(0) ! reference
137+0.639241785E-1
138do isam = 1, nsam
139 var(isam) = getVar(sample(lb(isam):ub(isam)))
140 mean(isam) = getMean(sample(lb(isam):ub(isam)))
141end do
142call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), ub(1) / real(ub(2), TKG))
143varMerged
144+0.639241859E-1
145call setVarMerged(var(2), var(1), mean(1) - mean(2), ub(1) / real(ub(2), TKG))
146var(2)
147+0.639241859E-1
148var(0) ! reference
149+0.639241785E-1
150
151
152lb(1) = 1; ub(1) = getUnifRand(2, 7)
153do isam = 2, nsam
154 lb(isam) = ub(isam - 1) + 1
155 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
156end do
157lb
158+1, +6
159ub
160+5, +7
161sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
162sample
163(+0.879619598, -0.386423469E-1), (+0.315917373, -0.232920110), (+0.723547399, -0.756328940), (+0.802050054, -0.297957420), (+0.857516170, -0.642530799), (+0.641659975, -0.441883683), (+0.117792904, -0.161728621)
164var(0) = getVar(sample)
165var(0) ! reference
166+0.131232485
167do isam = 1, nsam
168 var(isam) = getVar(sample(lb(isam):ub(isam)))
169 mean(isam) = getMean(sample(lb(isam):ub(isam)))
170end do
171call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), ub(1) / real(ub(2), TKG))
172varMerged
173+0.131232470
174call setVarMerged(var(2), var(1), mean(1) - mean(2), ub(1) / real(ub(2), TKG))
175var(2)
176+0.131232470
177var(0) ! reference
178+0.131232485
179
180
181lb(1) = 1; ub(1) = getUnifRand(2, 7)
182do isam = 2, nsam
183 lb(isam) = ub(isam - 1) + 1
184 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
185end do
186lb
187+1, +8
188ub
189+7, +13
190sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
191sample
192(+0.624335170, -0.132989883E-1), (+0.987618148, -0.566642046), (+0.285093844, -0.234333992), (+0.233627439, -0.244343936), (+0.474358678, -0.670908153), (+0.639385581, -0.400373220), (+0.645031869, -0.478297472E-1), (+0.774315715, -0.427086115), (+0.609079778, -0.974845648), (+0.878086686E-1, -0.735144198), (+0.911273599, -0.124685645), (+0.444563866, -0.395017862E-2), (+0.581902266, -0.701951981E-2)
193var(0) = getVar(sample)
194var(0) ! reference
195+0.154784858
196do isam = 1, nsam
197 var(isam) = getVar(sample(lb(isam):ub(isam)))
198 mean(isam) = getMean(sample(lb(isam):ub(isam)))
199end do
200call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), ub(1) / real(ub(2), TKG))
201varMerged
202+0.154784843
203call setVarMerged(var(2), var(1), mean(1) - mean(2), ub(1) / real(ub(2), TKG))
204var(2)
205+0.154784843
206var(0) ! reference
207+0.154784858
208
209
210lb(1) = 1; ub(1) = getUnifRand(2, 7)
211do isam = 2, nsam
212 lb(isam) = ub(isam - 1) + 1
213 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
214end do
215lb
216+1, +3
217ub
218+2, +6
219sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
220sample
221(+0.359709203, -0.447478652), (+0.350123107, -0.605803728E-2), (+0.715538919, -0.527207315), (+0.337770581E-1, -0.777663052), (+0.302694142, -0.891901553), (+0.265041113, -0.134768605)
222var(0) = getVar(sample)
223var(0) ! reference
224+0.141021863
225do isam = 1, nsam
226 var(isam) = getVar(sample(lb(isam):ub(isam)))
227 mean(isam) = getMean(sample(lb(isam):ub(isam)))
228end do
229call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), ub(1) / real(ub(2), TKG))
230varMerged
231+0.141021848
232call setVarMerged(var(2), var(1), mean(1) - mean(2), ub(1) / real(ub(2), TKG))
233var(2)
234+0.141021848
235var(0) ! reference
236+0.141021863
237
238
239lb(1) = 1; ub(1) = getUnifRand(2, 7)
240do isam = 2, nsam
241 lb(isam) = ub(isam - 1) + 1
242 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
243end do
244lb
245+1, +3
246ub
247+2, +4
248sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
249sample
250(+0.294067085, -0.681287169), (+0.259248435, -0.364429355E-1), (+0.681817532E-1, -0.639215946), (+0.333932161, -0.428721488)
251var(0) = getVar(sample)
252var(0) ! reference
253+0.755901486E-1
254do isam = 1, nsam
255 var(isam) = getVar(sample(lb(isam):ub(isam)))
256 mean(isam) = getMean(sample(lb(isam):ub(isam)))
257end do
258call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), ub(1) / real(ub(2), TKG))
259varMerged
260+0.755901486E-1
261call setVarMerged(var(2), var(1), mean(1) - mean(2), ub(1) / real(ub(2), TKG))
262var(2)
263+0.755901486E-1
264var(0) ! reference
265+0.755901486E-1
266
267
268lb(1) = 1; ub(1) = getUnifRand(2, 7)
269do isam = 2, nsam
270 lb(isam) = ub(isam - 1) + 1
271 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
272end do
273lb
274+1, +3
275ub
276+2, +4
277sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
278sample
279(+0.529882908, -0.356199145), (+0.259251833, -0.933011949), (+0.320232272, -0.267866015), (+0.985427797, -0.399567246)
280var(0) = getVar(sample)
281var(0) ! reference
282+0.149060935
283do isam = 1, nsam
284 var(isam) = getVar(sample(lb(isam):ub(isam)))
285 mean(isam) = getMean(sample(lb(isam):ub(isam)))
286end do
287call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), ub(1) / real(ub(2), TKG))
288varMerged
289+0.149060935
290call setVarMerged(var(2), var(1), mean(1) - mean(2), ub(1) / real(ub(2), TKG))
291var(2)
292+0.149060935
293var(0) ! reference
294+0.149060935
295
296
297!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
298!Compute the biased merged variance of a frequency weighted univariate sample.
299!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
300
301
302lb(1) = 1; ub(1) = getUnifRand(2, 7)
303do isam = 2, nsam
304 lb(isam) = ub(isam - 1) + 1
305 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
306end do
307lb
308+1, +7
309ub
310+6, +12
311sample = getUnifRand(0., 1., ub(nsam))
312sample
313+0.972808599, +0.112576008, +0.745032430E-1, +0.421082973E-2, +0.930948377, +0.307939649, +0.235144258, +0.886963248, +0.804508686, +0.664887667, +0.701334357, +0.855493009
314iweight = getUnifRand(1, 10, size(sample, 1, IK))
315iweight
316+10, +8, +7, +3, +9, +9, +10, +4, +6, +7, +6, +6
317var(0) = getVar(sample, iweight)
318var(0) ! reference
319+0.120601609
320do isam = 1, nsam
321 var(isam) = getVar(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
322 mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
323end do
324call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
325varMerged
326+0.120601617
327call setVarMerged(var(2), var(1), mean(1) - mean(2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
328var(2)
329+0.120601617
330var(0) ! reference
331+0.120601609
332
333
334lb(1) = 1; ub(1) = getUnifRand(2, 7)
335do isam = 2, nsam
336 lb(isam) = ub(isam - 1) + 1
337 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
338end do
339lb
340+1, +6
341ub
342+5, +10
343sample = getUnifRand(0., 1., ub(nsam))
344sample
345+0.887729228, +0.636436760, +0.470908344, +0.320635200, +0.819119155, +0.535648823, +0.703419447, +0.265076697, +0.748179793, +0.847605288
346iweight = getUnifRand(1, 10, size(sample, 1, IK))
347iweight
348+6, +8, +7, +1, +4, +7, +10, +10, +9, +2
349var(0) = getVar(sample, iweight)
350var(0) ! reference
351+0.384786651E-1
352do isam = 1, nsam
353 var(isam) = getVar(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
354 mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
355end do
356call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
357varMerged
358+0.384786613E-1
359call setVarMerged(var(2), var(1), mean(1) - mean(2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
360var(2)
361+0.384786613E-1
362var(0) ! reference
363+0.384786651E-1
364
365
366lb(1) = 1; ub(1) = getUnifRand(2, 7)
367do isam = 2, nsam
368 lb(isam) = ub(isam - 1) + 1
369 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
370end do
371lb
372+1, +8
373ub
374+7, +12
375sample = getUnifRand(0., 1., ub(nsam))
376sample
377+0.239746094, +0.202776194E-1, +0.877468109, +0.448650301, +0.306854367, +0.809815407, +0.934142530, +0.937414169, +0.670443952, +0.415828824, +0.182000399E-1, +0.150106728
378iweight = getUnifRand(1, 10, size(sample, 1, IK))
379iweight
380+7, +10, +5, +4, +5, +3, +9, +10, +2, +8, +8, +7
381var(0) = getVar(sample, iweight)
382var(0) ! reference
383+0.131658182
384do isam = 1, nsam
385 var(isam) = getVar(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
386 mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
387end do
388call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
389varMerged
390+0.131658182
391call setVarMerged(var(2), var(1), mean(1) - mean(2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
392var(2)
393+0.131658182
394var(0) ! reference
395+0.131658182
396
397
398lb(1) = 1; ub(1) = getUnifRand(2, 7)
399do isam = 2, nsam
400 lb(isam) = ub(isam - 1) + 1
401 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
402end do
403lb
404+1, +6
405ub
406+5, +10
407sample = getUnifRand(0., 1., ub(nsam))
408sample
409+0.750622749E-1, +0.621466041, +0.694541991, +0.788949668, +0.811946869, +0.792292118, +0.114213109, +0.983950377, +0.857075453E-1, +0.788395405E-1
410iweight = getUnifRand(1, 10, size(sample, 1, IK))
411iweight
412+7, +3, +3, +2, +7, +7, +1, +8, +9, +10
413var(0) = getVar(sample, iweight)
414var(0) ! reference
415+0.143155858
416do isam = 1, nsam
417 var(isam) = getVar(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
418 mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
419end do
420call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
421varMerged
422+0.143155843
423call setVarMerged(var(2), var(1), mean(1) - mean(2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
424var(2)
425+0.143155843
426var(0) ! reference
427+0.143155858
428
429
430lb(1) = 1; ub(1) = getUnifRand(2, 7)
431do isam = 2, nsam
432 lb(isam) = ub(isam - 1) + 1
433 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
434end do
435lb
436+1, +5
437ub
438+4, +6
439sample = getUnifRand(0., 1., ub(nsam))
440sample
441+0.850398779, +0.534661055, +0.107200682, +0.988739252, +0.327584565, +0.226667047
442iweight = getUnifRand(1, 10, size(sample, 1, IK))
443iweight
444+5, +4, +1, +10, +5, +2
445var(0) = getVar(sample, iweight)
446var(0) ! reference
447+0.941656604E-1
448do isam = 1, nsam
449 var(isam) = getVar(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
450 mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
451end do
452call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
453varMerged
454+0.941656604E-1
455call setVarMerged(var(2), var(1), mean(1) - mean(2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
456var(2)
457+0.941656604E-1
458var(0) ! reference
459+0.941656604E-1
460
461
462lb(1) = 1; ub(1) = getUnifRand(2, 7)
463do isam = 2, nsam
464 lb(isam) = ub(isam - 1) + 1
465 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
466end do
467lb
468+1, +5
469ub
470+4, +9
471sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
472sample
473(+0.753573120, -0.205585778), (+0.588616014, -0.349650562), (+0.758927584, -0.719285011E-1), (+0.519736707, -0.957044363), (+0.171725452, -0.674497306), (+0.591776192, -0.467490256), (+0.988852501, -0.184851646), (+0.734142959, -0.841705441), (+0.288699746, -0.757220507)
474iweight = getUnifRand(1, 10, size(sample, 1, IK))
475iweight
476+8, +1, +4, +7, +1, +10, +9, +8, +6
477var(0) = getVar(sample, iweight)
478var(0) ! reference
479+0.139928684
480do isam = 1, nsam
481 var(isam) = getVar(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
482 mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
483end do
484call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
485varMerged
486+0.139928699
487call setVarMerged(var(2), var(1), mean(1) - mean(2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
488var(2)
489+0.139928699
490var(0) ! reference
491+0.139928684
492
493
494lb(1) = 1; ub(1) = getUnifRand(2, 7)
495do isam = 2, nsam
496 lb(isam) = ub(isam - 1) + 1
497 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
498end do
499lb
500+1, +5
501ub
502+4, +9
503sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
504sample
505(+0.828162432, -0.540539920), (+0.862169683, -0.111547709E-1), (+0.494877040, -0.217702150), (+0.944724858, -0.791101575), (+0.260692835E-2, -0.587025881E-1), (+0.366137445, -0.828595340), (+0.719009876, -0.146787107), (+0.413095415, -0.503180265), (+0.726852417E-1, -0.372728705)
506iweight = getUnifRand(1, 10, size(sample, 1, IK))
507iweight
508+6, +7, +1, +8, +1, +4, +3, +2, +1
509var(0) = getVar(sample, iweight)
510var(0) ! reference
511+0.172209471
512do isam = 1, nsam
513 var(isam) = getVar(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
514 mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
515end do
516call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
517varMerged
518+0.172209457
519call setVarMerged(var(2), var(1), mean(1) - mean(2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
520var(2)
521+0.172209457
522var(0) ! reference
523+0.172209471
524
525
526lb(1) = 1; ub(1) = getUnifRand(2, 7)
527do isam = 2, nsam
528 lb(isam) = ub(isam - 1) + 1
529 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
530end do
531lb
532+1, +6
533ub
534+5, +12
535sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
536sample
537(+0.389677763, -0.630508661E-1), (+0.207754016, -0.319278359), (+0.232211649, -0.636393428), (+0.163720429, -0.785705566), (+0.862738192, -0.505026460), (+0.315562487, -0.887426078), (+0.561940551, -0.252704620), (+0.444091499, -0.446763635E-1), (+0.367281854, -0.108294845), (+0.944713354E-1, -0.822873354), (+0.326592028, -0.391823649), (+0.279402971, -0.146980762)
538iweight = getUnifRand(1, 10, size(sample, 1, IK))
539iweight
540+5, +8, +9, +9, +8, +6, +4, +2, +8, +2, +7, +7
541var(0) = getVar(sample, iweight)
542var(0) ! reference
543+0.117459029
544do isam = 1, nsam
545 var(isam) = getVar(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
546 mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
547end do
548call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
549varMerged
550+0.117459022
551call setVarMerged(var(2), var(1), mean(1) - mean(2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
552var(2)
553+0.117459022
554var(0) ! reference
555+0.117459029
556
557
558lb(1) = 1; ub(1) = getUnifRand(2, 7)
559do isam = 2, nsam
560 lb(isam) = ub(isam - 1) + 1
561 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
562end do
563lb
564+1, +3
565ub
566+2, +7
567sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
568sample
569(+0.496831298, -0.943834424), (+0.239272177, -0.851670563), (+0.259641171, -0.214396656), (+0.844989777, -0.201076686), (+0.379852235, -0.759978116), (+0.546731710, -0.559752047), (+0.961523235, -0.259603262E-1)
570iweight = getUnifRand(1, 10, size(sample, 1, IK))
571iweight
572+8, +2, +6, +1, +1, +2, +6
573var(0) = getVar(sample, iweight)
574var(0) ! reference
575+0.218277931
576do isam = 1, nsam
577 var(isam) = getVar(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
578 mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
579end do
580call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
581varMerged
582+0.218277931
583call setVarMerged(var(2), var(1), mean(1) - mean(2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
584var(2)
585+0.218277931
586var(0) ! reference
587+0.218277931
588
589
590lb(1) = 1; ub(1) = getUnifRand(2, 7)
591do isam = 2, nsam
592 lb(isam) = ub(isam - 1) + 1
593 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
594end do
595lb
596+1, +5
597ub
598+4, +11
599sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
600sample
601(+0.205968797, -0.937522531), (+0.779543877, -0.250976980), (+0.277280211, -0.796820819), (+0.722867966, -0.931649923), (+0.459817529, -0.106618345), (+0.731259227, -0.623011410), (+0.544086158, -0.988216400E-1), (+0.365303397, -0.888077796), (+0.605010152, -0.193560719E-1), (+0.190733075, -0.425789535), (+0.588288009, -0.860783219)
602iweight = getUnifRand(1, 10, size(sample, 1, IK))
603iweight
604+6, +9, +8, +1, +3, +4, +2, +8, +10, +7, +6
605var(0) = getVar(sample, iweight)
606var(0) ! reference
607+0.165013701
608do isam = 1, nsam
609 var(isam) = getVar(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
610 mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
611end do
612call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
613varMerged
614+0.165013686
615call setVarMerged(var(2), var(1), mean(1) - mean(2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
616var(2)
617+0.165013686
618var(0) ! reference
619+0.165013701
620
621
622!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
623!Compute the biased merged variance of a reliability weighted univariate sample.
624!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
625
626
627lb(1) = 1; ub(1) = getUnifRand(2, 7)
628do isam = 2, nsam
629 lb(isam) = ub(isam - 1) + 1
630 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
631end do
632lb
633+1, +4
634ub
635+3, +9
636sample = getUnifRand(0., 1., ub(nsam))
637sample
638+0.522112548, +0.745396018E-1, +0.848525703, +0.216225803, +0.734398484, +0.972545028, +0.393302679, +0.138874829, +0.719871163
639rweight = getUnifRand(1., 2., size(sample, 1, IK))
640rweight
641+1.59913039, +1.24323881, +1.34636045, +1.86488664, +1.37167716, +1.39705443, +1.18799472, +1.43345761, +1.27433681
642var(0) = getVar(sample, rweight)
643var(0) ! reference
644+0.934585780E-1
645do isam = 1, nsam
646 var(isam) = getVar(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
647 mean(isam) = getMean(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
648end do
649call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
650varMerged
651+0.934585705E-1
652call setVarMerged(var(2), var(1), mean(1) - mean(2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
653var(2)
654+0.934585705E-1
655var(0) ! reference
656+0.934585780E-1
657
658
659lb(1) = 1; ub(1) = getUnifRand(2, 7)
660do isam = 2, nsam
661 lb(isam) = ub(isam - 1) + 1
662 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
663end do
664lb
665+1, +5
666ub
667+4, +7
668sample = getUnifRand(0., 1., ub(nsam))
669sample
670+0.289219141, +0.287060022, +0.970878839, +0.551008344, +0.729447126, +0.899676502, +0.837872207
671rweight = getUnifRand(1., 2., size(sample, 1, IK))
672rweight
673+1.62280560, +1.41476130, +1.79379821, +1.90319538, +1.42796981, +1.43536758, +1.81797791
674var(0) = getVar(sample, rweight)
675var(0) ! reference
676+0.668094754E-1
677do isam = 1, nsam
678 var(isam) = getVar(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
679 mean(isam) = getMean(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
680end do
681call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
682varMerged
683+0.668094829E-1
684call setVarMerged(var(2), var(1), mean(1) - mean(2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
685var(2)
686+0.668094829E-1
687var(0) ! reference
688+0.668094754E-1
689
690
691lb(1) = 1; ub(1) = getUnifRand(2, 7)
692do isam = 2, nsam
693 lb(isam) = ub(isam - 1) + 1
694 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
695end do
696lb
697+1, +6
698ub
699+5, +11
700sample = getUnifRand(0., 1., ub(nsam))
701sample
702+0.413454175, +0.831113577, +0.534334242, +0.816870451, +0.680686951, +0.289376438, +0.229618847, +0.237056673, +0.285225511E-1, +0.480395913, +0.249648213
703rweight = getUnifRand(1., 2., size(sample, 1, IK))
704rweight
705+1.82679033, +1.66666186, +1.05207324, +1.13198483, +1.35660696, +1.98397875, +1.27012563, +1.31911206, +1.28169096, +1.06015491, +1.44365478
706var(0) = getVar(sample, rweight)
707var(0) ! reference
708+0.604399294E-1
709do isam = 1, nsam
710 var(isam) = getVar(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
711 mean(isam) = getMean(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
712end do
713call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
714varMerged
715+0.604399219E-1
716call setVarMerged(var(2), var(1), mean(1) - mean(2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
717var(2)
718+0.604399219E-1
719var(0) ! reference
720+0.604399294E-1
721
722
723lb(1) = 1; ub(1) = getUnifRand(2, 7)
724do isam = 2, nsam
725 lb(isam) = ub(isam - 1) + 1
726 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
727end do
728lb
729+1, +7
730ub
731+6, +9
732sample = getUnifRand(0., 1., ub(nsam))
733sample
734+0.930402756, +0.907879710, +0.993824005E-1, +0.561941504, +0.491538048E-1, +0.411397696, +0.367166162, +0.961572289, +0.924229622E-3
735rweight = getUnifRand(1., 2., size(sample, 1, IK))
736rweight
737+1.66278017, +1.89248300, +1.75872231, +1.06546760, +1.42512679, +1.60996890, +1.78678441, +1.58781862, +1.02365780
738var(0) = getVar(sample, rweight)
739var(0) ! reference
740+0.132930592
741do isam = 1, nsam
742 var(isam) = getVar(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
743 mean(isam) = getMean(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
744end do
745call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
746varMerged
747+0.132930592
748call setVarMerged(var(2), var(1), mean(1) - mean(2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
749var(2)
750+0.132930592
751var(0) ! reference
752+0.132930592
753
754
755lb(1) = 1; ub(1) = getUnifRand(2, 7)
756do isam = 2, nsam
757 lb(isam) = ub(isam - 1) + 1
758 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
759end do
760lb
761+1, +5
762ub
763+4, +11
764sample = getUnifRand(0., 1., ub(nsam))
765sample
766+0.521515906, +0.283242226, +0.489792824, +0.577539802E-1, +0.495089650, +0.768620431, +0.854355156, +0.256272912, +0.542074740, +0.959119678, +0.162405491
767rweight = getUnifRand(1., 2., size(sample, 1, IK))
768rweight
769+1.37470174, +1.54892147, +1.73006225, +1.83361077, +1.52070498, +1.53563273, +1.97179508, +1.68564868, +1.56750321, +1.75964260, +1.28962326
770var(0) = getVar(sample, rweight)
771var(0) ! reference
772+0.792155117E-1
773do isam = 1, nsam
774 var(isam) = getVar(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
775 mean(isam) = getMean(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
776end do
777call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
778varMerged
779+0.792155415E-1
780call setVarMerged(var(2), var(1), mean(1) - mean(2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
781var(2)
782+0.792155415E-1
783var(0) ! reference
784+0.792155117E-1
785
786
787lb(1) = 1; ub(1) = getUnifRand(2, 7)
788do isam = 2, nsam
789 lb(isam) = ub(isam - 1) + 1
790 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
791end do
792lb
793+1, +6
794ub
795+5, +7
796sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
797sample
798(+0.187669277, -0.294457674), (+0.131798446, -0.977987409), (+0.417990625, -0.681630909), (+0.195452213, -0.912569404), (+0.684241712, -0.982518971), (+0.657462597, -0.902616739), (+0.430532873, -0.209922612)
799rweight = getUnifRand(1., 2., size(sample, 1, IK))
800rweight
801+1.17799830, +1.59848356, +1.26334071, +1.64681363, +1.75805664, +1.11584365, +1.50780797
802var(0) = getVar(sample, rweight)
803var(0) ! reference
804+0.137560859
805do isam = 1, nsam
806 var(isam) = getVar(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
807 mean(isam) = getMean(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
808end do
809call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
810varMerged
811+0.137560859
812call setVarMerged(var(2), var(1), mean(1) - mean(2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
813var(2)
814+0.137560859
815var(0) ! reference
816+0.137560859
817
818
819lb(1) = 1; ub(1) = getUnifRand(2, 7)
820do isam = 2, nsam
821 lb(isam) = ub(isam - 1) + 1
822 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
823end do
824lb
825+1, +6
826ub
827+5, +12
828sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
829sample
830(+0.257757664, -0.653854191), (+0.467664778, -0.808455586), (+0.115035176E-1, -0.624481857), (+0.229232669, -0.688477397), (+0.429523230, -0.307994723), (+0.977592111, -0.574360251), (+0.269044757, -0.100793242E-1), (+0.753784180, -0.449637890), (+0.269126534, -0.674464285), (+0.433862627, -0.610498667), (+0.652330577, -0.761833847), (+0.622174978, -0.484607458)
831rweight = getUnifRand(1., 2., size(sample, 1, IK))
832rweight
833+1.07039714, +1.67559683, +1.44247675, +1.48888659, +1.09602714, +1.40373707, +1.45310903, +1.62354350, +1.68173528, +1.29635501, +1.94903636, +1.27637291
834var(0) = getVar(sample, rweight)
835var(0) ! reference
836+0.110825226
837do isam = 1, nsam
838 var(isam) = getVar(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
839 mean(isam) = getMean(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
840end do
841call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
842varMerged
843+0.110825233
844call setVarMerged(var(2), var(1), mean(1) - mean(2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
845var(2)
846+0.110825233
847var(0) ! reference
848+0.110825226
849
850
851lb(1) = 1; ub(1) = getUnifRand(2, 7)
852do isam = 2, nsam
853 lb(isam) = ub(isam - 1) + 1
854 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
855end do
856lb
857+1, +7
858ub
859+6, +8
860sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
861sample
862(+0.144823611, -0.353288710), (+0.840760231, -0.141086400), (+0.390878677, -0.581986129), (+0.783770502, -0.263178945), (+0.731932521E-1, -0.816559553), (+0.408051968, -0.871779025), (+0.439551771, -0.803559959), (+0.303816915, -0.804044962)
863rweight = getUnifRand(1., 2., size(sample, 1, IK))
864rweight
865+1.83297598, +1.30447459, +1.00364125, +1.86158073, +1.60139298, +1.48901224, +1.72583795, +1.22281647
866var(0) = getVar(sample, rweight)
867var(0) ! reference
868+0.143037662
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 setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
874varMerged
875+0.143037677
876call setVarMerged(var(2), var(1), mean(1) - mean(2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
877var(2)
878+0.143037677
879var(0) ! reference
880+0.143037662
881
882
883lb(1) = 1; ub(1) = getUnifRand(2, 7)
884do isam = 2, nsam
885 lb(isam) = ub(isam - 1) + 1
886 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
887end do
888lb
889+1, +3
890ub
891+2, +5
892sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
893sample
894(+0.809294760, -0.540455997), (+0.138245285, -0.147022605), (+0.938309848, -0.708187222E-1), (+0.725421965, -0.907560110), (+0.216003120, -0.364010930E-1)
895rweight = getUnifRand(1., 2., size(sample, 1, IK))
896rweight
897+1.27158403, +1.16790915, +1.96443295, +1.18513393, +1.37741137
898var(0) = getVar(sample, rweight)
899var(0) ! reference
900+0.213641912
901do isam = 1, nsam
902 var(isam) = getVar(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
903 mean(isam) = getMean(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
904end do
905call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
906varMerged
907+0.213641882
908call setVarMerged(var(2), var(1), mean(1) - mean(2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
909var(2)
910+0.213641882
911var(0) ! reference
912+0.213641912
913
914
915lb(1) = 1; ub(1) = getUnifRand(2, 7)
916do isam = 2, nsam
917 lb(isam) = ub(isam - 1) + 1
918 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
919end do
920lb
921+1, +3
922ub
923+2, +5
924sample = cmplx(getUnifRand(0., 1., ub(nsam)), -getUnifRand(0., 1., ub(nsam)), TKG)
925sample
926(+0.102448106, -0.441954315), (+0.417125225E-1, -0.115974545E-1), (+0.359860063E-1, -0.324419618), (+0.929557323, -0.703358173), (+0.776709795, -0.928337038)
927rweight = getUnifRand(1., 2., size(sample, 1, IK))
928rweight
929+1.25677538, +1.03377628, +1.97580612, +1.08447456, +1.59794366
930var(0) = getVar(sample, rweight)
931var(0) ! reference
932+0.240977526
933do isam = 1, nsam
934 var(isam) = getVar(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
935 mean(isam) = getMean(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
936end do
937call setVarMerged(varMerged, var(2), var(1), mean(1) - mean(2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
938varMerged
939+0.240977511
940call setVarMerged(var(2), var(1), mean(1) - mean(2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
941var(2)
942+0.240977511
943var(0) ! reference
944+0.240977526
945
946
947!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
948!Compute the biased merged variance of a multivariate sample.
949!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
950
951
952dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
953do isam = 2, nsam
954 lb(isam) = ub(isam - 1) + 1
955 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
956end do
957lb
958+1, +7
959ub
960+6, +11
961ndim = getUnifRand(1, minval(ub - lb + 1, 1))
962call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
963call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
964call setResized(varMerged, ndim)
965sample = getUnifRand(-1., +1., ndim, ub(nsam))
966sample
967-0.902274489, -0.648801923, +0.145853758, -0.249810338, +0.917064190, +0.510713816, -0.962661624, +0.375113130, -0.338170648, +0.776476741, -0.987750292
968+0.249561548, -0.489351034, -0.220516443, +0.153056979, +0.222944021E-1, +0.232488394, +0.760874510, +0.293239236, -0.925330043, +0.114853740, -0.964010239
969+0.816024661, +0.461724997E-1, -0.819743872E-1, +0.259068012E-1, +0.164117813E-1, +0.216339231, -0.377901912, +0.735760689, -0.210621357, +0.264455557, +0.403519869
970var(:,0) = getVar(sample, dim)
971var(:,0) ! reference
972+0.455610245, +0.257973731, +0.124659672
973do isam = 1, nsam
974 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
975 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
976end do
977call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
978varMerged
979+0.455610305, +0.257973731, +0.124659665
980call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
981var(:,2)
982+0.455610305, +0.257973731, +0.124659665
983var(:,0) ! reference
984+0.455610245, +0.257973731, +0.124659672
985
986
987dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
988do isam = 2, nsam
989 lb(isam) = ub(isam - 1) + 1
990 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
991end do
992lb
993+1, +6
994ub
995+5, +8
996ndim = getUnifRand(1, minval(ub - lb + 1, 1))
997call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
998call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
999call setResized(varMerged, ndim)
1000sample = getUnifRand(-1., +1., ndim, ub(nsam))
1001sample
1002-0.499877453, -0.409510136E-1, +0.640338659, +0.903482795, +0.445844412, -0.943887234, +0.566644311, -0.288667440
1003-0.338787079, -0.669931889, -0.287321806E-1, +0.545727015E-1, +0.615508199, -0.469040871, +0.284605980, -0.746615648
1004var(:,0) = getVar(sample, dim)
1005var(:,0) ! reference
1006+0.361920327, +0.199242145
1007do isam = 1, nsam
1008 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
1009 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1010end do
1011call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
1012varMerged
1013+0.361920357, +0.199242160
1014call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
1015var(:,2)
1016+0.361920357, +0.199242160
1017var(:,0) ! reference
1018+0.361920327, +0.199242145
1019
1020
1021dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1022do isam = 2, nsam
1023 lb(isam) = ub(isam - 1) + 1
1024 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1025end do
1026lb
1027+1, +5
1028ub
1029+4, +6
1030ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1031call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1032call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
1033call setResized(varMerged, ndim)
1034sample = getUnifRand(-1., +1., ndim, ub(nsam))
1035sample
1036+0.788258314E-1, +0.606618047, -0.561826229E-1, +0.178701878, +0.845884919, +0.984233141
1037+0.525810957, -0.680465698E-1, -0.624785066, +0.494570374, +0.886281610, -0.326054931
1038var(:,0) = getVar(sample, dim)
1039var(:,0) ! reference
1040+0.155602321, +0.279418826
1041do isam = 1, nsam
1042 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
1043 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1044end do
1045call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
1046varMerged
1047+0.155602306, +0.279418826
1048call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
1049var(:,2)
1050+0.155602306, +0.279418826
1051var(:,0) ! reference
1052+0.155602321, +0.279418826
1053
1054
1055dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1056do isam = 2, nsam
1057 lb(isam) = ub(isam - 1) + 1
1058 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1059end do
1060lb
1061+1, +5
1062ub
1063+4, +11
1064ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1065call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1066call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
1067call setResized(varMerged, ndim)
1068sample = getUnifRand(-1., +1., ndim, ub(nsam))
1069sample
1070-0.323566437, -0.561246753, -0.921070218, -0.576605082, -0.196160913, +0.966912389, +0.590512037, -0.265647769, +0.426393032, +0.527081728, -0.592560768
1071var(:,0) = getVar(sample, dim)
1072var(:,0) ! reference
1073+0.338728905
1074do isam = 1, nsam
1075 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
1076 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1077end do
1078call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
1079varMerged
1080+0.338728905
1081call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
1082var(:,2)
1083+0.338728905
1084var(:,0) ! reference
1085+0.338728905
1086
1087
1088dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1089do isam = 2, nsam
1090 lb(isam) = ub(isam - 1) + 1
1091 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1092end do
1093lb
1094+1, +5
1095ub
1096+4, +6
1097ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1098call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1099call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
1100call setResized(varMerged, ndim)
1101sample = getUnifRand(-1., +1., ndim, ub(nsam))
1102sample
1103+0.615378737, +0.337416172, -0.408806086, -0.981052637, +0.788019776, -0.842159867
1104+0.426098228, +0.692504525, +0.589112997, +0.869750619, -0.195138454E-1, +0.726882935
1105var(:,0) = getVar(sample, dim)
1106var(:,0) ! reference
1107+0.485353678, +0.825041234E-1
1108do isam = 1, nsam
1109 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
1110 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1111end do
1112call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
1113varMerged
1114+0.485353708, +0.825041234E-1
1115call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
1116var(:,2)
1117+0.485353708, +0.825041234E-1
1118var(:,0) ! reference
1119+0.485353678, +0.825041234E-1
1120
1121
1122dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1123do isam = 2, nsam
1124 lb(isam) = ub(isam - 1) + 1
1125 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1126end do
1127lb
1128+1, +8
1129ub
1130+7, +10
1131ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1132call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1133call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
1134call setResized(varMerged, ndim)
1135sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), -getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
1136sample
1137(-0.898863435, -0.490910411), (+0.531323195, -0.810796022), (-0.507146120, -0.634126306), (+0.477120876, -0.859382629), (-0.312059522, +0.434140325), (+0.768672824, -0.405973792), (+0.709519625, +0.343047380E-1), (-0.919806957E-2, -0.501530647), (+0.206574202, +0.383299470), (-0.313534975, +0.618358254)
1138(+0.922214270, -0.722887874), (-0.720769763, -0.591884851E-1), (-0.565511823, -0.443517804), (+0.113196850, -0.296497107), (+0.287744403, +0.379383564E-1), (-0.206608176, +0.644248009), (-0.811513186, -0.735806465), (-0.991337299E-1, -0.285777688), (+0.583809853, -0.547064424), (-0.463418126, +0.835097194)
1139(+0.439243317, +0.507998109), (+0.903160334, -0.502853155), (-0.226024508, +0.944223046), (+0.585753918E-1, -0.388604164), (-0.710730672, -0.215749502), (-0.686340690, +0.721068263), (+0.410027504, +0.900212049), (+0.488995552, +0.959570408), (-0.468291402, -0.312693119), (-0.956358671, +0.838008165)
1140var(:,0) = getVar(sample, dim)
1141var(:,0) ! reference
1142+0.554112434, +0.555925667, +0.698470771
1143do isam = 1, nsam
1144 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
1145 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1146end do
1147call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
1148varMerged
1149+0.554112434, +0.555925667, +0.698470771
1150call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
1151var(:,2)
1152+0.554112434, +0.555925667, +0.698470771
1153var(:,0) ! reference
1154+0.554112434, +0.555925667, +0.698470771
1155
1156
1157dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1158do isam = 2, nsam
1159 lb(isam) = ub(isam - 1) + 1
1160 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1161end do
1162lb
1163+1, +5
1164ub
1165+4, +10
1166ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1167call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1168call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
1169call setResized(varMerged, ndim)
1170sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), -getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
1171sample
1172(-0.476198077, +0.982520342), (+0.131975055, -0.308599353), (+0.397111177E-1, +0.812063694), (+0.925534487, +0.819882274), (+0.493365526, -0.481618643), (+0.769308805E-1, -0.115126967), (+0.415607214, +0.775631070), (-0.527027845, -0.893667459), (-0.462110877, +0.350874305), (+0.616801262, -0.757657766)
1173(-0.252541542, +0.291156769E-1), (-0.427683711, +0.288555980), (+0.165092945E-1, +0.160862923), (-0.924117327, -0.349455237), (-0.534555793, +0.938708663), (+0.109989643E-1, -0.989046574), (+0.909367561, -0.851778150), (-0.193476677E-1, +0.834021568E-1), (+0.582243204E-1, -0.649415135), (+0.469630957E-1, +0.515188813)
1174(-0.909083366, -0.413929105), (-0.527043343E-1, +0.539823771E-1), (-0.314494371E-1, +0.893720627), (-0.397528410, -0.654806137), (-0.106633425, +0.418690085), (-0.894980311, +0.225264668), (-0.665152550, +0.247690678E-1), (-0.963680029, -0.664603710), (+0.588335276, -0.933631063), (+0.704765677, -0.181089640)
1175var(:,0) = getVar(sample, dim)
1176var(:,0) ! reference
1177+0.683834910, +0.553842247, +0.609315455
1178do isam = 1, nsam
1179 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
1180 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1181end do
1182call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
1183varMerged
1184+0.683834910, +0.553842187, +0.609315455
1185call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
1186var(:,2)
1187+0.683834910, +0.553842187, +0.609315455
1188var(:,0) ! reference
1189+0.683834910, +0.553842247, +0.609315455
1190
1191
1192dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1193do isam = 2, nsam
1194 lb(isam) = ub(isam - 1) + 1
1195 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1196end do
1197lb
1198+1, +5
1199ub
1200+4, +10
1201ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1202call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1203call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
1204call setResized(varMerged, ndim)
1205sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), -getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
1206sample
1207(+0.278764367, +0.698744893), (-0.236132145E-1, +0.257015705), (+0.269762754, -0.875359535), (+0.831024885, -0.182772875E-1), (-0.113333106, +0.788612127), (-0.532136440, +0.887642264), (-0.344892502, +0.937377930), (+0.403262019, -0.349161148), (+0.303972006, +0.373735785), (-0.651593685, +0.477085114)
1208(-0.108979940, -0.651787877), (-0.281770349, -0.733716726), (-0.986692309, +0.316802025), (+0.502418518, +0.227830887), (-0.954000354, -0.689566135E-2), (+0.166068554, -0.827320814E-1), (-0.418071628, +0.650168657), (+0.320088029, -0.777449012), (-0.381816745, +0.956978798E-1), (+0.169273496, +0.634987593)
1209(-0.736998320E-1, +0.410800457), (-0.517692566E-1, +0.134818673), (-0.808278918, +0.511107564), (+0.468002677, -0.112135172), (-0.897903204, +0.375828743E-1), (+0.509718418, -0.208347321), (+0.304595232E-1, +0.508501172), (-0.550749183, +0.151139736), (-0.456794858, +0.991290450), (+0.806081533, -0.955107808)
1210(-0.866036534, -0.169871092), (-0.774098396, -0.303337693), (-0.913855076, +0.206735134E-1), (+0.971655846E-1, +0.564742804), (+0.103779435, -0.784039617), (+0.998983622, -0.224384785), (+0.366091967, +0.332816958), (+0.424306512, -0.831377506E-2), (+0.105937004, +0.627314568), (+0.500897527, +0.527920842)
1211var(:,0) = getVar(sample, dim)
1212var(:,0) ! reference
1213+0.500744760, +0.486831188, +0.547000527, +0.563286126
1214do isam = 1, nsam
1215 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
1216 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1217end do
1218call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
1219varMerged
1220+0.500744760, +0.486831188, +0.547000527, +0.563286126
1221call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
1222var(:,2)
1223+0.500744760, +0.486831188, +0.547000527, +0.563286126
1224var(:,0) ! reference
1225+0.500744760, +0.486831188, +0.547000527, +0.563286126
1226
1227
1228dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1229do isam = 2, nsam
1230 lb(isam) = ub(isam - 1) + 1
1231 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1232end do
1233lb
1234+1, +7
1235ub
1236+6, +12
1237ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1238call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1239call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
1240call setResized(varMerged, ndim)
1241sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), -getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
1242sample
1243(-0.642212510, -0.355322480), (-0.562590718, -0.614030123), (+0.898363829, +0.523419380E-1), (+0.429342985, +0.896628499), (+0.841554403E-1, -0.827000380), (-0.433498502, -0.868036389), (-0.424673915, -0.323034286), (+0.987298727, +0.363167763), (+0.367053151, +0.626986146), (+0.654906869, -0.490441561), (+0.624285221, -0.337656498), (-0.491318703E-1, -0.451584458)
1244(+0.653537154, +0.478377700), (-0.132556796, -0.908329487E-1), (-0.153341413, +0.246960282), (+0.106026292, -0.826819420), (+0.293275237, +0.441260338E-1), (+0.453273535, -0.722075582), (-0.278672218, +0.658713460), (-0.583637357, -0.470158458), (+0.570943475, +0.362503052), (-0.543933868, -0.918868065), (-0.662287712, -0.425020099), (+0.249499321, -0.949183702)
1245(-0.376461387, -0.739163518), (-0.981158853, +0.231155753), (-0.552382946, +0.273451805), (-0.864680171, -0.447574019), (+0.505847573, -0.768286109), (-0.554777384E-1, -0.537810564), (-0.843819618, +0.813514709), (+0.834091425, -0.687093019), (-0.765749216, -0.322658539), (-0.931522965, -0.444607139), (-0.305900812, -0.637520790), (+0.643431067, -0.796520829)
1246var(:,0) = getVar(sample, dim)
1247var(:,0) ! reference
1248+0.599861920, +0.496708930, +0.625316739
1249do isam = 1, nsam
1250 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
1251 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1252end do
1253call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
1254varMerged
1255+0.599861920, +0.496708930, +0.625316679
1256call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
1257var(:,2)
1258+0.599861920, +0.496708930, +0.625316679
1259var(:,0) ! reference
1260+0.599861920, +0.496708930, +0.625316739
1261
1262
1263dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1264do isam = 2, nsam
1265 lb(isam) = ub(isam - 1) + 1
1266 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1267end do
1268lb
1269+1, +3
1270ub
1271+2, +5
1272ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1273call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1274call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
1275call setResized(varMerged, ndim)
1276sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), -getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
1277sample
1278(-0.643377662, +0.164959192), (-0.942224979, -0.485823870), (-0.851301670, -0.937904477), (+0.290958762, +0.888182044), (-0.188605905, +0.656538486)
1279var(:,0) = getVar(sample, dim)
1280var(:,0) ! reference
1281+0.680619597
1282do isam = 1, nsam
1283 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), dim)
1284 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1285end do
1286call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
1287varMerged
1288+0.680619717
1289call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
1290var(:,2)
1291+0.680619717
1292var(:,0) ! reference
1293+0.680619597
1294
1295
1296!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1297!Compute the biased merged variance of a frequency weighted multivariate sample.
1298!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1299
1300
1301dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1302do isam = 2, nsam
1303 lb(isam) = ub(isam - 1) + 1
1304 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1305end do
1306lb
1307+1, +3
1308ub
1309+2, +4
1310ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1311call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1312call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
1313call setResized(varMerged, ndim)
1314sample = getUnifRand(-1., +1., ndim, ub(nsam))
1315sample
1316+0.705856204, +0.809519410, +0.434411526, +0.927069902
1317+0.337166667, +0.843157053, +0.500416756E-2, -0.819877625
1318iweight = getUnifRand(1, 10, size(sample, dim, IK))
1319iweight
1320+8, +7, +10, +5
1321var(:,0) = getVar(sample, 2_IK, iweight)
1322var(:,0) ! reference
1323+0.343582705E-1, +0.285232842
1324do isam = 1, nsam
1325 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1326 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1327end do
1328call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1329varMerged
1330+0.343582742E-1, +0.285232842
1331call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1332var(:,2)
1333+0.343582742E-1, +0.285232842
1334var(:,0) ! reference
1335+0.343582705E-1, +0.285232842
1336
1337
1338dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1339do isam = 2, nsam
1340 lb(isam) = ub(isam - 1) + 1
1341 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1342end do
1343lb
1344+1, +4
1345ub
1346+3, +8
1347ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1348call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1349call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
1350call setResized(varMerged, ndim)
1351sample = getUnifRand(-1., +1., ndim, ub(nsam))
1352sample
1353+0.415035725, +0.702162504, +0.234350920, +0.251109600, +0.978246212, -0.125225663, +0.788504958, -0.314499736
1354iweight = getUnifRand(1, 10, size(sample, dim, IK))
1355iweight
1356+3, +3, +6, +2, +3, +10, +6, +2
1357var(:,0) = getVar(sample, 2_IK, iweight)
1358var(:,0) ! reference
1359+0.169209704
1360do isam = 1, nsam
1361 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1362 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1363end do
1364call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1365varMerged
1366+0.169209704
1367call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1368var(:,2)
1369+0.169209704
1370var(:,0) ! reference
1371+0.169209704
1372
1373
1374dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1375do isam = 2, nsam
1376 lb(isam) = ub(isam - 1) + 1
1377 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1378end do
1379lb
1380+1, +8
1381ub
1382+7, +11
1383ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1384call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1385call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
1386call setResized(varMerged, ndim)
1387sample = getUnifRand(-1., +1., ndim, ub(nsam))
1388sample
1389-0.354228020, +0.884099007E-1, +0.845666528, +0.429026008, -0.278605938, -0.906816125, +0.899421811, -0.508985162, -0.189560056, -0.343139172, +0.784993291
1390iweight = getUnifRand(1, 10, size(sample, dim, IK))
1391iweight
1392+2, +1, +6, +6, +3, +1, +2, +10, +8, +8, +9
1393var(:,0) = getVar(sample, 2_IK, iweight)
1394var(:,0) ! reference
1395+0.308609247
1396do isam = 1, nsam
1397 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1398 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1399end do
1400call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1401varMerged
1402+0.308609217
1403call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1404var(:,2)
1405+0.308609217
1406var(:,0) ! reference
1407+0.308609247
1408
1409
1410dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1411do isam = 2, nsam
1412 lb(isam) = ub(isam - 1) + 1
1413 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1414end do
1415lb
1416+1, +3
1417ub
1418+2, +5
1419ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1420call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1421call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
1422call setResized(varMerged, ndim)
1423sample = getUnifRand(-1., +1., ndim, ub(nsam))
1424sample
1425-0.658561945, +0.179705620, +0.278295755, +0.317425489, -0.154611588
1426iweight = getUnifRand(1, 10, size(sample, dim, IK))
1427iweight
1428+2, +4, +8, +3, +5
1429var(:,0) = getVar(sample, 2_IK, iweight)
1430var(:,0) ! reference
1431+0.858866423E-1
1432do isam = 1, nsam
1433 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1434 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1435end do
1436call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1437varMerged
1438+0.858866349E-1
1439call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1440var(:,2)
1441+0.858866349E-1
1442var(:,0) ! reference
1443+0.858866423E-1
1444
1445
1446dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1447do isam = 2, nsam
1448 lb(isam) = ub(isam - 1) + 1
1449 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1450end do
1451lb
1452+1, +4
1453ub
1454+3, +8
1455ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1456call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1457call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
1458call setResized(varMerged, ndim)
1459sample = getUnifRand(-1., +1., ndim, ub(nsam))
1460sample
1461-0.741678834, -0.274475217, -0.197572112, +0.302025795, +0.368824124, -0.834445834, +0.544283390E-1, -0.577114582
1462iweight = getUnifRand(1, 10, size(sample, dim, IK))
1463iweight
1464+4, +3, +3, +9, +6, +4, +6, +5
1465var(:,0) = getVar(sample, 2_IK, iweight)
1466var(:,0) ! reference
1467+0.198343903
1468do isam = 1, nsam
1469 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1470 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1471end do
1472call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1473varMerged
1474+0.198343903
1475call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1476var(:,2)
1477+0.198343903
1478var(:,0) ! reference
1479+0.198343903
1480
1481
1482dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1483do isam = 2, nsam
1484 lb(isam) = ub(isam - 1) + 1
1485 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1486end do
1487lb
1488+1, +7
1489ub
1490+6, +10
1491ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1492call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1493call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
1494call setResized(varMerged, ndim)
1495sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
1496sample
1497(+0.666962147, -0.961538076), (+0.706293583, -0.441780448), (-0.796339393, -0.575214148), (+0.967309833, -0.177862644E-1), (+0.747689009E-1, +0.160133600), (-0.139149666, +0.177966237), (+0.447077513, +0.793694496), (-0.821147561, -0.908249497), (+0.761312246, +0.711736441), (+0.571289897, +0.556646943)
1498(-0.132532358, +0.421752214), (-0.363661766, +0.360602021), (+0.328309298, +0.415349007E-2), (+0.387532711, -0.820196986), (-0.222299576, +0.394693851), (+0.976669669, +0.872541547), (-0.651199937, -0.795539260), (+0.325256109, -0.494964123E-1), (+0.973410606E-1, -0.652403951), (-0.949118137E-1, +0.748809934)
1499(-0.650966525, +0.197395444), (+0.973906994, +0.477362156), (-0.238532782, -0.295203686), (+0.162520528, +0.657770038), (-0.138929009, +0.727949739), (-0.511267900, +0.713053107), (+0.203129292, +0.773863077), (-0.665916562, -0.989996076), (-0.934052229, -0.475013375), (+0.830846667, -0.926733494)
1500(-0.210882306, -0.909214854), (+0.299995899, -0.405943632), (+0.230109453, +0.812988400), (-0.430759788, +0.390757561), (+0.825081468, +0.565663576), (+0.795649409, +0.811537147), (+0.118882895, -0.599910617), (+0.635424256, +0.913573384), (-0.177166104, +0.941385627), (+0.600104213, -0.216313601)
1501iweight = getUnifRand(1, 10, size(sample, dim, IK))
1502iweight
1503+10, +4, +2, +10, +7, +6, +7, +6, +5, +4
1504var(:,0) = getVar(sample, 2_IK, iweight)
1505var(:,0) ! reference
1506+0.706464827, +0.581372440, +0.709974051, +0.687819958
1507do isam = 1, nsam
1508 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1509 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1510end do
1511call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1512varMerged
1513+0.706464887, +0.581372499, +0.709974051, +0.687820077
1514call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1515var(:,2)
1516+0.706464887, +0.581372499, +0.709974051, +0.687820077
1517var(:,0) ! reference
1518+0.706464827, +0.581372440, +0.709974051, +0.687819958
1519
1520
1521dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1522do isam = 2, nsam
1523 lb(isam) = ub(isam - 1) + 1
1524 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1525end do
1526lb
1527+1, +8
1528ub
1529+7, +10
1530ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1531call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1532call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
1533call setResized(varMerged, ndim)
1534sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
1535sample
1536(-0.245508194, +0.855350137), (-0.228887796, -0.817185760), (+0.728183150, +0.239063263), (+0.683184385, +0.375074267), (+0.581895113, -0.130779743), (-0.817774296, +0.730833769), (-0.143849850, -0.148228765), (-0.418767333, +0.826942086), (+0.928836346, -0.591916919), (-0.578984261, -0.625543594)
1537(-0.135410190, -0.624632359), (-0.523886323, +0.923788071), (-0.231252909E-1, -0.772210360E-1), (-0.117218971, -0.604552150), (+0.291371107, -0.253922939E-1), (+0.406780720, -0.623906374), (-0.853809834, -0.425007820), (+0.692703605, +0.481491446), (-0.680694580, -0.575056434), (+0.819445848E-1, -0.926185012)
1538iweight = getUnifRand(1, 10, size(sample, dim, IK))
1539iweight
1540+4, +6, +8, +7, +10, +6, +5, +3, +7, +10
1541var(:,0) = getVar(sample, 2_IK, iweight)
1542var(:,0) ! reference
1543+0.677568495, +0.451545179
1544do isam = 1, nsam
1545 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1546 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1547end do
1548call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1549varMerged
1550+0.677568495, +0.451545179
1551call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1552var(:,2)
1553+0.677568495, +0.451545179
1554var(:,0) ! reference
1555+0.677568495, +0.451545179
1556
1557
1558dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1559do isam = 2, nsam
1560 lb(isam) = ub(isam - 1) + 1
1561 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1562end do
1563lb
1564+1, +8
1565ub
1566+7, +9
1567ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1568call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1569call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
1570call setResized(varMerged, ndim)
1571sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
1572sample
1573(+0.106148362, +0.910557151), (+0.378223419, +0.434238672), (-0.618231773, -0.588397026), (+0.982396483, -0.301270604), (-0.487957478, +0.552514195), (+0.935700774, -0.354831100), (-0.773203254, +0.264267921E-1), (-0.395789146E-1, +0.236356258E-2), (-0.556547523, +0.582742333)
1574iweight = getUnifRand(1, 10, size(sample, dim, IK))
1575iweight
1576+5, +1, +8, +9, +1, +10, +1, +2, +5
1577var(:,0) = getVar(sample, 2_IK, iweight)
1578var(:,0) ! reference
1579+0.755326688
1580do isam = 1, nsam
1581 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1582 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1583end do
1584call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1585varMerged
1586+0.755326748
1587call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1588var(:,2)
1589+0.755326748
1590var(:,0) ! reference
1591+0.755326688
1592
1593
1594dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1595do isam = 2, nsam
1596 lb(isam) = ub(isam - 1) + 1
1597 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1598end do
1599lb
1600+1, +3
1601ub
1602+2, +8
1603ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1604call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1605call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
1606call setResized(varMerged, ndim)
1607sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
1608sample
1609(-0.542162061, +0.190398693E-1), (-0.285102844, -0.459957123E-1), (-0.877113342E-1, +0.783468246), (+0.930641532, -0.167688847), (-0.783588886E-1, -0.917996287), (+0.819467068, -0.301821232), (-0.129559755, -0.802323461), (-0.758509278, -0.810205936)
1610iweight = getUnifRand(1, 10, size(sample, dim, IK))
1611iweight
1612+7, +4, +8, +5, +5, +4, +9, +3
1613var(:,0) = getVar(sample, 2_IK, iweight)
1614var(:,0) ! reference
1615+0.588119268
1616do isam = 1, nsam
1617 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1618 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1619end do
1620call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1621varMerged
1622+0.588119328
1623call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1624var(:,2)
1625+0.588119328
1626var(:,0) ! reference
1627+0.588119268
1628
1629
1630dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1631do isam = 2, nsam
1632 lb(isam) = ub(isam - 1) + 1
1633 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1634end do
1635lb
1636+1, +7
1637ub
1638+6, +13
1639ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1640call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1641call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
1642call setResized(varMerged, ndim)
1643sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
1644sample
1645(-0.926922679, -0.298818350E-1), (-0.243337274, +0.745286942E-1), (-0.280132413, -0.182285786), (+0.755516768, -0.802497745), (+0.118303895, +0.560160875), (-0.950950503, -0.429252744), (-0.554244518E-1, +0.524238229), (+0.770309091, +0.249984622), (+0.607469916, +0.616116524), (-0.398754001, +0.540415406), (-0.574567437, -0.278787255), (+0.107298613, -0.965413809), (+0.110342622, +0.416818857E-1)
1646(-0.159470677, +0.931211710E-1), (-0.698794603, +0.891720057E-1), (+0.460260749, +0.388891220), (+0.516233444E-1, +0.875191450), (-0.528159380, +0.766205907), (-0.646242499, +0.493923426E-1), (-0.737263799, -0.848336577), (-0.145791888, +0.556642175), (+0.805462122, -0.323294759), (-0.973893166, -0.555580139), (+0.375540376, -0.310533404), (-0.149048328, +0.442517161), (+0.266939521, +0.240548134)
1647iweight = getUnifRand(1, 10, size(sample, dim, IK))
1648iweight
1649+1, +3, +9, +4, +5, +10, +10, +6, +7, +4, +1, +9, +2
1650var(:,0) = getVar(sample, 2_IK, iweight)
1651var(:,0) ! reference
1652+0.591235518, +0.570302665
1653do isam = 1, nsam
1654 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1655 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1656end do
1657call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1658varMerged
1659+0.591235518, +0.570302665
1660call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1661var(:,2)
1662+0.591235518, +0.570302665
1663var(:,0) ! reference
1664+0.591235518, +0.570302665
1665
1666
1667!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1668!Compute the biased merged variance of a reliability weighted multivariate sample.
1669!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1670
1671
1672dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1673do isam = 2, nsam
1674 lb(isam) = ub(isam - 1) + 1
1675 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1676end do
1677lb
1678+1, +3
1679ub
1680+2, +5
1681ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1682call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1683call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
1684call setResized(varMerged, ndim)
1685sample = getUnifRand(-1., +1., ndim, ub(nsam))
1686sample
1687+0.460029602, -0.293368578, -0.373516560, -0.962636828, +0.375983477
1688+0.930958867, +0.256311297, +0.736812711, +0.138683319, +0.487774849
1689rweight = getUnifRand(1., 2., size(sample, dim, IK))
1690rweight
1691+1.01017797, +1.62548566, +1.40532470, +1.49459112, +1.90453887
1692var(:,0) = getVar(sample, 2_IK, rweight)
1693var(:,0) ! reference
1694+0.267559111, +0.743860304E-1
1695do isam = 1, nsam
1696 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1697 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1698end do
1699call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1700varMerged
1701+0.267559052, +0.743860304E-1
1702call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1703var(:,2)
1704+0.267559052, +0.743860304E-1
1705var(:,0) ! reference
1706+0.267559111, +0.743860304E-1
1707
1708
1709dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1710do isam = 2, nsam
1711 lb(isam) = ub(isam - 1) + 1
1712 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1713end do
1714lb
1715+1, +6
1716ub
1717+5, +11
1718ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1719call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1720call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
1721call setResized(varMerged, ndim)
1722sample = getUnifRand(-1., +1., ndim, ub(nsam))
1723sample
1724+0.614552379, -0.423786402, -0.229943037, +0.696812987, -0.525009632E-2, -0.733222723, -0.185187101, +0.466558933, -0.722688913, -0.403021455, +0.717701316
1725+0.433647037, -0.598072052, -0.236315727, -0.953127384, -0.476506710, -0.639668465, -0.527256846, -0.715587497, -0.324638128, +0.554684401E-1, -0.615184903
1726+0.110324264, +0.934567928, -0.818084836, +0.529495358, -0.194543481, -0.141818523, +0.246729612, +0.331275821, -0.857547402, +0.961508036, -0.407112360
1727rweight = getUnifRand(1., 2., size(sample, dim, IK))
1728rweight
1729+1.77659607, +1.96177340, +1.05248678, +1.07430673, +1.14621592, +1.55237627, +1.47137332, +1.55097818, +1.49967313, +1.00736797, +1.24252176
1730var(:,0) = getVar(sample, 2_IK, rweight)
1731var(:,0) ! reference
1732+0.286406636, +0.144501895, +0.338863969
1733do isam = 1, nsam
1734 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1735 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1736end do
1737call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1738varMerged
1739+0.286406636, +0.144501910, +0.338864028
1740call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1741var(:,2)
1742+0.286406636, +0.144501910, +0.338864028
1743var(:,0) ! reference
1744+0.286406636, +0.144501895, +0.338863969
1745
1746
1747dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1748do isam = 2, nsam
1749 lb(isam) = ub(isam - 1) + 1
1750 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1751end do
1752lb
1753+1, +4
1754ub
1755+3, +6
1756ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1757call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1758call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
1759call setResized(varMerged, ndim)
1760sample = getUnifRand(-1., +1., ndim, ub(nsam))
1761sample
1762+0.961881995, +0.891190052, -0.572649479, -0.596723557E-1, +0.998573303, -0.878392100
1763-0.326285481, -0.361691713, +0.106955647, -0.224904656, -0.234822989, -0.245733142
1764-0.541052938, -0.131974101, -0.803843379, -0.576705217, +0.884593606, -0.139188766E-1
1765rweight = getUnifRand(1., 2., size(sample, dim, IK))
1766rweight
1767+1.82439256, +1.16331935, +1.01992369, +1.45991325, +1.39180076, +1.22219563
1768var(:,0) = getVar(sample, 2_IK, rweight)
1769var(:,0) ! reference
1770+0.562728822, +0.189643465E-1, +0.306391031
1771do isam = 1, nsam
1772 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1773 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1774end do
1775call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1776varMerged
1777+0.562728822, +0.189643428E-1, +0.306390971
1778call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1779var(:,2)
1780+0.562728822, +0.189643428E-1, +0.306390971
1781var(:,0) ! reference
1782+0.562728822, +0.189643465E-1, +0.306391031
1783
1784
1785dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1786do isam = 2, nsam
1787 lb(isam) = ub(isam - 1) + 1
1788 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1789end do
1790lb
1791+1, +4
1792ub
1793+3, +5
1794ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1795call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1796call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
1797call setResized(varMerged, ndim)
1798sample = getUnifRand(-1., +1., ndim, ub(nsam))
1799sample
1800-0.655491114, -0.816720009, -0.714972854, +0.192758560, +0.663073182
1801+0.732982516, -0.912226558, -0.194191337, +0.576962471, -0.823698878
1802rweight = getUnifRand(1., 2., size(sample, dim, IK))
1803rweight
1804+1.15768600, +1.77890849, +1.56300688, +1.28153014, +1.49125910
1805var(:,0) = getVar(sample, 2_IK, rweight)
1806var(:,0) ! reference
1807+0.355272084, +0.448565066
1808do isam = 1, nsam
1809 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1810 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1811end do
1812call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1813varMerged
1814+0.355272084, +0.448565036
1815call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1816var(:,2)
1817+0.355272084, +0.448565036
1818var(:,0) ! reference
1819+0.355272084, +0.448565066
1820
1821
1822dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1823do isam = 2, nsam
1824 lb(isam) = ub(isam - 1) + 1
1825 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1826end do
1827lb
1828+1, +5
1829ub
1830+4, +11
1831ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1832call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1833call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
1834call setResized(varMerged, ndim)
1835sample = getUnifRand(-1., +1., ndim, ub(nsam))
1836sample
1837+0.808606744, +0.220362544, +0.801791430, -0.757616401, -0.679708362, +0.911671281, -0.647293568, -0.262669921, +0.786936045, +0.309132457, -0.845189333
1838+0.172615051E-2, +0.589989424E-1, +0.167469859, +0.561426044, -0.298482895, -0.735116720, -0.654819131, +0.248589396, +0.869643688E-1, +0.595354557, +0.348871350
1839+0.250681400, +0.728107452, +0.918661118, +0.674109340, +0.154230356, +0.596910715, -0.519001603, +0.778382659, +0.352741480E-1, -0.463998318E-2, -0.673311830
1840rweight = getUnifRand(1., 2., size(sample, dim, IK))
1841rweight
1842+1.28772223, +1.69019306, +1.27230287, +1.46205974, +1.63165152, +1.42136574, +1.16030455, +1.74902666, +1.87387681, +1.00522423, +1.69825566
1843var(:,0) = getVar(sample, 2_IK, rweight)
1844var(:,0) ! reference
1845+0.465581715, +0.158381343, +0.256403744
1846do isam = 1, nsam
1847 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1848 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1849end do
1850call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1851varMerged
1852+0.465581685, +0.158381343, +0.256403714
1853call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1854var(:,2)
1855+0.465581685, +0.158381343, +0.256403714
1856var(:,0) ! reference
1857+0.465581715, +0.158381343, +0.256403744
1858
1859
1860dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1861do isam = 2, nsam
1862 lb(isam) = ub(isam - 1) + 1
1863 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1864end do
1865lb
1866+1, +8
1867ub
1868+7, +9
1869ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1870call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1871call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
1872call setResized(varMerged, ndim)
1873sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
1874sample
1875(-0.261031628, -0.914617062), (+0.409027338E-1, -0.744035244), (-0.721457601, +0.585199475), (-0.716470003, -0.490597486E-1), (-0.798190951, +0.701974392), (-0.992403269, +0.839413047), (+0.899656534, -0.973448753E-1), (+0.317848682, -0.997044325), (+0.637656808, -0.521872759)
1876rweight = getUnifRand(1., 2., size(sample, dim, IK))
1877rweight
1878+1.67616272, +1.33454847, +1.48370922, +1.68066669, +1.84223580, +1.74137402, +1.14436841, +1.76129508, +1.78658557
1879var(:,0) = getVar(sample, 2_IK, rweight)
1880var(:,0) ! reference
1881+0.872579694
1882do isam = 1, nsam
1883 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1884 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1885end do
1886call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1887varMerged
1888+0.872579694
1889call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1890var(:,2)
1891+0.872579694
1892var(:,0) ! reference
1893+0.872579694
1894
1895
1896dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1897do isam = 2, nsam
1898 lb(isam) = ub(isam - 1) + 1
1899 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1900end do
1901lb
1902+1, +4
1903ub
1904+3, +7
1905ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1906call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1907call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
1908call setResized(varMerged, ndim)
1909sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
1910sample
1911(-0.593937635E-1, -0.617805839), (+0.252352953E-1, -0.486315131), (-0.919135332, +0.405859947E-1), (-0.629978776, -0.240323663), (+0.448878407, -0.718716145), (-0.495951176E-1, -0.970683813), (+0.640217185, -0.747477770)
1912(+0.416382909, -0.603934407), (-0.380209088, -0.375291348), (+0.216463089, -0.332289577), (-0.114862084, +0.683399439), (-0.761282444E-1, -0.953667283), (+0.362300634, +0.996231675), (+0.427666426, +0.954665184)
1913rweight = getUnifRand(1., 2., size(sample, dim, IK))
1914rweight
1915+1.60993636, +1.99905765, +1.19328082, +1.36388254, +1.98567915, +1.46525574, +1.32392824
1916var(:,0) = getVar(sample, 2_IK, rweight)
1917var(:,0) ! reference
1918+0.312767416, +0.648638785
1919do isam = 1, nsam
1920 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1921 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1922end do
1923call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1924varMerged
1925+0.312767446, +0.648638785
1926call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1927var(:,2)
1928+0.312767446, +0.648638785
1929var(:,0) ! reference
1930+0.312767416, +0.648638785
1931
1932
1933dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1934do isam = 2, nsam
1935 lb(isam) = ub(isam - 1) + 1
1936 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1937end do
1938lb
1939+1, +7
1940ub
1941+6, +8
1942ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1943call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1944call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
1945call setResized(varMerged, ndim)
1946sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
1947sample
1948(+0.695660114E-1, -0.623174906E-1), (+0.972343206, -0.553104758), (+0.711107731, +0.517208099), (-0.896051288, +0.727480292), (-0.714633346, +0.843813419), (+0.151866317, -0.440363050), (+0.112660170, -0.499837041), (+0.680850625, +0.773581266)
1949rweight = getUnifRand(1., 2., size(sample, dim, IK))
1950rweight
1951+1.05890477, +1.78127253, +1.63326573, +1.54850364, +1.37721264, +1.80129933, +1.64056325, +1.73799264
1952var(:,0) = getVar(sample, 2_IK, rweight)
1953var(:,0) ! reference
1954+0.735818148
1955do isam = 1, nsam
1956 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1957 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1958end do
1959call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1960varMerged
1961+0.735818148
1962call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1963var(:,2)
1964+0.735818148
1965var(:,0) ! reference
1966+0.735818148
1967
1968
1969dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1970do isam = 2, nsam
1971 lb(isam) = ub(isam - 1) + 1
1972 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1973end do
1974lb
1975+1, +6
1976ub
1977+5, +8
1978ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1979call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
1980call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
1981call setResized(varMerged, ndim)
1982sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
1983sample
1984(-0.169258118E-1, +0.951236725), (-0.974802494, +0.643455744), (+0.784508109, -0.166407466), (+0.137954831, -0.281824827), (+0.553798914, -0.654775381), (-0.208607912, +0.722259283), (-0.491883397, -0.414582253), (+0.307537675, +0.605530024)
1985rweight = getUnifRand(1., 2., size(sample, dim, IK))
1986rweight
1987+1.54709601, +1.67517757, +1.62471104, +1.34143257, +1.62061715, +1.45655537, +1.69151711, +1.62985349
1988var(:,0) = getVar(sample, 2_IK, rweight)
1989var(:,0) ! reference
1990+0.631802201
1991do isam = 1, nsam
1992 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1993 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1994end do
1995call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1996varMerged
1997+0.631802261
1998call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1999var(:,2)
2000+0.631802261
2001var(:,0) ! reference
2002+0.631802201
2003
2004
2005dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
2006do isam = 2, nsam
2007 lb(isam) = ub(isam - 1) + 1
2008 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
2009end do
2010lb
2011+1, +5
2012ub
2013+4, +9
2014ndim = getUnifRand(1, minval(ub - lb + 1, 1))
2015call setRebound(var, [1_IK, 0_IK], [ndim, nsam])
2016call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
2017call setResized(varMerged, ndim)
2018sample = cmplx(getUnifRand(-1., +1., ndim, ub(nsam)), getUnifRand(-1., +1., ndim, ub(nsam)), TKG)
2019sample
2020(-0.378898263, -0.270808458), (-0.627832174, -0.321482301), (+0.441128135, -0.945881248), (-0.309360027, -0.674990296), (+0.108477712, -0.660212517), (-0.485677481, -0.420334458), (+0.584257126, +0.291362047), (-0.302208543, -0.687203050), (-0.508160233, +0.882365823)
2021(+0.957346797, -0.228343368), (-0.483841538, -0.329884887), (+0.407219410, +0.964086652), (-0.603586316, +0.722148418E-1), (+0.527539730, +0.616263151), (-0.197870851, -0.160362840), (+0.224440098E-1, -0.829549313), (-0.560439825E-1, -0.664375663), (-0.445518970, -0.263706446)
2022(-0.273316979, -0.936767817), (-0.580408454, -0.836801529E-2), (+0.346042395, +0.349774480), (-0.201066017, +0.473378897), (+0.476075888, +0.987301707), (-0.473621607, +0.879487634), (+0.982446909, -0.424958110), (+0.877273202, +0.946827650), (+0.599318027, +0.547075629)
2023rweight = getUnifRand(1., 2., size(sample, dim, IK))
2024rweight
2025+1.34842634, +1.66167831, +1.85626805, +1.43410659, +1.33140016, +1.84539771, +1.59292006, +1.14236569, +1.31127191
2026var(:,0) = getVar(sample, 2_IK, rweight)
2027var(:,0) ! reference
2028+0.459440827, +0.542389929, +0.674313724
2029do isam = 1, nsam
2030 var(:,isam) = getVar(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2031 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
2032end do
2033call setVarMerged(varMerged, var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2034varMerged
2035+0.459440857, +0.542389929, +0.674313784
2036call setVarMerged(var(:,2), var(:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
2037var(:,2)
2038+0.459440857, +0.542389929, +0.674313784
2039var(:,0) ! reference
2040+0.459440827, +0.542389929, +0.674313724
2041
2042
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 8705 of file pm_sampleVar.F90.


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