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

Generate and return the (weighted) merged mean of a sample resulting from the merger of two separate (weighted) samples \(A\) and \(B\).
More...

Detailed Description

Generate and return the (weighted) merged mean of a sample resulting from the merger of two separate (weighted) samples \(A\) and \(B\).

See the documentation of pm_sampelMean for more information and definition online updating of sample mean.

Parameters
[in]meanB: The input object of the same type and kind and rank and shape as the input argument meanA, containing the mean of the second sample that must be merged with the first sample.
[in]meanA: The input scalar or contiguous vector of shape (1:ndim) of,
  1. type complex of kind any supported by the processor (e.g., CK, CK32, CK64, or CK128),
  2. type real of kind any supported by the processor (e.g., RK, RK32, RK64, or RK128),
containing the mean of the first sample.
[in]fracA: The input scalar of type real of the same kind as kind of meanA, 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)).
Returns
meanMerged : The output object of the same type and kind and rank and shape as meanA, containing the mean of the sample resulting form the merger of the two samples.


Possible calling interfaces

! univariate sample.
meanMerged = getMeanMerged(meanB, meanA, fracA)
! ndim-dimensional sample.
meanMerged(1:ndim) = getMeanMerged(meanB(1:ndim), meanA(1:ndim), fracA)
Generate and return the (weighted) merged mean of a sample resulting from the merger of two separate ...
This module contains classes and procedures for computing the first moment (i.e., the statistical mea...
Warning
The condition 0 < fracA .and. fracA < 1 must hold for the corresponding input arguments.
The condition size(meanB) == size(meanA) 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


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_sampleMean, only: getMean
9 use pm_distUnif, only: getUnifRand
10 use pm_arrayRange, only: getRange
11 use pm_io, only: display_type
12
13 implicit none
14
15 integer(IK) , parameter :: nsam = 2
16 integer(IK) , allocatable :: iweight(:)
17 integer(IK) :: isam, ndim, lb(nsam), ub(nsam)
18 integer(IK) :: dim, itry, ntry = 10
19 type(display_type) :: disp
20 disp = display_type(file = "main.out.F90")
21
22 call disp%skip()
23 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
24 call disp%show("!Compute the merged mean of a univariate sample.")
25 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
26 call disp%skip()
27
28 block
29 real(TKG) :: mean(0:nsam), meanMerged
30 real(TKG), allocatable :: sample(:)
31 do itry = 1, ntry
32 call disp%skip()
33 call disp%show("lb(1) = 1; ub(1) = getUnifRand(1, 7)")
34 lb(1) = 1; ub(1) = getUnifRand(1, 7)
35 call disp%show("do isam = 2, nsam")
36 call disp%show(" lb(isam) = ub(isam - 1) + 1")
37 call disp%show(" ub(isam) = ub(isam - 1) + getUnifRand(1, 7)")
38 call disp%show("end do")
39 do isam = 2, nsam
40 lb(isam) = ub(isam - 1) + 1
41 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
42 end do
43 call disp%show("lb")
44 call disp%show( lb )
45 call disp%show("ub")
46 call disp%show( ub )
47 call disp%show("sample = getUnifRand(0., 1., ub(nsam))")
48 sample = getUnifRand(0., 1., ub(nsam))
49 call disp%show("sample")
50 call disp%show( sample )
51 call disp%show("mean(0) = getMean(sample)")
52 mean(0) = getMean(sample)
53 call disp%show("mean(0) ! reference")
54 call disp%show( mean(0) )
55 call disp%show("do isam = 1, nsam")
56 call disp%show(" mean(isam) = getMean(sample(lb(isam):ub(isam)))")
57 call disp%show("end do")
58 do isam = 1, nsam
59 mean(isam) = getMean(sample(lb(isam):ub(isam)))
60 end do
61 call disp%show("call setMeanMerged(meanMerged, mean(2), mean(1), ub(1) / real(ub(2), TKG))")
62 call setMeanMerged(meanMerged, mean(2), mean(1), ub(1) / real(ub(2), TKG))
63 call disp%show("meanMerged")
64 call disp%show( meanMerged )
65 call disp%show("call setMeanMerged(mean(2), mean(1), ub(1) / real(ub(2), TKG))")
66 call setMeanMerged(mean(2), mean(1), ub(1) / real(ub(2), TKG))
67 call disp%show("mean(2)")
68 call disp%show( mean(2) )
69 call disp%show("mean(0) ! reference")
70 call disp%show( mean(0) )
71 call disp%skip()
72 end do
73 end block
74
75 call disp%skip()
76 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
77 call disp%show("!Compute the merged mean of a frequency weighted univariate sample.")
78 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
79 call disp%skip()
80
81 block
82 real(TKG) :: mean(0:nsam), meanMerged
83 real(TKG), allocatable :: sample(:)
84 do itry = 1, ntry
85 call disp%skip()
86 call disp%show("lb(1) = 1; ub(1) = getUnifRand(1, 7)")
87 lb(1) = 1; ub(1) = getUnifRand(1, 7)
88 call disp%show("do isam = 2, nsam")
89 call disp%show(" lb(isam) = ub(isam - 1) + 1")
90 call disp%show(" ub(isam) = ub(isam - 1) + getUnifRand(1, 7)")
91 call disp%show("end do")
92 do isam = 2, nsam
93 lb(isam) = ub(isam - 1) + 1
94 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
95 end do
96 call disp%show("lb")
97 call disp%show( lb )
98 call disp%show("ub")
99 call disp%show( ub )
100 call disp%show("sample = getUnifRand(0., 1., ub(nsam))")
101 sample = getUnifRand(0., 1., ub(nsam))
102 call disp%show("sample")
103 call disp%show( sample )
104 call disp%show("iweight = getUnifRand(1, 10, size(sample, 1, IK))")
105 iweight = getUnifRand(1, 10, size(sample, 1, IK))
106 call disp%show("iweight")
107 call disp%show( iweight )
108 call disp%show("mean(0) = getMean(sample, iweight)")
109 mean(0) = getMean(sample, iweight)
110 call disp%show("mean(0) ! reference")
111 call disp%show( mean(0) )
112 call disp%show("do isam = 1, nsam")
113 call disp%show(" mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))")
114 call disp%show("end do")
115 do isam = 1, nsam
116 mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
117 end do
118 call disp%show("call setMeanMerged(meanMerged, mean(2), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))")
119 call setMeanMerged(meanMerged, mean(2), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
120 call disp%show("meanMerged")
121 call disp%show( meanMerged )
122 call disp%show("call setMeanMerged(mean(2), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))")
123 call setMeanMerged(mean(2), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
124 call disp%show("mean(2)")
125 call disp%show( mean(2) )
126 call disp%show("mean(0) ! reference")
127 call disp%show( mean(0) )
128 call disp%skip()
129 end do
130 end block
131
132 call disp%skip()
133 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
134 call disp%show("!Compute the merged mean of a reliability weighted univariate sample.")
135 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
136 call disp%skip()
137
138 block
139 real(TKG) :: mean(0:nsam), meanMerged
140 real(TKG), allocatable :: sample(:)
141 real(TKG), allocatable :: rweight(:)
142 do itry = 1, ntry
143 call disp%skip()
144 call disp%show("lb(1) = 1; ub(1) = getUnifRand(1, 7)")
145 lb(1) = 1; ub(1) = getUnifRand(1, 7)
146 call disp%show("do isam = 2, nsam")
147 call disp%show(" lb(isam) = ub(isam - 1) + 1")
148 call disp%show(" ub(isam) = ub(isam - 1) + getUnifRand(1, 7)")
149 call disp%show("end do")
150 do isam = 2, nsam
151 lb(isam) = ub(isam - 1) + 1
152 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
153 end do
154 call disp%show("lb")
155 call disp%show( lb )
156 call disp%show("ub")
157 call disp%show( ub )
158 call disp%show("sample = getUnifRand(0., 1., ub(nsam))")
159 sample = getUnifRand(0., 1., ub(nsam))
160 call disp%show("sample")
161 call disp%show( sample )
162 call disp%show("rweight = getUnifRand(1., 2., size(sample, 1, IK))")
163 rweight = getUnifRand(1., 2., size(sample, 1, IK))
164 call disp%show("rweight")
165 call disp%show( rweight )
166 call disp%show("mean(0) = getMean(sample, rweight)")
167 mean(0) = getMean(sample, rweight)
168 call disp%show("mean(0) ! reference")
169 call disp%show( mean(0) )
170 call disp%show("do isam = 1, nsam")
171 call disp%show(" mean(isam) = getMean(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))")
172 call disp%show("end do")
173 do isam = 1, nsam
174 mean(isam) = getMean(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
175 end do
176 call disp%show("call setMeanMerged(meanMerged, mean(2), mean(1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))")
177 call setMeanMerged(meanMerged, mean(2), mean(1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
178 call disp%show("meanMerged")
179 call disp%show( meanMerged )
180 call disp%show("call setMeanMerged(mean(2), mean(1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))")
181 call setMeanMerged(mean(2), mean(1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
182 call disp%show("mean(2)")
183 call disp%show( mean(2) )
184 call disp%show("mean(0) ! reference")
185 call disp%show( mean(0) )
186 call disp%skip()
187 end do
188 end block
189
190 call disp%skip()
191 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
192 call disp%show("!Compute the merged mean of a multivariate sample.")
193 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
194 call disp%skip()
195
196 block
197 real(TKG), allocatable :: mean(:,:), meanMerged(:)
198 real(TKG), allocatable :: sample(:,:)
199 do itry = 1, ntry
200 call disp%skip()
201 call disp%show("dim = 2; lb(1) = 1; ub(1) = getUnifRand(1, 7)")
202 dim = 2; lb(1) = 1; ub(1) = getUnifRand(1, 7)
203 call disp%show("do isam = 2, nsam")
204 call disp%show(" lb(isam) = ub(isam - 1) + 1")
205 call disp%show(" ub(isam) = ub(isam - 1) + getUnifRand(1, 7)")
206 call disp%show("end do")
207 do isam = 2, nsam
208 lb(isam) = ub(isam - 1) + 1
209 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
210 end do
211 call disp%show("lb")
212 call disp%show( lb )
213 call disp%show("ub")
214 call disp%show( ub )
215 call disp%show("ndim = getUnifRand(1, minval(ub - lb + 1, 1))")
216 ndim = getUnifRand(1, minval(ub - lb + 1, 1))
217 call disp%show("call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])")
218 call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
219 call disp%show("call setResized(meanMerged, ndim)")
220 call setResized(meanMerged, ndim)
221 call disp%show("sample = getUnifRand(-1., +1., ndim, ub(nsam))")
222 sample = getUnifRand(-1., +1., ndim, ub(nsam))
223 call disp%show("sample")
224 call disp%show( sample )
225 call disp%show("mean(:,0) = getMean(sample, dim)")
226 mean(:,0) = getMean(sample, dim)
227 call disp%show("mean(:,0) ! reference")
228 call disp%show( mean(:,0) )
229 call disp%show("do isam = 1, nsam")
230 call disp%show(" mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)")
231 call disp%show("end do")
232 do isam = 1, nsam
233 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
234 end do
235 call disp%show("call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))")
236 call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
237 call disp%show("meanMerged")
238 call disp%show( meanMerged )
239 call disp%show("call setMeanMerged(mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))")
240 call setMeanMerged(mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
241 call disp%show("mean(:,2)")
242 call disp%show( mean(:,2) )
243 call disp%show("mean(:,0) ! reference")
244 call disp%show( mean(:,0) )
245 call disp%skip()
246 end do
247 end block
248
249 call disp%skip()
250 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
251 call disp%show("!Compute the merged mean of a frequency weighted multivariate sample.")
252 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
253 call disp%skip()
254
255 block
256 real(TKG), allocatable :: mean(:,:), meanMerged(:)
257 real(TKG), allocatable :: sample(:,:)
258 do itry = 1, ntry
259 call disp%skip()
260 call disp%show("dim = 2; lb(1) = 1; ub(1) = getUnifRand(1, 7)")
261 dim = 2; lb(1) = 1; ub(1) = getUnifRand(1, 7)
262 call disp%show("do isam = 2, nsam")
263 call disp%show(" lb(isam) = ub(isam - 1) + 1")
264 call disp%show(" ub(isam) = ub(isam - 1) + getUnifRand(1, 7)")
265 call disp%show("end do")
266 do isam = 2, nsam
267 lb(isam) = ub(isam - 1) + 1
268 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
269 end do
270 call disp%show("lb")
271 call disp%show( lb )
272 call disp%show("ub")
273 call disp%show( ub )
274 call disp%show("ndim = getUnifRand(1, minval(ub - lb + 1, 1))")
275 ndim = getUnifRand(1, minval(ub - lb + 1, 1))
276 call disp%show("call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])")
277 call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
278 call disp%show("call setResized(meanMerged, ndim)")
279 call setResized(meanMerged, ndim)
280 call disp%show("sample = getUnifRand(-1., +1., ndim, ub(nsam))")
281 sample = getUnifRand(-1., +1., ndim, ub(nsam))
282 call disp%show("sample")
283 call disp%show( sample )
284 call disp%show("iweight = getUnifRand(1, 10, size(sample, dim, IK))")
285 iweight = getUnifRand(1, 10, size(sample, dim, IK))
286 call disp%show("iweight")
287 call disp%show( iweight )
288 call disp%show("mean(:,0) = getMean(sample, 2_IK, iweight)")
289 mean(:,0) = getMean(sample, 2_IK, iweight)
290 call disp%show("mean(:,0) ! reference")
291 call disp%show( mean(:,0) )
292 call disp%show("do isam = 1, nsam")
293 call disp%show(" mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))")
294 call disp%show("end do")
295 do isam = 1, nsam
296 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
297 end do
298 call disp%show("call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))")
299 call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
300 call disp%show("meanMerged")
301 call disp%show( meanMerged )
302 call disp%show("call setMeanMerged(mean(:,2), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))")
303 call setMeanMerged(mean(:,2), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
304 call disp%show("mean(:,2)")
305 call disp%show( mean(:,2) )
306 call disp%show("mean(:,0) ! reference")
307 call disp%show( mean(:,0) )
308 call disp%skip()
309 end do
310 end block
311
312 call disp%skip()
313 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
314 call disp%show("!Compute the merged mean of a reliability weighted multivariate sample.")
315 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
316 call disp%skip()
317
318 block
319 real(TKG), allocatable :: mean(:,:), meanMerged(:)
320 real(TKG), allocatable :: sample(:,:)
321 real(TKG), allocatable :: rweight(:)
322 do itry = 1, ntry
323 call disp%skip()
324 call disp%show("lb(1) = 1; ub(1) = getUnifRand(1, 7)")
325 lb(1) = 1; ub(1) = getUnifRand(1, 7)
326 call disp%show("do isam = 2, nsam")
327 call disp%show(" lb(isam) = ub(isam - 1) + 1")
328 call disp%show(" ub(isam) = ub(isam - 1) + getUnifRand(1, 7)")
329 call disp%show("end do")
330 do isam = 2, nsam
331 lb(isam) = ub(isam - 1) + 1
332 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
333 end do
334 call disp%show("lb")
335 call disp%show( lb )
336 call disp%show("ub")
337 call disp%show( ub )
338 call disp%show("ndim = getUnifRand(1, minval(ub - lb + 1, 1))")
339 ndim = getUnifRand(1, minval(ub - lb + 1, 1))
340 call disp%show("call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])")
341 call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
342 call disp%show("call setResized(meanMerged, ndim)")
343 call setResized(meanMerged, ndim)
344 call disp%show("sample = getUnifRand(-1., +1., ndim, ub(nsam))")
345 sample = getUnifRand(-1., +1., ndim, ub(nsam))
346 call disp%show("sample")
347 call disp%show( sample )
348 call disp%show("rweight = getUnifRand(1, 10, size(sample, dim, IK))")
349 rweight = getUnifRand(1, 10, size(sample, dim, IK))
350 call disp%show("rweight")
351 call disp%show( rweight )
352 call disp%show("mean(:,0) = getMean(sample, dim, rweight)")
353 mean(:,0) = getMean(sample, dim, rweight)
354 call disp%show("mean(:,0) ! reference")
355 call disp%show( mean(:,0) )
356 call disp%show("do isam = 1, nsam")
357 call disp%show(" mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, rweight(lb(isam):ub(isam)))")
358 call disp%show("end do")
359 do isam = 1, nsam
360 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, rweight(lb(isam):ub(isam)))
361 end do
362 call disp%show("call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))")
363 call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
364 call disp%show("meanMerged")
365 call disp%show( meanMerged )
366 call disp%show("call setMeanMerged(mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))")
367 call setMeanMerged(mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
368 call disp%show("mean(:,2)")
369 call disp%show( mean(:,2) )
370 call disp%show("mean(:,0) ! reference")
371 call disp%show( mean(:,0) )
372 call disp%skip()
373 end do
374 end block
375
376end 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...
Return the (weighted) merged mean of a sample resulting from the merger of two separate (weighted) sa...
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
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 merged mean of a univariate sample.
4!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5
6
7lb(1) = 1; ub(1) = getUnifRand(1, 7)
8do isam = 2, nsam
9 lb(isam) = ub(isam - 1) + 1
10 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
11end do
12lb
13+1, +8
14ub
15+7, +12
16sample = getUnifRand(0., 1., ub(nsam))
17sample
18+0.837064385E-1, +0.865662515, +0.604912996, +0.987767577, +0.808076859, +0.420660377E-1, +0.615481853, +0.171317279, +0.608474791, +0.967244923, +0.774139166, +0.449676991
19mean(0) = getMean(sample)
20mean(0) ! reference
21+0.581543982
22do isam = 1, nsam
23 mean(isam) = getMean(sample(lb(isam):ub(isam)))
24end do
25call setMeanMerged(meanMerged, mean(2), mean(1), ub(1) / real(ub(2), TKG))
26meanMerged
27+0.581543922
28call setMeanMerged(mean(2), mean(1), ub(1) / real(ub(2), TKG))
29mean(2)
30+0.581543922
31mean(0) ! reference
32+0.581543982
33
34
35lb(1) = 1; ub(1) = getUnifRand(1, 7)
36do isam = 2, nsam
37 lb(isam) = ub(isam - 1) + 1
38 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
39end do
40lb
41+1, +8
42ub
43+7, +9
44sample = getUnifRand(0., 1., ub(nsam))
45sample
46+0.307510614, +0.916713059, +0.689479470, +0.964866877, +0.314298034, +0.288778186, +0.599537611, +0.967559099, +0.834389687
47mean(0) = getMean(sample)
48mean(0) ! reference
49+0.653681457
50do isam = 1, nsam
51 mean(isam) = getMean(sample(lb(isam):ub(isam)))
52end do
53call setMeanMerged(meanMerged, mean(2), mean(1), ub(1) / real(ub(2), TKG))
54meanMerged
55+0.653681457
56call setMeanMerged(mean(2), mean(1), ub(1) / real(ub(2), TKG))
57mean(2)
58+0.653681457
59mean(0) ! reference
60+0.653681457
61
62
63lb(1) = 1; ub(1) = getUnifRand(1, 7)
64do isam = 2, nsam
65 lb(isam) = ub(isam - 1) + 1
66 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
67end do
68lb
69+1, +3
70ub
71+2, +3
72sample = getUnifRand(0., 1., ub(nsam))
73sample
74+0.137246788, +0.751488745, +0.699134231
75mean(0) = getMean(sample)
76mean(0) ! reference
77+0.529289901
78do isam = 1, nsam
79 mean(isam) = getMean(sample(lb(isam):ub(isam)))
80end do
81call setMeanMerged(meanMerged, mean(2), mean(1), ub(1) / real(ub(2), TKG))
82meanMerged
83+0.529289901
84call setMeanMerged(mean(2), mean(1), ub(1) / real(ub(2), TKG))
85mean(2)
86+0.529289901
87mean(0) ! reference
88+0.529289901
89
90
91lb(1) = 1; ub(1) = getUnifRand(1, 7)
92do isam = 2, nsam
93 lb(isam) = ub(isam - 1) + 1
94 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
95end do
96lb
97+1, +6
98ub
99+5, +7
100sample = getUnifRand(0., 1., ub(nsam))
101sample
102+0.741233945, +0.996601582, +0.582655370, +0.658535838, +0.135546148, +0.310473323, +0.922929704
103mean(0) = getMean(sample)
104mean(0) ! reference
105+0.621139467
106do isam = 1, nsam
107 mean(isam) = getMean(sample(lb(isam):ub(isam)))
108end do
109call setMeanMerged(meanMerged, mean(2), mean(1), ub(1) / real(ub(2), TKG))
110meanMerged
111+0.621139407
112call setMeanMerged(mean(2), mean(1), ub(1) / real(ub(2), TKG))
113mean(2)
114+0.621139407
115mean(0) ! reference
116+0.621139467
117
118
119lb(1) = 1; ub(1) = getUnifRand(1, 7)
120do isam = 2, nsam
121 lb(isam) = ub(isam - 1) + 1
122 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
123end do
124lb
125+1, +5
126ub
127+4, +8
128sample = getUnifRand(0., 1., ub(nsam))
129sample
130+0.635582447, +0.967975497, +0.525067806, +0.369005561, +0.929990470, +0.620028973E-1, +0.516469538, +0.620910406
131mean(0) = getMean(sample)
132mean(0) ! reference
133+0.578375578
134do isam = 1, nsam
135 mean(isam) = getMean(sample(lb(isam):ub(isam)))
136end do
137call setMeanMerged(meanMerged, mean(2), mean(1), ub(1) / real(ub(2), TKG))
138meanMerged
139+0.578375578
140call setMeanMerged(mean(2), mean(1), ub(1) / real(ub(2), TKG))
141mean(2)
142+0.578375578
143mean(0) ! reference
144+0.578375578
145
146
147lb(1) = 1; ub(1) = getUnifRand(1, 7)
148do isam = 2, nsam
149 lb(isam) = ub(isam - 1) + 1
150 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
151end do
152lb
153+1, +5
154ub
155+4, +10
156sample = getUnifRand(0., 1., ub(nsam))
157sample
158+0.680564106, +0.557573080, +0.567794979, +0.315788269, +0.482635140, +0.290346384, +0.892090559, +0.681387901, +0.449858785, +0.501704633
159mean(0) = getMean(sample)
160mean(0) ! reference
161+0.541974425
162do isam = 1, nsam
163 mean(isam) = getMean(sample(lb(isam):ub(isam)))
164end do
165call setMeanMerged(meanMerged, mean(2), mean(1), ub(1) / real(ub(2), TKG))
166meanMerged
167+0.541974425
168call setMeanMerged(mean(2), mean(1), ub(1) / real(ub(2), TKG))
169mean(2)
170+0.541974425
171mean(0) ! reference
172+0.541974425
173
174
175lb(1) = 1; ub(1) = getUnifRand(1, 7)
176do isam = 2, nsam
177 lb(isam) = ub(isam - 1) + 1
178 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
179end do
180lb
181+1, +2
182ub
183+1, +7
184sample = getUnifRand(0., 1., ub(nsam))
185sample
186+0.798053265, +0.317064822, +0.660533905E-1, +0.323922753, +0.527049899E-1, +0.301640630, +0.517327368
187mean(0) = getMean(sample)
188mean(0) ! reference
189+0.339538157
190do isam = 1, nsam
191 mean(isam) = getMean(sample(lb(isam):ub(isam)))
192end do
193call setMeanMerged(meanMerged, mean(2), mean(1), ub(1) / real(ub(2), TKG))
194meanMerged
195+0.339538187
196call setMeanMerged(mean(2), mean(1), ub(1) / real(ub(2), TKG))
197mean(2)
198+0.339538187
199mean(0) ! reference
200+0.339538157
201
202
203lb(1) = 1; ub(1) = getUnifRand(1, 7)
204do isam = 2, nsam
205 lb(isam) = ub(isam - 1) + 1
206 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
207end do
208lb
209+1, +2
210ub
211+1, +4
212sample = getUnifRand(0., 1., ub(nsam))
213sample
214+0.353235006, +0.482374251, +0.249002993, +0.528630197
215mean(0) = getMean(sample)
216mean(0) ! reference
217+0.403310597
218do isam = 1, nsam
219 mean(isam) = getMean(sample(lb(isam):ub(isam)))
220end do
221call setMeanMerged(meanMerged, mean(2), mean(1), ub(1) / real(ub(2), TKG))
222meanMerged
223+0.403310597
224call setMeanMerged(mean(2), mean(1), ub(1) / real(ub(2), TKG))
225mean(2)
226+0.403310597
227mean(0) ! reference
228+0.403310597
229
230
231lb(1) = 1; ub(1) = getUnifRand(1, 7)
232do isam = 2, nsam
233 lb(isam) = ub(isam - 1) + 1
234 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
235end do
236lb
237+1, +4
238ub
239+3, +4
240sample = getUnifRand(0., 1., ub(nsam))
241sample
242+0.475852013, +0.970653474, +0.425833881, +0.109913766
243mean(0) = getMean(sample)
244mean(0) ! reference
245+0.495563328
246do isam = 1, nsam
247 mean(isam) = getMean(sample(lb(isam):ub(isam)))
248end do
249call setMeanMerged(meanMerged, mean(2), mean(1), ub(1) / real(ub(2), TKG))
250meanMerged
251+0.495563328
252call setMeanMerged(mean(2), mean(1), ub(1) / real(ub(2), TKG))
253mean(2)
254+0.495563328
255mean(0) ! reference
256+0.495563328
257
258
259lb(1) = 1; ub(1) = getUnifRand(1, 7)
260do isam = 2, nsam
261 lb(isam) = ub(isam - 1) + 1
262 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
263end do
264lb
265+1, +7
266ub
267+6, +10
268sample = getUnifRand(0., 1., ub(nsam))
269sample
270+0.888816833, +0.364358544, +0.116386950, +0.606004477, +0.859154940, +0.897016525E-1, +0.587547421, +0.641957462, +0.323110402, +0.741591275
271mean(0) = getMean(sample)
272mean(0) ! reference
273+0.521863043
274do isam = 1, nsam
275 mean(isam) = getMean(sample(lb(isam):ub(isam)))
276end do
277call setMeanMerged(meanMerged, mean(2), mean(1), ub(1) / real(ub(2), TKG))
278meanMerged
279+0.521862984
280call setMeanMerged(mean(2), mean(1), ub(1) / real(ub(2), TKG))
281mean(2)
282+0.521862984
283mean(0) ! reference
284+0.521863043
285
286
287!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
288!Compute the merged mean of a frequency weighted univariate sample.
289!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
290
291
292lb(1) = 1; ub(1) = getUnifRand(1, 7)
293do isam = 2, nsam
294 lb(isam) = ub(isam - 1) + 1
295 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
296end do
297lb
298+1, +2
299ub
300+1, +5
301sample = getUnifRand(0., 1., ub(nsam))
302sample
303+0.529742837, +0.130858898, +0.102629840, +0.707129061, +0.602123022
304iweight = getUnifRand(1, 10, size(sample, 1, IK))
305iweight
306+10, +8, +7, +6, +6
307mean(0) = getMean(sample, iweight)
308mean(0) ! reference
309+0.403195143
310do isam = 1, nsam
311 mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
312end do
313call setMeanMerged(meanMerged, mean(2), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
314meanMerged
315+0.403195202
316call setMeanMerged(mean(2), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
317mean(2)
318+0.403195202
319mean(0) ! reference
320+0.403195143
321
322
323lb(1) = 1; ub(1) = getUnifRand(1, 7)
324do isam = 2, nsam
325 lb(isam) = ub(isam - 1) + 1
326 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
327end do
328lb
329+1, +8
330ub
331+7, +9
332sample = getUnifRand(0., 1., ub(nsam))
333sample
334+0.260408521E-1, +0.347227991, +0.558650494E-2, +0.198853672, +0.143130064, +0.783467233, +0.195628881, +0.646918058, +0.707936347
335iweight = getUnifRand(1, 10, size(sample, 1, IK))
336iweight
337+3, +7, +9, +2, +1, +5, +1, +10, +3
338mean(0) = getMean(sample, iweight)
339mean(0) ! reference
340+0.385507047
341do isam = 1, nsam
342 mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
343end do
344call setMeanMerged(meanMerged, mean(2), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
345meanMerged
346+0.385507077
347call setMeanMerged(mean(2), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
348mean(2)
349+0.385507077
350mean(0) ! reference
351+0.385507047
352
353
354lb(1) = 1; ub(1) = getUnifRand(1, 7)
355do isam = 2, nsam
356 lb(isam) = ub(isam - 1) + 1
357 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
358end do
359lb
360+1, +8
361ub
362+7, +14
363sample = getUnifRand(0., 1., ub(nsam))
364sample
365+0.785254359, +0.820207000E-1, +0.477351427, +0.348224461, +0.752947748, +0.151536286, +0.290185213E-2, +0.465423286, +0.262132049, +0.999331772, +0.989185035, +0.190662980, +0.270816028, +0.735470116
366iweight = getUnifRand(1, 10, size(sample, 1, IK))
367iweight
368+6, +9, +3, +6, +8, +8, +5, +10, +10, +6, +10, +10, +8, +6
369mean(0) = getMean(sample, iweight)
370mean(0) ! reference
371+0.455913067
372do isam = 1, nsam
373 mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
374end do
375call setMeanMerged(meanMerged, mean(2), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
376meanMerged
377+0.455913007
378call setMeanMerged(mean(2), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
379mean(2)
380+0.455913007
381mean(0) ! reference
382+0.455913067
383
384
385lb(1) = 1; ub(1) = getUnifRand(1, 7)
386do isam = 2, nsam
387 lb(isam) = ub(isam - 1) + 1
388 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
389end do
390lb
391+1, +3
392ub
393+2, +7
394sample = getUnifRand(0., 1., ub(nsam))
395sample
396+0.405363321, +0.219169080, +0.115935206, +0.893036604, +0.439766109, +0.314403594, +0.194016397
397iweight = getUnifRand(1, 10, size(sample, 1, IK))
398iweight
399+7, +8, +5, +6, +10, +3, +9
400mean(0) = getMean(sample, iweight)
401mean(0) ! reference
402+0.366996050
403do isam = 1, nsam
404 mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
405end do
406call setMeanMerged(meanMerged, mean(2), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
407meanMerged
408+0.366996080
409call setMeanMerged(mean(2), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
410mean(2)
411+0.366996080
412mean(0) ! reference
413+0.366996050
414
415
416lb(1) = 1; ub(1) = getUnifRand(1, 7)
417do isam = 2, nsam
418 lb(isam) = ub(isam - 1) + 1
419 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
420end do
421lb
422+1, +7
423ub
424+6, +8
425sample = getUnifRand(0., 1., ub(nsam))
426sample
427+0.543904245, +0.536824882, +0.624632776, +0.273061454, +0.563830137, +0.722926855, +0.530096948, +0.546086192
428iweight = getUnifRand(1, 10, size(sample, 1, IK))
429iweight
430+4, +8, +2, +6, +8, +5, +9, +9
431mean(0) = getMean(sample, iweight)
432mean(0) ! reference
433+0.532721043
434do isam = 1, nsam
435 mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
436end do
437call setMeanMerged(meanMerged, mean(2), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
438meanMerged
439+0.532721043
440call setMeanMerged(mean(2), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
441mean(2)
442+0.532721043
443mean(0) ! reference
444+0.532721043
445
446
447lb(1) = 1; ub(1) = getUnifRand(1, 7)
448do isam = 2, nsam
449 lb(isam) = ub(isam - 1) + 1
450 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
451end do
452lb
453+1, +5
454ub
455+4, +11
456sample = getUnifRand(0., 1., ub(nsam))
457sample
458+0.986591578E-1, +0.672768056, +0.332717836, +0.497435331, +0.283148646, +0.489416480, +0.539978087, +0.864925265, +0.137926459, +0.385177195, +0.163597465
459iweight = getUnifRand(1, 10, size(sample, 1, IK))
460iweight
461+6, +4, +6, +10, +4, +5, +9, +7, +9, +7, +1
462mean(0) = getMean(sample, iweight)
463mean(0) ! reference
464+0.424247354
465do isam = 1, nsam
466 mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
467end do
468call setMeanMerged(meanMerged, mean(2), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
469meanMerged
470+0.424247324
471call setMeanMerged(mean(2), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
472mean(2)
473+0.424247324
474mean(0) ! reference
475+0.424247354
476
477
478lb(1) = 1; ub(1) = getUnifRand(1, 7)
479do isam = 2, nsam
480 lb(isam) = ub(isam - 1) + 1
481 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
482end do
483lb
484+1, +5
485ub
486+4, +9
487sample = getUnifRand(0., 1., ub(nsam))
488sample
489+0.851982236, +0.604985714, +0.529631197, +0.241665244E-1, +0.145293057, +0.786244810, +0.445813179, +0.975437880, +0.242908597E-1
490iweight = getUnifRand(1, 10, size(sample, 1, IK))
491iweight
492+8, +8, +2, +1, +2, +5, +9, +2, +10
493mean(0) = getMean(sample, iweight)
494mean(0) ! reference
495+0.492916703
496do isam = 1, nsam
497 mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
498end do
499call setMeanMerged(meanMerged, mean(2), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
500meanMerged
501+0.492916733
502call setMeanMerged(mean(2), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
503mean(2)
504+0.492916733
505mean(0) ! reference
506+0.492916703
507
508
509lb(1) = 1; ub(1) = getUnifRand(1, 7)
510do isam = 2, nsam
511 lb(isam) = ub(isam - 1) + 1
512 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
513end do
514lb
515+1, +7
516ub
517+6, +12
518sample = getUnifRand(0., 1., ub(nsam))
519sample
520+0.583229065E-1, +0.575166941E-1, +0.716952503, +0.137142956, +0.655535400, +0.125600100E-1, +0.656503439E-2, +0.333086848E-1, +0.889003873E-1, +0.132159591E-1, +0.226697683, +0.531509221
521iweight = getUnifRand(1, 10, size(sample, 1, IK))
522iweight
523+2, +1, +7, +1, +5, +4, +7, +10, +3, +9, +4, +9
524mean(0) = getMean(sample, iweight)
525mean(0) ! reference
526+0.243757278
527do isam = 1, nsam
528 mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
529end do
530call setMeanMerged(meanMerged, mean(2), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
531meanMerged
532+0.243757278
533call setMeanMerged(mean(2), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
534mean(2)
535+0.243757278
536mean(0) ! reference
537+0.243757278
538
539
540lb(1) = 1; ub(1) = getUnifRand(1, 7)
541do isam = 2, nsam
542 lb(isam) = ub(isam - 1) + 1
543 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
544end do
545lb
546+1, +6
547ub
548+5, +11
549sample = getUnifRand(0., 1., ub(nsam))
550sample
551+0.138380885, +0.209199190E-1, +0.565273046, +0.583635688, +0.390628874, +0.219504833E-1, +0.468839109, +0.373739839, +0.368111551, +0.729558706, +0.556981027
552iweight = getUnifRand(1, 10, size(sample, 1, IK))
553iweight
554+2, +8, +5, +5, +3, +7, +5, +7, +10, +3, +4
555mean(0) = getMean(sample, iweight)
556mean(0) ! reference
557+0.348683000
558do isam = 1, nsam
559 mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
560end do
561call setMeanMerged(meanMerged, mean(2), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
562meanMerged
563+0.348682970
564call setMeanMerged(mean(2), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
565mean(2)
566+0.348682970
567mean(0) ! reference
568+0.348683000
569
570
571lb(1) = 1; ub(1) = getUnifRand(1, 7)
572do isam = 2, nsam
573 lb(isam) = ub(isam - 1) + 1
574 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
575end do
576lb
577+1, +4
578ub
579+3, +8
580sample = getUnifRand(0., 1., ub(nsam))
581sample
582+0.367946565, +0.696588397, +0.831677556, +0.606933057, +0.410512149, +0.426655769, +0.618426621, +0.191297412
583iweight = getUnifRand(1, 10, size(sample, 1, IK))
584iweight
585+6, +6, +5, +6, +10, +10, +2, +3
586mean(0) = getMean(sample, iweight)
587mean(0) ! reference
588+0.507700384
589do isam = 1, nsam
590 mean(isam) = getMean(sample(lb(isam):ub(isam)), iweight(lb(isam):ub(isam)))
591end do
592call setMeanMerged(meanMerged, mean(2), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
593meanMerged
594+0.507700443
595call setMeanMerged(mean(2), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
596mean(2)
597+0.507700443
598mean(0) ! reference
599+0.507700384
600
601
602!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
603!Compute the merged mean of a reliability weighted univariate sample.
604!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
605
606
607lb(1) = 1; ub(1) = getUnifRand(1, 7)
608do isam = 2, nsam
609 lb(isam) = ub(isam - 1) + 1
610 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
611end do
612lb
613+1, +7
614ub
615+6, +13
616sample = getUnifRand(0., 1., ub(nsam))
617sample
618+0.816498518, +0.352314949, +0.991998017, +0.354984343, +0.192107677, +0.745750010, +0.174993217, +0.663691819, +0.957769454, +0.440409541, +0.706658185, +0.991626382, +0.618725419
619rweight = getUnifRand(1., 2., size(sample, 1, IK))
620rweight
621+1.10615659, +1.31994212, +1.33057630, +1.12381935, +1.73696411, +1.12447643, +1.59619319, +1.08428323, +1.72952819, +1.19373214, +1.60092497, +1.45448375, +1.48610151
622mean(0) = getMean(sample, rweight)
623mean(0) ! reference
624+0.611254156
625do isam = 1, nsam
626 mean(isam) = getMean(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
627end do
628call setMeanMerged(meanMerged, mean(2), mean(1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
629meanMerged
630+0.611254096
631call setMeanMerged(mean(2), mean(1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
632mean(2)
633+0.611254096
634mean(0) ! reference
635+0.611254156
636
637
638lb(1) = 1; ub(1) = getUnifRand(1, 7)
639do isam = 2, nsam
640 lb(isam) = ub(isam - 1) + 1
641 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
642end do
643lb
644+1, +7
645ub
646+6, +11
647sample = getUnifRand(0., 1., ub(nsam))
648sample
649+0.326949120, +0.130221248E-1, +0.106977284, +0.770356834, +0.121972203, +0.512139857, +0.970971167, +0.957111776, +0.728469968, +0.380789220, +0.182469606
650rweight = getUnifRand(1., 2., size(sample, 1, IK))
651rweight
652+1.62355685, +1.93732452, +1.14670908, +1.69368649, +1.12115264, +1.73624158, +1.10357189, +1.13573146, +1.82946932, +1.29178667, +1.17068994
653mean(0) = getMean(sample, rweight)
654mean(0) ! reference
655+0.456379592
656do isam = 1, nsam
657 mean(isam) = getMean(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
658end do
659call setMeanMerged(meanMerged, mean(2), mean(1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
660meanMerged
661+0.456379563
662call setMeanMerged(mean(2), mean(1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
663mean(2)
664+0.456379563
665mean(0) ! reference
666+0.456379592
667
668
669lb(1) = 1; ub(1) = getUnifRand(1, 7)
670do isam = 2, nsam
671 lb(isam) = ub(isam - 1) + 1
672 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
673end do
674lb
675+1, +8
676ub
677+7, +10
678sample = getUnifRand(0., 1., ub(nsam))
679sample
680+0.655874968, +0.962270319, +0.506555200, +0.862263620, +0.371947944, +0.833317459, +0.552777648, +0.291698337, +0.264723599, +0.209277868E-1
681rweight = getUnifRand(1., 2., size(sample, 1, IK))
682rweight
683+1.50784481, +1.02954125, +1.82419872, +1.47730899, +1.06776643, +1.21575379, +1.92876911, +1.69356465, +1.76809287, +1.22863412
684mean(0) = getMean(sample, rweight)
685mean(0) ! reference
686+0.518385231
687do isam = 1, nsam
688 mean(isam) = getMean(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
689end do
690call setMeanMerged(meanMerged, mean(2), mean(1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
691meanMerged
692+0.518385231
693call setMeanMerged(mean(2), mean(1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
694mean(2)
695+0.518385231
696mean(0) ! reference
697+0.518385231
698
699
700lb(1) = 1; ub(1) = getUnifRand(1, 7)
701do isam = 2, nsam
702 lb(isam) = ub(isam - 1) + 1
703 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
704end do
705lb
706+1, +8
707ub
708+7, +11
709sample = getUnifRand(0., 1., ub(nsam))
710sample
711+0.919640422, +0.621165693, +0.550987661, +0.852171898, +0.207468450, +0.964104354, +0.639110267, +0.925806761E-1, +0.229824901, +0.547481060, +0.425703585
712rweight = getUnifRand(1., 2., size(sample, 1, IK))
713rweight
714+1.91305947, +1.85918164, +1.85565436, +1.76868749, +1.45037031, +1.79018617, +1.72742712, +1.55930650, +1.53618312, +1.09344375, +1.09488678
715mean(0) = getMean(sample, rweight)
716mean(0) ! reference
717+0.574378610
718do isam = 1, nsam
719 mean(isam) = getMean(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
720end do
721call setMeanMerged(meanMerged, mean(2), mean(1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
722meanMerged
723+0.574378610
724call setMeanMerged(mean(2), mean(1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
725mean(2)
726+0.574378610
727mean(0) ! reference
728+0.574378610
729
730
731lb(1) = 1; ub(1) = getUnifRand(1, 7)
732do isam = 2, nsam
733 lb(isam) = ub(isam - 1) + 1
734 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
735end do
736lb
737+1, +2
738ub
739+1, +8
740sample = getUnifRand(0., 1., ub(nsam))
741sample
742+0.851543367, +0.269641161, +0.456869006E-1, +0.103891313, +0.930352211, +0.348196745, +0.356487036, +0.713034868
743rweight = getUnifRand(1., 2., size(sample, 1, IK))
744rweight
745+1.95857728, +1.87999690, +1.31009710, +1.73395562, +1.06590068, +1.13015723, +1.13934636, +1.00146794
746mean(0) = getMean(sample, rweight)
747mean(0) ! reference
748+0.438536465
749do isam = 1, nsam
750 mean(isam) = getMean(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
751end do
752call setMeanMerged(meanMerged, mean(2), mean(1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
753meanMerged
754+0.438536435
755call setMeanMerged(mean(2), mean(1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
756mean(2)
757+0.438536435
758mean(0) ! reference
759+0.438536465
760
761
762lb(1) = 1; ub(1) = getUnifRand(1, 7)
763do isam = 2, nsam
764 lb(isam) = ub(isam - 1) + 1
765 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
766end do
767lb
768+1, +6
769ub
770+5, +11
771sample = getUnifRand(0., 1., ub(nsam))
772sample
773+0.228947461, +0.619427204, +0.625623167, +0.399824381E-1, +0.911087275, +0.423422396, +0.177434921, +0.421735466, +0.830706000, +0.620913863, +0.392937958
774rweight = getUnifRand(1., 2., size(sample, 1, IK))
775rweight
776+1.99123216, +1.10332584, +1.43443394, +1.03051651, +1.72494531, +1.60555589, +1.19284260, +1.70435870, +1.27554202, +1.50471187, +1.50804222
777mean(0) = getMean(sample, rweight)
778mean(0) ! reference
779+0.488086849
780do isam = 1, nsam
781 mean(isam) = getMean(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
782end do
783call setMeanMerged(meanMerged, mean(2), mean(1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
784meanMerged
785+0.488086820
786call setMeanMerged(mean(2), mean(1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
787mean(2)
788+0.488086820
789mean(0) ! reference
790+0.488086849
791
792
793lb(1) = 1; ub(1) = getUnifRand(1, 7)
794do isam = 2, nsam
795 lb(isam) = ub(isam - 1) + 1
796 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
797end do
798lb
799+1, +5
800ub
801+4, +5
802sample = getUnifRand(0., 1., ub(nsam))
803sample
804+0.361727655, +0.243362188E-1, +0.565852106, +0.733707488, +0.362792492
805rweight = getUnifRand(1., 2., size(sample, 1, IK))
806rweight
807+1.57483029, +1.01873493, +1.18057227, +1.69469142, +1.19280517
808mean(0) = getMean(sample, rweight)
809mean(0) ! reference
810+0.441127419
811do isam = 1, nsam
812 mean(isam) = getMean(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
813end do
814call setMeanMerged(meanMerged, mean(2), mean(1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
815meanMerged
816+0.441127449
817call setMeanMerged(mean(2), mean(1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
818mean(2)
819+0.441127449
820mean(0) ! reference
821+0.441127419
822
823
824lb(1) = 1; ub(1) = getUnifRand(1, 7)
825do isam = 2, nsam
826 lb(isam) = ub(isam - 1) + 1
827 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
828end do
829lb
830+1, +2
831ub
832+1, +7
833sample = getUnifRand(0., 1., ub(nsam))
834sample
835+0.657419622, +0.284213781, +0.911882877, +0.794143260, +0.974766314, +0.244307816, +0.637444496
836rweight = getUnifRand(1., 2., size(sample, 1, IK))
837rweight
838+1.57890582, +1.90160871, +1.75071692, +1.57347023, +1.04846370, +1.92473733, +1.46339679
839mean(0) = getMean(sample, rweight)
840mean(0) ! reference
841+0.609319746
842do isam = 1, nsam
843 mean(isam) = getMean(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
844end do
845call setMeanMerged(meanMerged, mean(2), mean(1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
846meanMerged
847+0.609319746
848call setMeanMerged(mean(2), mean(1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
849mean(2)
850+0.609319746
851mean(0) ! reference
852+0.609319746
853
854
855lb(1) = 1; ub(1) = getUnifRand(1, 7)
856do isam = 2, nsam
857 lb(isam) = ub(isam - 1) + 1
858 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
859end do
860lb
861+1, +7
862ub
863+6, +9
864sample = getUnifRand(0., 1., ub(nsam))
865sample
866+0.454281151, +0.404440045, +0.253780544, +0.705505073, +0.427517593, +0.350642204E-1, +0.799993992, +0.907202721, +0.643802702
867rweight = getUnifRand(1., 2., size(sample, 1, IK))
868rweight
869+1.65689182, +1.61500561, +1.36019325, +1.97537029, +1.49237251, +1.76360774, +1.73595285, +1.12234354, +1.54058003
870mean(0) = getMean(sample, rweight)
871mean(0) ! reference
872+0.507864296
873do isam = 1, nsam
874 mean(isam) = getMean(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
875end do
876call setMeanMerged(meanMerged, mean(2), mean(1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
877meanMerged
878+0.507864237
879call setMeanMerged(mean(2), mean(1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
880mean(2)
881+0.507864237
882mean(0) ! reference
883+0.507864296
884
885
886lb(1) = 1; ub(1) = getUnifRand(1, 7)
887do isam = 2, nsam
888 lb(isam) = ub(isam - 1) + 1
889 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
890end do
891lb
892+1, +7
893ub
894+6, +10
895sample = getUnifRand(0., 1., ub(nsam))
896sample
897+0.898700655, +0.389996827, +0.182400644, +0.773691654, +0.933500290, +0.868889391, +0.368318439, +0.306130469, +0.401165426, +0.463283360
898rweight = getUnifRand(1., 2., size(sample, 1, IK))
899rweight
900+1.30116189, +1.90349972, +1.23029399, +1.58494437, +1.69477153, +1.20750022, +1.45630765, +1.13042092, +1.54378247, +1.18306780
901mean(0) = getMean(sample, rweight)
902mean(0) ! reference
903+0.565019906
904do isam = 1, nsam
905 mean(isam) = getMean(sample(lb(isam):ub(isam)), rweight(lb(isam):ub(isam)))
906end do
907call setMeanMerged(meanMerged, mean(2), mean(1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
908meanMerged
909+0.565019786
910call setMeanMerged(mean(2), mean(1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
911mean(2)
912+0.565019786
913mean(0) ! reference
914+0.565019906
915
916
917!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
918!Compute the merged mean of a multivariate sample.
919!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
920
921
922dim = 2; lb(1) = 1; ub(1) = getUnifRand(1, 7)
923do isam = 2, nsam
924 lb(isam) = ub(isam - 1) + 1
925 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
926end do
927lb
928+1, +5
929ub
930+4, +11
931ndim = getUnifRand(1, minval(ub - lb + 1, 1))
932call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
933call setResized(meanMerged, ndim)
934sample = getUnifRand(-1., +1., ndim, ub(nsam))
935sample
936+0.959194660, -0.710529685, +0.638371468, +0.130456686, +0.274960995E-1, +0.812045455, -0.338592768, +0.883860826, +0.388018250, -0.584110498, -0.262126207
937-0.465707183, +0.777554750, +0.751250982, -0.824425936, +0.479258895, -0.647910118, +0.106623173E-1, -0.133435369, -0.870394349, +0.995368719, +0.451290488
938+0.255483985, -0.489567876, -0.375812888, -0.681036592, +0.408239603, +0.948996782, -0.491009235, +0.308610797, +0.168108821, +0.321161270, +0.171044946
939+0.895979404E-1, -0.964433193, -0.528559685E-1, +0.748432040, -0.667501092, -0.652509093, +0.201177716, -0.334750772, +0.475425601, -0.821736693, -0.855085969
940mean(:,0) = getMean(sample, dim)
941mean(:,0) ! reference
942+0.176734924, +0.475921109E-1, +0.494745113E-1, -0.257658154
943do isam = 1, nsam
944 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
945end do
946call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
947meanMerged
948+0.176734939, +0.475921109E-1, +0.494745076E-1, -0.257658124
949call setMeanMerged(mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
950mean(:,2)
951+0.176734939, +0.475921109E-1, +0.494745076E-1, -0.257658124
952mean(:,0) ! reference
953+0.176734924, +0.475921109E-1, +0.494745113E-1, -0.257658154
954
955
956dim = 2; lb(1) = 1; ub(1) = getUnifRand(1, 7)
957do isam = 2, nsam
958 lb(isam) = ub(isam - 1) + 1
959 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
960end do
961lb
962+1, +2
963ub
964+1, +8
965ndim = getUnifRand(1, minval(ub - lb + 1, 1))
966call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
967call setResized(meanMerged, ndim)
968sample = getUnifRand(-1., +1., ndim, ub(nsam))
969sample
970-0.743360400, -0.412931442, -0.697110176, +0.620756149E-1, +0.369139194, +0.164871573, -0.179028511E-1, -0.962870479
971mean(:,0) = getMean(sample, dim)
972mean(:,0) ! reference
973-0.279761136
974do isam = 1, nsam
975 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
976end do
977call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
978meanMerged
979-0.279761136
980call setMeanMerged(mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
981mean(:,2)
982-0.279761136
983mean(:,0) ! reference
984-0.279761136
985
986
987dim = 2; lb(1) = 1; ub(1) = getUnifRand(1, 7)
988do isam = 2, nsam
989 lb(isam) = ub(isam - 1) + 1
990 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
991end do
992lb
993+1, +2
994ub
995+1, +8
996ndim = getUnifRand(1, minval(ub - lb + 1, 1))
997call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
998call setResized(meanMerged, ndim)
999sample = getUnifRand(-1., +1., ndim, ub(nsam))
1000sample
1001+0.668461323E-1, +0.748634100, +0.464521766, -0.799865484, -0.745929480, +0.663206935, -0.110731125E-1, -0.671849728
1002mean(:,0) = getMean(sample, dim)
1003mean(:,0) ! reference
1004-0.356886089E-1
1005do isam = 1, nsam
1006 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1007end do
1008call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1009meanMerged
1010-0.356886126E-1
1011call setMeanMerged(mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1012mean(:,2)
1013-0.356886126E-1
1014mean(:,0) ! reference
1015-0.356886089E-1
1016
1017
1018dim = 2; lb(1) = 1; ub(1) = getUnifRand(1, 7)
1019do isam = 2, nsam
1020 lb(isam) = ub(isam - 1) + 1
1021 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1022end do
1023lb
1024+1, +7
1025ub
1026+6, +7
1027ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1028call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1029call setResized(meanMerged, ndim)
1030sample = getUnifRand(-1., +1., ndim, ub(nsam))
1031sample
1032-0.740664005E-1, -0.857483864, +0.111626506, +0.118040800, +0.744359374, +0.119488001, +0.335914135
1033mean(:,0) = getMean(sample, dim)
1034mean(:,0) ! reference
1035+0.711255074E-1
1036do isam = 1, nsam
1037 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1038end do
1039call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1040meanMerged
1041+0.711255074E-1
1042call setMeanMerged(mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1043mean(:,2)
1044+0.711255074E-1
1045mean(:,0) ! reference
1046+0.711255074E-1
1047
1048
1049dim = 2; lb(1) = 1; ub(1) = getUnifRand(1, 7)
1050do isam = 2, nsam
1051 lb(isam) = ub(isam - 1) + 1
1052 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1053end do
1054lb
1055+1, +2
1056ub
1057+1, +5
1058ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1059call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1060call setResized(meanMerged, ndim)
1061sample = getUnifRand(-1., +1., ndim, ub(nsam))
1062sample
1063-0.173358560, +0.915946484, +0.164537907, +0.587598085, -0.439523697
1064mean(:,0) = getMean(sample, dim)
1065mean(:,0) ! reference
1066+0.211040050
1067do isam = 1, nsam
1068 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1069end do
1070call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1071meanMerged
1072+0.211040050
1073call setMeanMerged(mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1074mean(:,2)
1075+0.211040050
1076mean(:,0) ! reference
1077+0.211040050
1078
1079
1080dim = 2; lb(1) = 1; ub(1) = getUnifRand(1, 7)
1081do isam = 2, nsam
1082 lb(isam) = ub(isam - 1) + 1
1083 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1084end do
1085lb
1086+1, +5
1087ub
1088+4, +5
1089ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1090call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1091call setResized(meanMerged, ndim)
1092sample = getUnifRand(-1., +1., ndim, ub(nsam))
1093sample
1094-0.776083589, +0.727857590, +0.634563088, -0.446850896, +0.945649505
1095mean(:,0) = getMean(sample, dim)
1096mean(:,0) ! reference
1097+0.217027143
1098do isam = 1, nsam
1099 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1100end do
1101call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1102meanMerged
1103+0.217027128
1104call setMeanMerged(mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1105mean(:,2)
1106+0.217027128
1107mean(:,0) ! reference
1108+0.217027143
1109
1110
1111dim = 2; lb(1) = 1; ub(1) = getUnifRand(1, 7)
1112do isam = 2, nsam
1113 lb(isam) = ub(isam - 1) + 1
1114 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1115end do
1116lb
1117+1, +6
1118ub
1119+5, +7
1120ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1121call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1122call setResized(meanMerged, ndim)
1123sample = getUnifRand(-1., +1., ndim, ub(nsam))
1124sample
1125-0.777397394, +0.690608382, -0.705466628, -0.487904906, +0.992464662, -0.933478117, -0.744777679
1126mean(:,0) = getMean(sample, dim)
1127mean(:,0) ! reference
1128-0.280850261
1129do isam = 1, nsam
1130 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1131end do
1132call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1133meanMerged
1134-0.280850232
1135call setMeanMerged(mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1136mean(:,2)
1137-0.280850232
1138mean(:,0) ! reference
1139-0.280850261
1140
1141
1142dim = 2; lb(1) = 1; ub(1) = getUnifRand(1, 7)
1143do isam = 2, nsam
1144 lb(isam) = ub(isam - 1) + 1
1145 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1146end do
1147lb
1148+1, +2
1149ub
1150+1, +8
1151ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1152call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1153call setResized(meanMerged, ndim)
1154sample = getUnifRand(-1., +1., ndim, ub(nsam))
1155sample
1156+0.342716098, +0.359631300, +0.409963965, -0.300135612E-1, +0.497994423, -0.220339298E-1, -0.184091091, +0.170267463
1157mean(:,0) = getMean(sample, dim)
1158mean(:,0) ! reference
1159+0.193054333
1160do isam = 1, nsam
1161 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1162end do
1163call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1164meanMerged
1165+0.193054333
1166call setMeanMerged(mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1167mean(:,2)
1168+0.193054333
1169mean(:,0) ! reference
1170+0.193054333
1171
1172
1173dim = 2; lb(1) = 1; ub(1) = getUnifRand(1, 7)
1174do isam = 2, nsam
1175 lb(isam) = ub(isam - 1) + 1
1176 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1177end do
1178lb
1179+1, +3
1180ub
1181+2, +4
1182ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1183call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1184call setResized(meanMerged, ndim)
1185sample = getUnifRand(-1., +1., ndim, ub(nsam))
1186sample
1187+0.497702479, +0.284248590, +0.314499140E-1, +0.949180126
1188mean(:,0) = getMean(sample, dim)
1189mean(:,0) ! reference
1190+0.440645278
1191do isam = 1, nsam
1192 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1193end do
1194call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1195meanMerged
1196+0.440645278
1197call setMeanMerged(mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1198mean(:,2)
1199+0.440645278
1200mean(:,0) ! reference
1201+0.440645278
1202
1203
1204dim = 2; lb(1) = 1; ub(1) = getUnifRand(1, 7)
1205do isam = 2, nsam
1206 lb(isam) = ub(isam - 1) + 1
1207 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1208end do
1209lb
1210+1, +5
1211ub
1212+4, +9
1213ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1214call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1215call setResized(meanMerged, ndim)
1216sample = getUnifRand(-1., +1., ndim, ub(nsam))
1217sample
1218-0.762658596, +0.441207886, +0.111809134, +0.865271807, +0.132838130, +0.838543534, -0.697230577, -0.468979597, -0.637683272
1219+0.174437761, -0.714493632, -0.488917708, +0.668080568, -0.302784443, -0.491571546, +0.223920345, -0.707399726, -0.256299496
1220mean(:,0) = getMean(sample, dim)
1221mean(:,0) ! reference
1222-0.196535066E-1, -0.210558653
1223do isam = 1, nsam
1224 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1225end do
1226call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1227meanMerged
1228-0.196535066E-1, -0.210558653
1229call setMeanMerged(mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1230mean(:,2)
1231-0.196535066E-1, -0.210558653
1232mean(:,0) ! reference
1233-0.196535066E-1, -0.210558653
1234
1235
1236!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1237!Compute the merged mean of a frequency weighted multivariate sample.
1238!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1239
1240
1241dim = 2; lb(1) = 1; ub(1) = getUnifRand(1, 7)
1242do isam = 2, nsam
1243 lb(isam) = ub(isam - 1) + 1
1244 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1245end do
1246lb
1247+1, +8
1248ub
1249+7, +9
1250ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1251call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1252call setResized(meanMerged, ndim)
1253sample = getUnifRand(-1., +1., ndim, ub(nsam))
1254sample
1255-0.777980685, +0.920617700, -0.665005088, +0.205028534, +0.449424505, +0.721747875, +0.112909675, -0.174124122, -0.277031302
1256-0.673566222, -0.554760575, +0.582443476, -0.356143594, +0.531208515, +0.162809014, -0.347086191E-1, -0.537560225, +0.815578580
1257iweight = getUnifRand(1, 10, size(sample, dim, IK))
1258iweight
1259+4, +6, +5, +1, +5, +10, +4, +2, +6
1260mean(:,0) = getMean(sample, 2_IK, iweight)
1261mean(:,0) ! reference
1262+0.167385831, +0.104578950
1263do isam = 1, nsam
1264 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1265end do
1266call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1267meanMerged
1268+0.167385831, +0.104578972
1269call setMeanMerged(mean(:,2), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1270mean(:,2)
1271+0.167385831, +0.104578972
1272mean(:,0) ! reference
1273+0.167385831, +0.104578950
1274
1275
1276dim = 2; lb(1) = 1; ub(1) = getUnifRand(1, 7)
1277do isam = 2, nsam
1278 lb(isam) = ub(isam - 1) + 1
1279 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1280end do
1281lb
1282+1, +4
1283ub
1284+3, +8
1285ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1286call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1287call setResized(meanMerged, ndim)
1288sample = getUnifRand(-1., +1., ndim, ub(nsam))
1289sample
1290+0.144397855, +0.451909304E-1, -0.235148430, -0.154173970, +0.600418925, +0.371675730, +0.529384494, -0.176618338
1291-0.699370384, -0.718312502, -0.239885449, -0.401120543, +0.905242562, +0.595938444, +0.754366875, -0.809834242
1292+0.709512830, -0.519693375, -0.982616544, -0.949329376, -0.337597489, -0.978132367, +0.485882401, +0.829034567
1293iweight = getUnifRand(1, 10, size(sample, dim, IK))
1294iweight
1295+10, +9, +4, +8, +2, +8, +10, +3
1296mean(:,0) = getMean(sample, 2_IK, iweight)
1297mean(:,0) ! reference
1298+0.159536034, -0.109904870, -0.190028533
1299do isam = 1, nsam
1300 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1301end do
1302call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1303meanMerged
1304+0.159536019, -0.109904915, -0.190028504
1305call setMeanMerged(mean(:,2), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1306mean(:,2)
1307+0.159536019, -0.109904915, -0.190028504
1308mean(:,0) ! reference
1309+0.159536034, -0.109904870, -0.190028533
1310
1311
1312dim = 2; lb(1) = 1; ub(1) = getUnifRand(1, 7)
1313do isam = 2, nsam
1314 lb(isam) = ub(isam - 1) + 1
1315 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1316end do
1317lb
1318+1, +6
1319ub
1320+5, +8
1321ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1322call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1323call setResized(meanMerged, ndim)
1324sample = getUnifRand(-1., +1., ndim, ub(nsam))
1325sample
1326+0.443223715, +0.915676236, -0.375468016, -0.456317425, -0.543553829, +0.722472191, -0.824745774, -0.721986294
1327-0.735986471, -0.271528363, -0.561799526, -0.143196344, -0.289244056, -0.715440392, +0.972285509, +0.793827057
1328iweight = getUnifRand(1, 10, size(sample, dim, IK))
1329iweight
1330+4, +8, +5, +5, +10, +2, +2, +4
1331mean(:,0) = getMean(sample, 2_IK, iweight)
1332mean(:,0) ! reference
1333-0.897163376E-1, -0.196114883
1334do isam = 1, nsam
1335 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1336end do
1337call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1338meanMerged
1339-0.897163302E-1, -0.196114868
1340call setMeanMerged(mean(:,2), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1341mean(:,2)
1342-0.897163302E-1, -0.196114868
1343mean(:,0) ! reference
1344-0.897163376E-1, -0.196114883
1345
1346
1347dim = 2; lb(1) = 1; ub(1) = getUnifRand(1, 7)
1348do isam = 2, nsam
1349 lb(isam) = ub(isam - 1) + 1
1350 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1351end do
1352lb
1353+1, +2
1354ub
1355+1, +3
1356ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1357call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1358call setResized(meanMerged, ndim)
1359sample = getUnifRand(-1., +1., ndim, ub(nsam))
1360sample
1361-0.650143385, -0.434873819, +0.707393408
1362iweight = getUnifRand(1, 10, size(sample, dim, IK))
1363iweight
1364+8, +6, +7
1365mean(:,0) = getMean(sample, 2_IK, iweight)
1366mean(:,0) ! reference
1367-0.136125550
1368do isam = 1, nsam
1369 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1370end do
1371call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1372meanMerged
1373-0.136125535
1374call setMeanMerged(mean(:,2), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1375mean(:,2)
1376-0.136125535
1377mean(:,0) ! reference
1378-0.136125550
1379
1380
1381dim = 2; lb(1) = 1; ub(1) = getUnifRand(1, 7)
1382do isam = 2, nsam
1383 lb(isam) = ub(isam - 1) + 1
1384 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1385end do
1386lb
1387+1, +3
1388ub
1389+2, +3
1390ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1391call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1392call setResized(meanMerged, ndim)
1393sample = getUnifRand(-1., +1., ndim, ub(nsam))
1394sample
1395-0.257534146, -0.206248760E-1, +0.414295435
1396iweight = getUnifRand(1, 10, size(sample, dim, IK))
1397iweight
1398+6, +8, +2
1399mean(:,0) = getMean(sample, 2_IK, iweight)
1400mean(:,0) ! reference
1401-0.551008135E-1
1402do isam = 1, nsam
1403 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1404end do
1405call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1406meanMerged
1407-0.551008135E-1
1408call setMeanMerged(mean(:,2), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1409mean(:,2)
1410-0.551008135E-1
1411mean(:,0) ! reference
1412-0.551008135E-1
1413
1414
1415dim = 2; lb(1) = 1; ub(1) = getUnifRand(1, 7)
1416do isam = 2, nsam
1417 lb(isam) = ub(isam - 1) + 1
1418 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1419end do
1420lb
1421+1, +3
1422ub
1423+2, +4
1424ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1425call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1426call setResized(meanMerged, ndim)
1427sample = getUnifRand(-1., +1., ndim, ub(nsam))
1428sample
1429-0.961017609E-1, +0.870027781, -0.725200295, +0.515335321
1430iweight = getUnifRand(1, 10, size(sample, dim, IK))
1431iweight
1432+7, +3, +9, +4
1433mean(:,0) = getMean(sample, 2_IK, iweight)
1434mean(:,0) ! reference
1435-0.109916978
1436do isam = 1, nsam
1437 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1438end do
1439call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1440meanMerged
1441-0.109916970
1442call setMeanMerged(mean(:,2), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1443mean(:,2)
1444-0.109916970
1445mean(:,0) ! reference
1446-0.109916978
1447
1448
1449dim = 2; lb(1) = 1; ub(1) = getUnifRand(1, 7)
1450do isam = 2, nsam
1451 lb(isam) = ub(isam - 1) + 1
1452 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1453end do
1454lb
1455+1, +2
1456ub
1457+1, +7
1458ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1459call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1460call setResized(meanMerged, ndim)
1461sample = getUnifRand(-1., +1., ndim, ub(nsam))
1462sample
1463-0.213094234, +0.329319596, -0.251468539, -0.934713602, -0.200464249, -0.416475892, -0.391444087
1464iweight = getUnifRand(1, 10, size(sample, dim, IK))
1465iweight
1466+8, +4, +7, +9, +4, +4, +6
1467mean(:,0) = getMean(sample, 2_IK, iweight)
1468mean(:,0) ! reference
1469-0.366109550
1470do isam = 1, nsam
1471 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1472end do
1473call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1474meanMerged
1475-0.366109610
1476call setMeanMerged(mean(:,2), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1477mean(:,2)
1478-0.366109610
1479mean(:,0) ! reference
1480-0.366109550
1481
1482
1483dim = 2; lb(1) = 1; ub(1) = getUnifRand(1, 7)
1484do isam = 2, nsam
1485 lb(isam) = ub(isam - 1) + 1
1486 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1487end do
1488lb
1489+1, +8
1490ub
1491+7, +12
1492ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1493call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1494call setResized(meanMerged, ndim)
1495sample = getUnifRand(-1., +1., ndim, ub(nsam))
1496sample
1497+0.745304823, -0.683014393, +0.980411887, -0.203457952, +0.105829477, -0.632041454, -0.175224543, -0.622153401, -0.313490272, -0.706428766, +0.246935368, +0.273543358
1498+0.496329308, +0.661024332, +0.849573851, -0.521696210, -0.620464802, +0.264436364, +0.817505956, +0.616884947, -0.237756848, +0.129341722, -0.680225015, -0.431994796
1499+0.997373223, -0.520158529, -0.362969279, +0.510083675, +0.241760612, -0.177526832, +0.161094189, +0.499121666, -0.923519254, -0.146237731, -0.973134995, -0.353827953
1500+0.716768742, +0.576668024, -0.606665015, +0.401872516, +0.204938889, +0.978006124E-1, -0.116649270, -0.152186394, -0.646051764, -0.148245454, -0.621037722, +0.591425419
1501-0.804211855, +0.463073850, +0.303779006, -0.161945939, -0.515203476E-1, -0.391865373, -0.480176210, -0.428533912, +0.872934103, -0.297682405, +0.131642818E-2, -0.806992531
1502iweight = getUnifRand(1, 10, size(sample, dim, IK))
1503iweight
1504+8, +1, +3, +10, +5, +7, +7, +4, +7, +4, +7, +10
1505mean(:,0) = getMean(sample, 2_IK, iweight)
1506mean(:,0) ! reference
1507-0.271289572E-1, -0.181674566E-1, -0.388875641E-1, +0.718520954E-1, -0.245146185
1508do isam = 1, nsam
1509 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1510end do
1511call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1512meanMerged
1513-0.271289609E-1, -0.181674585E-1, -0.388875604E-1, +0.718520880E-1, -0.245146215
1514call setMeanMerged(mean(:,2), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1515mean(:,2)
1516-0.271289609E-1, -0.181674585E-1, -0.388875604E-1, +0.718520880E-1, -0.245146215
1517mean(:,0) ! reference
1518-0.271289572E-1, -0.181674566E-1, -0.388875641E-1, +0.718520954E-1, -0.245146185
1519
1520
1521dim = 2; lb(1) = 1; ub(1) = getUnifRand(1, 7)
1522do isam = 2, nsam
1523 lb(isam) = ub(isam - 1) + 1
1524 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1525end do
1526lb
1527+1, +8
1528ub
1529+7, +11
1530ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1531call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1532call setResized(meanMerged, ndim)
1533sample = getUnifRand(-1., +1., ndim, ub(nsam))
1534sample
1535+0.611000419, +0.212515831, -0.375352859, +0.677173138, +0.223523736, -0.609845161, +0.967451334, -0.878303528, +0.678430796E-1, +0.788116097, +0.916360378
1536iweight = getUnifRand(1, 10, size(sample, dim, IK))
1537iweight
1538+6, +2, +1, +5, +10, +5, +1, +8, +3, +6, +6
1539mean(:,0) = getMean(sample, 2_IK, iweight)
1540mean(:,0) ! reference
1541+0.201112643
1542do isam = 1, nsam
1543 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1544end do
1545call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1546meanMerged
1547+0.201112658
1548call setMeanMerged(mean(:,2), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1549mean(:,2)
1550+0.201112658
1551mean(:,0) ! reference
1552+0.201112643
1553
1554
1555dim = 2; lb(1) = 1; ub(1) = getUnifRand(1, 7)
1556do isam = 2, nsam
1557 lb(isam) = ub(isam - 1) + 1
1558 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1559end do
1560lb
1561+1, +6
1562ub
1563+5, +9
1564ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1565call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1566call setResized(meanMerged, ndim)
1567sample = getUnifRand(-1., +1., ndim, ub(nsam))
1568sample
1569-0.211490154, +0.176915407, -0.713280916, -0.561638474, -0.626951933, +0.873261571, +0.966665149, -0.630244851, -0.449101329
1570+0.555660129, +0.177657962, +0.746872544, +0.196031928, -0.758128166, -0.887101412, +0.138559818, -0.598954439, +0.581151009
1571-0.177578926E-1, -0.753511906, -0.605453372, +0.773064494, -0.565817237, +0.890963435, +0.294058681, -0.914726257E-1, +0.536434650E-1
1572iweight = getUnifRand(1, 10, size(sample, dim, IK))
1573iweight
1574+3, +2, +10, +7, +3, +1, +1, +6, +6
1575mean(:,0) = getMean(sample, 2_IK, iweight)
1576mean(:,0) ! reference
1577-0.457998097, +0.198294863, -0.754560083E-1
1578do isam = 1, nsam
1579 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1580end do
1581call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1582meanMerged
1583-0.457998037, +0.198294848, -0.754560158E-1
1584call setMeanMerged(mean(:,2), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1585mean(:,2)
1586-0.457998037, +0.198294848, -0.754560158E-1
1587mean(:,0) ! reference
1588-0.457998097, +0.198294863, -0.754560083E-1
1589
1590
1591!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1592!Compute the merged mean of a reliability weighted multivariate sample.
1593!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1594
1595
1596lb(1) = 1; ub(1) = getUnifRand(1, 7)
1597do isam = 2, nsam
1598 lb(isam) = ub(isam - 1) + 1
1599 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1600end do
1601lb
1602+1, +8
1603ub
1604+7, +9
1605ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1606call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1607call setResized(meanMerged, ndim)
1608sample = getUnifRand(-1., +1., ndim, ub(nsam))
1609sample
1610+0.470773816, +0.967643261E-1, +0.557694316, -0.960001945E-1, +0.428798914, -0.577192068, +0.654573560, +0.764205337, -0.795432091
1611-0.511312485E-2, +0.856449366, -0.695217013, -0.947392106, -0.761054873, -0.830851674, -0.144078493, +0.188452601, -0.463018298
1612rweight = getUnifRand(1, 10, size(sample, dim, IK))
1613rweight
1614+10.0000000, +10.0000000, +1.00000000, +10.0000000, +5.00000000, +1.00000000, +6.00000000, +2.00000000, +6.00000000
1615mean(:,0) = getMean(sample, dim, rweight)
1616mean(:,0) ! reference
1617+0.147512481, -0.187403485
1618do isam = 1, nsam
1619 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, rweight(lb(isam):ub(isam)))
1620end do
1621call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
1622meanMerged
1623+0.147512481, -0.187403485
1624call setMeanMerged(mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
1625mean(:,2)
1626+0.147512481, -0.187403485
1627mean(:,0) ! reference
1628+0.147512481, -0.187403485
1629
1630
1631lb(1) = 1; ub(1) = getUnifRand(1, 7)
1632do isam = 2, nsam
1633 lb(isam) = ub(isam - 1) + 1
1634 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1635end do
1636lb
1637+1, +6
1638ub
1639+5, +10
1640ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1641call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1642call setResized(meanMerged, ndim)
1643sample = getUnifRand(-1., +1., ndim, ub(nsam))
1644sample
1645-0.299423218, +0.232984424, +0.790115118, -0.830843568, +0.609007120, +0.459720731, +0.306044221, +0.702054501E-1, +0.563648224, +0.583520055
1646+0.836391211, +0.806512833, -0.870195389, +0.277371407E-1, +0.573816657, -0.944130301, +0.735152006, +0.351682901, +0.251731038, +0.942224264E-1
1647-0.815138817, +0.980282664, -0.532855153, +0.477959752, -0.116626382, -0.488353729, -0.495965600, -0.151460052, +0.459408998, +0.999310017E-1
1648rweight = getUnifRand(1, 10, size(sample, dim, IK))
1649rweight
1650+3.00000000, +6.00000000, +7.00000000, +2.00000000, +7.00000000, +2.00000000, +2.00000000, +1.00000000, +10.0000000, +9.00000000
1651mean(:,0) = getMean(sample, dim, rweight)
1652mean(:,0) ! reference
1653+0.431055188, +0.176083893, +0.656979159E-1
1654do isam = 1, nsam
1655 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, rweight(lb(isam):ub(isam)))
1656end do
1657call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
1658meanMerged
1659+0.431055188, +0.176083907, +0.656979308E-1
1660call setMeanMerged(mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
1661mean(:,2)
1662+0.431055188, +0.176083907, +0.656979308E-1
1663mean(:,0) ! reference
1664+0.431055188, +0.176083893, +0.656979159E-1
1665
1666
1667lb(1) = 1; ub(1) = getUnifRand(1, 7)
1668do isam = 2, nsam
1669 lb(isam) = ub(isam - 1) + 1
1670 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1671end do
1672lb
1673+1, +6
1674ub
1675+5, +7
1676ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1677call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1678call setResized(meanMerged, ndim)
1679sample = getUnifRand(-1., +1., ndim, ub(nsam))
1680sample
1681-0.284655213, -0.399007440, +0.363608003, -0.142322659, +0.839317083, +0.584376454, -0.142918706
1682-0.620559454, +0.152183771E-1, -0.818344712, -0.142496943, +0.946139455, +0.257211566, -0.311349869
1683rweight = getUnifRand(1, 10, size(sample, dim, IK))
1684rweight
1685+8.00000000, +9.00000000, +1.00000000, +4.00000000, +1.00000000, +1.00000000, +4.00000000
1686mean(:,0) = getMean(sample, dim, rweight)
1687mean(:,0) ! reference
1688-0.186499044, -0.223496124
1689do isam = 1, nsam
1690 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, rweight(lb(isam):ub(isam)))
1691end do
1692call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
1693meanMerged
1694-0.186499029, -0.223496124
1695call setMeanMerged(mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
1696mean(:,2)
1697-0.186499029, -0.223496124
1698mean(:,0) ! reference
1699-0.186499044, -0.223496124
1700
1701
1702lb(1) = 1; ub(1) = getUnifRand(1, 7)
1703do isam = 2, nsam
1704 lb(isam) = ub(isam - 1) + 1
1705 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1706end do
1707lb
1708+1, +4
1709ub
1710+3, +9
1711ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1712call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1713call setResized(meanMerged, ndim)
1714sample = getUnifRand(-1., +1., ndim, ub(nsam))
1715sample
1716+0.749264002, -0.695847034, +0.615712762, -0.724756479, -0.416697741, +0.420585632, +0.178331733, +0.426357031, +0.622486234
1717-0.609037519, +0.665992975, -0.159351230, +0.721003175, +0.807496309, -0.524388313, +0.695737123, -0.121226072, +0.411437631
1718rweight = getUnifRand(1, 10, size(sample, dim, IK))
1719rweight
1720+3.00000000, +5.00000000, +4.00000000, +1.00000000, +4.00000000, +3.00000000, +10.0000000, +5.00000000, +10.0000000
1721mean(:,0) = getMean(sample, dim, rweight)
1722mean(:,0) ! reference
1723+0.227590710, +0.304641932
1724do isam = 1, nsam
1725 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, rweight(lb(isam):ub(isam)))
1726end do
1727call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
1728meanMerged
1729+0.227590725, +0.304641962
1730call setMeanMerged(mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
1731mean(:,2)
1732+0.227590725, +0.304641962
1733mean(:,0) ! reference
1734+0.227590710, +0.304641932
1735
1736
1737lb(1) = 1; ub(1) = getUnifRand(1, 7)
1738do isam = 2, nsam
1739 lb(isam) = ub(isam - 1) + 1
1740 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1741end do
1742lb
1743+1, +6
1744ub
1745+5, +8
1746ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1747call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1748call setResized(meanMerged, ndim)
1749sample = getUnifRand(-1., +1., ndim, ub(nsam))
1750sample
1751+0.299856186, +0.551514745, +0.865416288, -0.642320991, +0.552765369, -0.882482052, +0.883689284, -0.876765251E-1
1752+0.454836845, -0.974622488, +0.832802415, +0.463223457, -0.562297821, +0.545973301, -0.404309750, +0.716274619
1753rweight = getUnifRand(1, 10, size(sample, dim, IK))
1754rweight
1755+3.00000000, +2.00000000, +10.0000000, +9.00000000, +6.00000000, +5.00000000, +3.00000000, +3.00000000
1756mean(:,0) = getMean(sample, dim, rweight)
1757mean(:,0) ! reference
1758+0.150441274, +0.297665209
1759do isam = 1, nsam
1760 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, rweight(lb(isam):ub(isam)))
1761end do
1762call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
1763meanMerged
1764+0.150441304, +0.297665238
1765call setMeanMerged(mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
1766mean(:,2)
1767+0.150441304, +0.297665238
1768mean(:,0) ! reference
1769+0.150441274, +0.297665209
1770
1771
1772lb(1) = 1; ub(1) = getUnifRand(1, 7)
1773do isam = 2, nsam
1774 lb(isam) = ub(isam - 1) + 1
1775 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1776end do
1777lb
1778+1, +6
1779ub
1780+5, +10
1781ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1782call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1783call setResized(meanMerged, ndim)
1784sample = getUnifRand(-1., +1., ndim, ub(nsam))
1785sample
1786-0.884524345, +0.656505346, -0.547052264, +0.523308992, -0.762376428, -0.183162332, -0.455511570, -0.372542143E-1, -0.181038499, -0.545666099
1787+0.745436788, -0.842442036, -0.943564057, +0.826775670, -0.405719757, -0.339901924, +0.530972719, -0.723436594, -0.309309125, -0.977234125
1788rweight = getUnifRand(1, 10, size(sample, dim, IK))
1789rweight
1790+1.00000000, +7.00000000, +6.00000000, +5.00000000, +8.00000000, +6.00000000, +3.00000000, +9.00000000, +10.0000000, +1.00000000
1791mean(:,0) = getMean(sample, dim, rweight)
1792mean(:,0) ! reference
1793-0.146618128, -0.374154836
1794do isam = 1, nsam
1795 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, rweight(lb(isam):ub(isam)))
1796end do
1797call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
1798meanMerged
1799-0.146618128, -0.374154806
1800call setMeanMerged(mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
1801mean(:,2)
1802-0.146618128, -0.374154806
1803mean(:,0) ! reference
1804-0.146618128, -0.374154836
1805
1806
1807lb(1) = 1; ub(1) = getUnifRand(1, 7)
1808do isam = 2, nsam
1809 lb(isam) = ub(isam - 1) + 1
1810 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1811end do
1812lb
1813+1, +2
1814ub
1815+1, +4
1816ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1817call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1818call setResized(meanMerged, ndim)
1819sample = getUnifRand(-1., +1., ndim, ub(nsam))
1820sample
1821-0.358620882E-1, +0.994434714, -0.867512107, -0.524670362
1822rweight = getUnifRand(1, 10, size(sample, dim, IK))
1823rweight
1824+1.00000000, +9.00000000, +6.00000000, +7.00000000
1825mean(:,0) = getMean(sample, dim, rweight)
1826mean(:,0) ! reference
1827+0.157761574E-2
1828do isam = 1, nsam
1829 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, rweight(lb(isam):ub(isam)))
1830end do
1831call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
1832meanMerged
1833+0.157761073E-2
1834call setMeanMerged(mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
1835mean(:,2)
1836+0.157761073E-2
1837mean(:,0) ! reference
1838+0.157761574E-2
1839
1840
1841lb(1) = 1; ub(1) = getUnifRand(1, 7)
1842do isam = 2, nsam
1843 lb(isam) = ub(isam - 1) + 1
1844 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1845end do
1846lb
1847+1, +8
1848ub
1849+7, +11
1850ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1851call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1852call setResized(meanMerged, ndim)
1853sample = getUnifRand(-1., +1., ndim, ub(nsam))
1854sample
1855-0.397376299, -0.605899453, -0.332282901, +0.163235307, +0.413737535, -0.629750967, -0.134761810, +0.380380392, +0.197632074, -0.302667022, -0.250871778
1856-0.761517882, -0.448336720, -0.199189186E-1, +0.921699405, -0.627998114E-1, -0.277904272E-1, -0.574630857, +0.950964093, -0.193039060, +0.207809091, +0.389393091
1857rweight = getUnifRand(1, 10, size(sample, dim, IK))
1858rweight
1859+5.00000000, +8.00000000, +7.00000000, +9.00000000, +1.00000000, +7.00000000, +7.00000000, +3.00000000, +4.00000000, +5.00000000, +8.00000000
1860mean(:,0) = getMean(sample, dim, rweight)
1861mean(:,0) ! reference
1862-0.222147360, +0.424493179E-1
1863do isam = 1, nsam
1864 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, rweight(lb(isam):ub(isam)))
1865end do
1866call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
1867meanMerged
1868-0.222147360, +0.424493253E-1
1869call setMeanMerged(mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
1870mean(:,2)
1871-0.222147360, +0.424493253E-1
1872mean(:,0) ! reference
1873-0.222147360, +0.424493179E-1
1874
1875
1876lb(1) = 1; ub(1) = getUnifRand(1, 7)
1877do isam = 2, nsam
1878 lb(isam) = ub(isam - 1) + 1
1879 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1880end do
1881lb
1882+1, +2
1883ub
1884+1, +6
1885ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1886call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1887call setResized(meanMerged, ndim)
1888sample = getUnifRand(-1., +1., ndim, ub(nsam))
1889sample
1890+0.832688212, +0.417248368, -0.412157774E-1, -0.683036804, +0.229055882E-1, +0.669203997
1891rweight = getUnifRand(1, 10, size(sample, dim, IK))
1892rweight
1893+10.0000000, +6.00000000, +9.00000000, +1.00000000, +5.00000000, +3.00000000
1894mean(:,0) = getMean(sample, dim, rweight)
1895mean(:,0) ! reference
1896+0.349956870
1897do isam = 1, nsam
1898 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, rweight(lb(isam):ub(isam)))
1899end do
1900call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
1901meanMerged
1902+0.349956900
1903call setMeanMerged(mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
1904mean(:,2)
1905+0.349956900
1906mean(:,0) ! reference
1907+0.349956870
1908
1909
1910lb(1) = 1; ub(1) = getUnifRand(1, 7)
1911do isam = 2, nsam
1912 lb(isam) = ub(isam - 1) + 1
1913 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1914end do
1915lb
1916+1, +7
1917ub
1918+6, +13
1919ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1920call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1921call setResized(meanMerged, ndim)
1922sample = getUnifRand(-1., +1., ndim, ub(nsam))
1923sample
1924-0.989508390, +0.886763334E-1, -0.442037702, -0.831042051, -0.468018293, -0.892808676, -0.340943933, +0.131268501E-1, -0.315030217, +0.380456686, +0.313637376, +0.566228628E-1, -0.122164369
1925+0.840083241, +0.361554623E-1, +0.681064248, +0.889984012, -0.563441873, +0.659806132, +0.461213112, +0.811031342, -0.984293222E-1, +0.591543674, +0.395642996, +0.658269048, +0.657462716
1926-0.680930734, +0.485520363E-1, +0.964223504, -0.399450779, +0.582277536, +0.709932327, -0.549821019, +0.586841702, -0.408403039, -0.485042930, +0.182639956, -0.151450872, +0.549940705
1927rweight = getUnifRand(1, 10, size(sample, dim, IK))
1928rweight
1929+8.00000000, +9.00000000, +3.00000000, +2.00000000, +7.00000000, +4.00000000, +4.00000000, +3.00000000, +4.00000000, +9.00000000, +1.00000000, +9.00000000, +8.00000000
1930mean(:,0) = getMean(sample, dim, rweight)
1931mean(:,0) ! reference
1932-0.229126960, +0.427496403, +0.109903412E-1
1933do isam = 1, nsam
1934 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, rweight(lb(isam):ub(isam)))
1935end do
1936call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
1937meanMerged
1938-0.229127020, +0.427496433, +0.109903403E-1
1939call setMeanMerged(mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
1940mean(:,2)
1941-0.229127020, +0.427496433, +0.109903403E-1
1942mean(:,0) ! reference
1943-0.229126960, +0.427496403, +0.109903412E-1
1944
1945
Test:
test_pm_sampleMean


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 4194 of file pm_sampleMean.F90.


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