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

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

Detailed Description

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
[out]meanMerged: The output object of the same type and kind and rank and shape as meanA, containing the mean of the sample resulting form the merger of the two samples.
(optional. If missing, the resulting merged mean will be written to the argument meanB.)
[in,out]meanB: The input or input/output object of the same type and kind and rank and shape as the input argument meanA, containing the mean of the second sample that must be merged with the first sample.
If the input argument meanMerged is missing, then meanB contains the merged mean of the merged sample on return.
Otherwise, the contents of meanB remain intact upon return.
[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 sum of the weights of all points in sample \(A\) divided by the sum of the 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 setMeanMerged( meanB, meanA, fracA)
call setMeanMerged(meanMerged, meanB, meanA, fracA)
! ndim-dimensional sample.
call setMeanMerged( meanB(1:ndim), meanA(1:ndim), fracA)
call setMeanMerged(meanMerged(1:ndim), meanB(1:ndim), meanA(1:ndim), fracA)
Return the (weighted) merged mean of a sample resulting from the merger of two separate (weighted) sa...
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.
The condition size(meanMerged) == 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...
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, +9
16sample = getUnifRand(0., 1., ub(nsam))
17sample
18+0.970227480, +0.889174044, +0.400529444, +0.108696580, +0.360504448, +0.611867964, +0.340796709E-1, +0.398242354, +0.731139064
19mean(0) = getMean(sample)
20mean(0) ! reference
21+0.500495672
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.500495672
28call setMeanMerged(mean(2), mean(1), ub(1) / real(ub(2), TKG))
29mean(2)
30+0.500495672
31mean(0) ! reference
32+0.500495672
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, +2
42ub
43+1, +3
44sample = getUnifRand(0., 1., ub(nsam))
45sample
46+0.988277555, +0.352771282, +0.193285286
47mean(0) = getMean(sample)
48mean(0) ! reference
49+0.511444747
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.511444688
56call setMeanMerged(mean(2), mean(1), ub(1) / real(ub(2), TKG))
57mean(2)
58+0.511444688
59mean(0) ! reference
60+0.511444747
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, +4
70ub
71+3, +9
72sample = getUnifRand(0., 1., ub(nsam))
73sample
74+0.434534550, +0.703356326, +0.483815253, +0.922264576, +0.775594234, +0.500287414E-1, +0.699615538, +0.463437378, +0.469291031
75mean(0) = getMean(sample)
76mean(0) ! reference
77+0.555770874
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.555770755
84call setMeanMerged(mean(2), mean(1), ub(1) / real(ub(2), TKG))
85mean(2)
86+0.555770755
87mean(0) ! reference
88+0.555770874
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, +2
98ub
99+1, +3
100sample = getUnifRand(0., 1., ub(nsam))
101sample
102+0.743840456, +0.924445868, +0.574701309
103mean(0) = getMean(sample)
104mean(0) ! reference
105+0.747662544
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.747662544
112call setMeanMerged(mean(2), mean(1), ub(1) / real(ub(2), TKG))
113mean(2)
114+0.747662544
115mean(0) ! reference
116+0.747662544
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, +2
126ub
127+1, +2
128sample = getUnifRand(0., 1., ub(nsam))
129sample
130+0.502027273E-1, +0.385735393
131mean(0) = getMean(sample)
132mean(0) ! reference
133+0.217969060
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.217969060
140call setMeanMerged(mean(2), mean(1), ub(1) / real(ub(2), TKG))
141mean(2)
142+0.217969060
143mean(0) ! reference
144+0.217969060
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, +8
154ub
155+7, +13
156sample = getUnifRand(0., 1., ub(nsam))
157sample
158+0.523915768, +0.731165648, +0.849807918, +0.303806782, +0.393536031, +0.887881219, +0.285871685, +0.907886326, +0.840399981, +0.298650146, +0.518002212, +0.303899825, +0.847452641
159mean(0) = getMean(sample)
160mean(0) ! reference
161+0.591713548
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.591713548
168call setMeanMerged(mean(2), mean(1), ub(1) / real(ub(2), TKG))
169mean(2)
170+0.591713548
171mean(0) ! reference
172+0.591713548
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, +8
182ub
183+7, +8
184sample = getUnifRand(0., 1., ub(nsam))
185sample
186+0.559693992, +0.321461499, +0.423072040, +0.928239048, +0.113605142, +0.384397566, +0.105644166, +0.674464464
187mean(0) = getMean(sample)
188mean(0) ! reference
189+0.438822240
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.438822240
196call setMeanMerged(mean(2), mean(1), ub(1) / real(ub(2), TKG))
197mean(2)
198+0.438822240
199mean(0) ! reference
200+0.438822240
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, +4
210ub
211+3, +9
212sample = getUnifRand(0., 1., ub(nsam))
213sample
214+0.638076544, +0.192362010, +0.272083640, +0.726456702, +0.531597555, +0.298390865, +0.611184180, +0.677358985, +0.449197292E-1
215mean(0) = getMean(sample)
216mean(0) ! reference
217+0.443603337
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.443603337
224call setMeanMerged(mean(2), mean(1), ub(1) / real(ub(2), TKG))
225mean(2)
226+0.443603337
227mean(0) ! reference
228+0.443603337
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, +3
238ub
239+2, +9
240sample = getUnifRand(0., 1., ub(nsam))
241sample
242+0.199613988, +0.305162668, +0.552734494, +0.722108781, +0.113323748, +0.889423549, +0.475358486, +0.518952370, +0.725527227
243mean(0) = getMean(sample)
244mean(0) ! reference
245+0.500245035
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.500245035
252call setMeanMerged(mean(2), mean(1), ub(1) / real(ub(2), TKG))
253mean(2)
254+0.500245035
255mean(0) ! reference
256+0.500245035
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, +2
266ub
267+1, +6
268sample = getUnifRand(0., 1., ub(nsam))
269sample
270+0.451303363, +0.809018612E-1, +0.106862247, +0.504584491, +0.960011005, +0.395677865
271mean(0) = getMean(sample)
272mean(0) ! reference
273+0.416556805
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.416556835
280call setMeanMerged(mean(2), mean(1), ub(1) / real(ub(2), TKG))
281mean(2)
282+0.416556835
283mean(0) ! reference
284+0.416556805
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, +7
301sample = getUnifRand(0., 1., ub(nsam))
302sample
303+0.931036353, +0.360781252, +0.658607483E-2, +0.993314683, +0.382083535, +0.617320836, +0.659363270E-1
304iweight = getUnifRand(1, 10, size(sample, 1, IK))
305iweight
306+6, +10, +4, +7, +9, +8, +2
307mean(0) = getMean(sample, iweight)
308mean(0) ! reference
309+0.536581933
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.536581874
316call setMeanMerged(mean(2), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
317mean(2)
318+0.536581874
319mean(0) ! reference
320+0.536581933
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, +4
330ub
331+3, +10
332sample = getUnifRand(0., 1., ub(nsam))
333sample
334+0.196274102, +0.473127067, +0.356733918, +0.475377560, +0.721541822, +0.683517039, +0.504666090, +0.650321841, +0.106697500, +0.506007314
335iweight = getUnifRand(1, 10, size(sample, 1, IK))
336iweight
337+7, +8, +7, +10, +9, +3, +10, +3, +8, +3
338mean(0) = getMean(sample, iweight)
339mean(0) ! reference
340+0.445933908
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.445933938
347call setMeanMerged(mean(2), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
348mean(2)
349+0.445933938
350mean(0) ! reference
351+0.445933908
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, +5
361ub
362+4, +5
363sample = getUnifRand(0., 1., ub(nsam))
364sample
365+0.666209996, +0.372503519, +0.644750595, +0.935250759, +0.491415143
366iweight = getUnifRand(1, 10, size(sample, 1, IK))
367iweight
368+5, +5, +2, +3, +3
369mean(0) = getMean(sample, iweight)
370mean(0) ! reference
371+0.597948074
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.597948074
378call setMeanMerged(mean(2), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
379mean(2)
380+0.597948074
381mean(0) ! reference
382+0.597948074
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, +4
392ub
393+3, +9
394sample = getUnifRand(0., 1., ub(nsam))
395sample
396+0.625750959, +0.610696912, +0.474483311, +0.465015531, +0.335899472, +0.572187483, +0.389681578, +0.793304324, +0.810409427
397iweight = getUnifRand(1, 10, size(sample, 1, IK))
398iweight
399+4, +7, +3, +4, +7, +9, +2, +8, +4
400mean(0) = getMean(sample, iweight)
401mean(0) ! reference
402+0.581871092
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.581871092
409call setMeanMerged(mean(2), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
410mean(2)
411+0.581871092
412mean(0) ! reference
413+0.581871092
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, +8
423ub
424+7, +10
425sample = getUnifRand(0., 1., ub(nsam))
426sample
427+0.775321066, +0.794384539, +0.403132200, +0.215430498, +0.133064210, +0.293928564, +0.561876714, +0.731466770, +0.475014567, +0.935007513
428iweight = getUnifRand(1, 10, size(sample, 1, IK))
429iweight
430+2, +4, +4, +4, +10, +6, +6, +10, +4, +8
431mean(0) = getMean(sample, iweight)
432mean(0) ! reference
433+0.523494720
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.523494720
440call setMeanMerged(mean(2), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
441mean(2)
442+0.523494720
443mean(0) ! reference
444+0.523494720
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, +4
454ub
455+3, +6
456sample = getUnifRand(0., 1., ub(nsam))
457sample
458+0.165893912, +0.464924753, +0.119281590, +0.745239377, +0.130114675, +0.415790260
459iweight = getUnifRand(1, 10, size(sample, 1, IK))
460iweight
461+7, +3, +6, +10, +8, +1
462mean(0) = getMean(sample, iweight)
463mean(0) ! reference
464+0.348023534
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.348023534
471call setMeanMerged(mean(2), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
472mean(2)
473+0.348023534
474mean(0) ! reference
475+0.348023534
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, +6
485ub
486+5, +10
487sample = getUnifRand(0., 1., ub(nsam))
488sample
489+0.558915734E-1, +0.837118387, +0.350727201, +0.850502491, +0.317502201, +0.982917964, +0.354779959E-1, +0.796154797, +0.596565247, +0.725060821
490iweight = getUnifRand(1, 10, size(sample, 1, IK))
491iweight
492+6, +4, +5, +1, +3, +4, +6, +2, +8, +2
493mean(0) = getMean(sample, iweight)
494mean(0) ! reference
495+0.468291730
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.468291700
502call setMeanMerged(mean(2), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
503mean(2)
504+0.468291700
505mean(0) ! reference
506+0.468291730
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, +3
516ub
517+2, +9
518sample = getUnifRand(0., 1., ub(nsam))
519sample
520+0.784939110, +0.192044199, +0.957277656, +0.725010097, +0.363101900, +0.509126782E-1, +0.925499678, +0.814981043, +0.230785012
521iweight = getUnifRand(1, 10, size(sample, 1, IK))
522iweight
523+2, +8, +6, +1, +1, +6, +4, +1, +5
524mean(0) = getMean(sample, iweight)
525mean(0) ! reference
526+0.468070298
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.468070298
533call setMeanMerged(mean(2), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
534mean(2)
535+0.468070298
536mean(0) ! reference
537+0.468070298
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, +5
547ub
548+4, +7
549sample = getUnifRand(0., 1., ub(nsam))
550sample
551+0.449719250, +0.450491786, +0.481030107, +0.553094089, +0.118318498, +0.138391972, +0.626205504
552iweight = getUnifRand(1, 10, size(sample, 1, IK))
553iweight
554+3, +7, +6, +4, +6, +8, +7
555mean(0) = getMean(sample, iweight)
556mean(0) ! reference
557+0.385405928
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.385405928
564call setMeanMerged(mean(2), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
565mean(2)
566+0.385405928
567mean(0) ! reference
568+0.385405928
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, +6
578ub
579+5, +8
580sample = getUnifRand(0., 1., ub(nsam))
581sample
582+0.464345932, +0.421162665, +0.924247861, +0.947289884, +0.879936099, +0.106137991E-1, +0.312648833, +0.540764749
583iweight = getUnifRand(1, 10, size(sample, 1, IK))
584iweight
585+2, +5, +4, +4, +4, +6, +10, +6
586mean(0) = getMean(sample, iweight)
587mean(0) ! reference
588+0.499394149
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.499394178
595call setMeanMerged(mean(2), mean(1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
596mean(2)
597+0.499394178
598mean(0) ! reference
599+0.499394149
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, +5
614ub
615+4, +10
616sample = getUnifRand(0., 1., ub(nsam))
617sample
618+0.336420298, +0.900482416, +0.269200981, +0.801517010, +0.172469258, +0.463568211, +0.422131181, +0.408791304, +0.407567441, +0.581609607E-1
619rweight = getUnifRand(1., 2., size(sample, 1, IK))
620rweight
621+1.52702785, +1.63808441, +1.13411498, +1.19323611, +1.16349483, +1.13752007, +1.67987084, +1.05819869, +1.07211399, +1.47440314
622mean(0) = getMean(sample, rweight)
623mean(0) ! reference
624+0.431478053
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.431478053
631call setMeanMerged(mean(2), mean(1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
632mean(2)
633+0.431478053
634mean(0) ! reference
635+0.431478053
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, +4
645ub
646+3, +9
647sample = getUnifRand(0., 1., ub(nsam))
648sample
649+0.536305487, +0.286720932, +0.871705592, +0.769569814, +0.206260383, +0.863130748, +0.832658350, +0.107159734, +0.559514821
650rweight = getUnifRand(1., 2., size(sample, 1, IK))
651rweight
652+1.82568407, +1.86250114, +1.23210704, +1.05506516, +1.40587664, +1.62315893, +1.33776939, +1.55490136, +1.99593031
653mean(0) = getMean(sample, rweight)
654mean(0) ! reference
655+0.538931966
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.538931966
662call setMeanMerged(mean(2), mean(1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
663mean(2)
664+0.538931966
665mean(0) ! reference
666+0.538931966
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, +3
676ub
677+2, +4
678sample = getUnifRand(0., 1., ub(nsam))
679sample
680+0.389442444, +0.455424368, +0.606934428, +0.814193249
681rweight = getUnifRand(1., 2., size(sample, 1, IK))
682rweight
683+1.82544494, +1.11103487, +1.85694730, +1.53554177
684mean(0) = getMean(sample, rweight)
685mean(0) ! reference
686+0.567892015
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.567892075
693call setMeanMerged(mean(2), mean(1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
694mean(2)
695+0.567892075
696mean(0) ! reference
697+0.567892015
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, +13
709sample = getUnifRand(0., 1., ub(nsam))
710sample
711+0.847686410, +0.987932384, +0.198018849, +0.307114780, +0.762261212, +0.389709711, +0.909324944, +0.977158546E-1, +0.604008555, +0.956929982, +0.456336141E-1, +0.382911325, +0.955774307
712rweight = getUnifRand(1., 2., size(sample, 1, IK))
713rweight
714+1.42221522, +1.76652336, +1.58145356, +1.16595054, +1.66225612, +1.79025745, +1.23157299, +1.34393477, +1.75656569, +1.40479469, +1.89837289, +1.52191210, +1.41057038
715mean(0) = getMean(sample, rweight)
716mean(0) ! reference
717+0.564273596
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.564273536
724call setMeanMerged(mean(2), mean(1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
725mean(2)
726+0.564273536
727mean(0) ! reference
728+0.564273596
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, +7
738ub
739+6, +12
740sample = getUnifRand(0., 1., ub(nsam))
741sample
742+0.850012362, +0.779312849, +0.328576744, +0.336791992, +0.523952425, +0.868522763, +0.298385799, +0.240834951E-1, +0.172997057, +0.719876945, +0.482980490, +0.681391358E-1
743rweight = getUnifRand(1., 2., size(sample, 1, IK))
744rweight
745+1.24348593, +1.90975738, +1.46687090, +1.51497221, +1.89248204, +1.73911059, +1.69809842, +1.05052841, +1.60351896, +1.87277389, +1.34884048, +1.04988599
746mean(0) = getMean(sample, rweight)
747mean(0) ! reference
748+0.485041678
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.485041738
755call setMeanMerged(mean(2), mean(1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
756mean(2)
757+0.485041738
758mean(0) ! reference
759+0.485041678
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, +7
769ub
770+6, +13
771sample = getUnifRand(0., 1., ub(nsam))
772sample
773+0.876530707, +0.157267094, +0.883412004, +0.154815853, +0.122767150, +0.352350056, +0.487301290, +0.369765401, +0.905390680, +0.301889539, +0.915843129, +0.521158874, +0.933727980
774rweight = getUnifRand(1., 2., size(sample, 1, IK))
775rweight
776+1.31678510, +1.94649076, +1.80073905, +1.52297151, +1.16900313, +1.00780749, +1.23268461, +1.50199580, +1.00478733, +1.70807457, +1.21136546, +1.25116885, +1.21510315
777mean(0) = getMean(sample, rweight)
778mean(0) ! reference
779+0.517805815
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.517805815
786call setMeanMerged(mean(2), mean(1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
787mean(2)
788+0.517805815
789mean(0) ! reference
790+0.517805815
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, +4
800ub
801+3, +8
802sample = getUnifRand(0., 1., ub(nsam))
803sample
804+0.746999264, +0.772125304, +0.595147133, +0.710202754, +0.314260244, +0.920885563, +0.668401062, +0.432263553
805rweight = getUnifRand(1., 2., size(sample, 1, IK))
806rweight
807+1.89723039, +1.12448907, +1.19223714, +1.42174125, +1.12921214, +1.54256248, +1.05259728, +1.96224689
808mean(0) = getMean(sample, rweight)
809mean(0) ! reference
810+0.647562921
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.647562921
817call setMeanMerged(mean(2), mean(1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
818mean(2)
819+0.647562921
820mean(0) ! reference
821+0.647562921
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, +4
831ub
832+3, +7
833sample = getUnifRand(0., 1., ub(nsam))
834sample
835+0.939530909, +0.367635071, +0.766378045, +0.414034128, +0.259239018, +0.915690482, +0.369608164
836rweight = getUnifRand(1., 2., size(sample, 1, IK))
837rweight
838+1.69386923, +1.45650268, +1.58792543, +1.20705438, +1.69190228, +1.56793857, +1.01857913
839mean(0) = getMean(sample, rweight)
840mean(0) ! reference
841+0.596105456
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.596105397
848call setMeanMerged(mean(2), mean(1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
849mean(2)
850+0.596105397
851mean(0) ! reference
852+0.596105456
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, +3
862ub
863+2, +8
864sample = getUnifRand(0., 1., ub(nsam))
865sample
866+0.834842503, +0.587104321, +0.409085393, +0.392835975, +0.117182434, +0.500619292, +0.995307744, +0.477947831
867rweight = getUnifRand(1., 2., size(sample, 1, IK))
868rweight
869+1.95303488, +1.15331650, +1.87951970, +1.28134584, +1.88879061, +1.29159021, +1.71719456, +1.38875723
870mean(0) = getMean(sample, rweight)
871mean(0) ! reference
872+0.543324828
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.543324769
879call setMeanMerged(mean(2), mean(1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
880mean(2)
881+0.543324769
882mean(0) ! reference
883+0.543324828
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, +3
893ub
894+2, +6
895sample = getUnifRand(0., 1., ub(nsam))
896sample
897+0.209422886, +0.320493460, +0.593413830, +0.574087381, +0.248882771E-1, +0.564098537
898rweight = getUnifRand(1., 2., size(sample, 1, IK))
899rweight
900+1.65988326, +1.71720719, +1.86698461, +1.05854750, +1.91033769, +1.99657559
901mean(0) = getMean(sample, rweight)
902mean(0) ! reference
903+0.370964438
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.370964468
910call setMeanMerged(mean(2), mean(1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
911mean(2)
912+0.370964468
913mean(0) ! reference
914+0.370964438
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, +2
929ub
930+1, +4
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.886028290, +0.453812718, -0.889998317, -0.224975824
937mean(:,0) = getMean(sample, dim)
938mean(:,0) ! reference
939+0.562167168E-1
940do isam = 1, nsam
941 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
942end do
943call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
944meanMerged
945+0.562167168E-1
946call setMeanMerged(mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
947mean(:,2)
948+0.562167168E-1
949mean(:,0) ! reference
950+0.562167168E-1
951
952
953dim = 2; lb(1) = 1; ub(1) = getUnifRand(1, 7)
954do isam = 2, nsam
955 lb(isam) = ub(isam - 1) + 1
956 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
957end do
958lb
959+1, +8
960ub
961+7, +8
962ndim = getUnifRand(1, minval(ub - lb + 1, 1))
963call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
964call setResized(meanMerged, ndim)
965sample = getUnifRand(-1., +1., ndim, ub(nsam))
966sample
967+0.307964563, +0.926474452, +0.833592534, -0.374875188, +0.880347013, +0.229835510E-3, -0.374148250, +0.428916812
968mean(:,0) = getMean(sample, dim)
969mean(:,0) ! reference
970+0.328562737
971do isam = 1, nsam
972 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
973end do
974call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
975meanMerged
976+0.328562737
977call setMeanMerged(mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
978mean(:,2)
979+0.328562737
980mean(:,0) ! reference
981+0.328562737
982
983
984dim = 2; lb(1) = 1; ub(1) = getUnifRand(1, 7)
985do isam = 2, nsam
986 lb(isam) = ub(isam - 1) + 1
987 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
988end do
989lb
990+1, +8
991ub
992+7, +8
993ndim = getUnifRand(1, minval(ub - lb + 1, 1))
994call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
995call setResized(meanMerged, ndim)
996sample = getUnifRand(-1., +1., ndim, ub(nsam))
997sample
998-0.214012623, -0.400241256, -0.444279909, -0.655349255, -0.230083466, -0.128688693, +0.103243113, +0.799262524
999mean(:,0) = getMean(sample, dim)
1000mean(:,0) ! reference
1001-0.146268696
1002do isam = 1, nsam
1003 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1004end do
1005call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1006meanMerged
1007-0.146268696
1008call setMeanMerged(mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1009mean(:,2)
1010-0.146268696
1011mean(:,0) ! reference
1012-0.146268696
1013
1014
1015dim = 2; lb(1) = 1; ub(1) = getUnifRand(1, 7)
1016do isam = 2, nsam
1017 lb(isam) = ub(isam - 1) + 1
1018 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1019end do
1020lb
1021+1, +2
1022ub
1023+1, +6
1024ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1025call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1026call setResized(meanMerged, ndim)
1027sample = getUnifRand(-1., +1., ndim, ub(nsam))
1028sample
1029-0.961787224, -0.559598684, +0.768479586, +0.691591859, +0.405498743E-1, +0.618446350
1030mean(:,0) = getMean(sample, dim)
1031mean(:,0) ! reference
1032+0.996136293E-1
1033do isam = 1, nsam
1034 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1035end do
1036call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1037meanMerged
1038+0.996136069E-1
1039call setMeanMerged(mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1040mean(:,2)
1041+0.996136069E-1
1042mean(:,0) ! reference
1043+0.996136293E-1
1044
1045
1046dim = 2; lb(1) = 1; ub(1) = getUnifRand(1, 7)
1047do isam = 2, nsam
1048 lb(isam) = ub(isam - 1) + 1
1049 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1050end do
1051lb
1052+1, +6
1053ub
1054+5, +9
1055ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1056call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1057call setResized(meanMerged, ndim)
1058sample = getUnifRand(-1., +1., ndim, ub(nsam))
1059sample
1060+0.636579394, +0.233046174, +0.716617703, -0.461002350, +0.853260994, -0.512781858, -0.700733304, -0.631747961, +0.554563046
1061+0.727544308, +0.820618272, -0.868051648, -0.429713845, -0.367620945, +0.701023936, -0.350947022, -0.755479336, -0.446876287E-1
1062-0.608101010, -0.955167890, +0.978379488, -0.452326655, +0.998688698, -0.533783436E-1, +0.919018388, -0.635264516, -0.449159265
1063mean(:,0) = getMean(sample, dim)
1064mean(:,0) ! reference
1065+0.764224306E-1, -0.630348772E-1, -0.285901222E-1
1066do isam = 1, nsam
1067 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1068end do
1069call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1070meanMerged
1071+0.764224529E-1, -0.630348772E-1, -0.285901204E-1
1072call setMeanMerged(mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1073mean(:,2)
1074+0.764224529E-1, -0.630348772E-1, -0.285901204E-1
1075mean(:,0) ! reference
1076+0.764224306E-1, -0.630348772E-1, -0.285901222E-1
1077
1078
1079dim = 2; lb(1) = 1; ub(1) = getUnifRand(1, 7)
1080do isam = 2, nsam
1081 lb(isam) = ub(isam - 1) + 1
1082 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1083end do
1084lb
1085+1, +4
1086ub
1087+3, +4
1088ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1089call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1090call setResized(meanMerged, ndim)
1091sample = getUnifRand(-1., +1., ndim, ub(nsam))
1092sample
1093+0.453999996, -0.831409335, -0.462193251, -0.726779819
1094mean(:,0) = getMean(sample, dim)
1095mean(:,0) ! reference
1096-0.391595602
1097do isam = 1, nsam
1098 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1099end do
1100call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1101meanMerged
1102-0.391595602
1103call setMeanMerged(mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1104mean(:,2)
1105-0.391595602
1106mean(:,0) ! reference
1107-0.391595602
1108
1109
1110dim = 2; lb(1) = 1; ub(1) = getUnifRand(1, 7)
1111do isam = 2, nsam
1112 lb(isam) = ub(isam - 1) + 1
1113 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1114end do
1115lb
1116+1, +3
1117ub
1118+2, +5
1119ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1120call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1121call setResized(meanMerged, ndim)
1122sample = getUnifRand(-1., +1., ndim, ub(nsam))
1123sample
1124+0.191084504, -0.496219158, +0.360538960, +0.476084352, -0.906051159
1125-0.944288492, +0.436568618, +0.694154501, +0.498358011E-1, +0.589161873
1126mean(:,0) = getMean(sample, dim)
1127mean(:,0) ! reference
1128-0.749125034E-1, +0.165086463
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.749125034E-1, +0.165086463
1135call setMeanMerged(mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1136mean(:,2)
1137-0.749125034E-1, +0.165086463
1138mean(:,0) ! reference
1139-0.749125034E-1, +0.165086463
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, +6
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.835810900E-1, -0.682339191, -0.553030729, +0.464090824, +0.968884826, +0.670804024
1157mean(:,0) = getMean(sample, dim)
1158mean(:,0) ! reference
1159+0.158665150
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.158665150
1166call setMeanMerged(mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1167mean(:,2)
1168+0.158665150
1169mean(:,0) ! reference
1170+0.158665150
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, +6
1180ub
1181+5, +11
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.367890120, +0.609076381, +0.401162028, -0.771420240, +0.933075070, -0.700249553, -0.906868339, -0.815922618, +0.802740455, -0.490402818, -0.417932272
1188+0.738120317, +0.189231277, -0.340724111, -0.359696507, +0.565462232, +0.604000092, +0.469835281, -0.866739750E-1, -0.849789977, -0.405657291E-2, -0.722428322
1189-0.663097858, -0.258183479, +0.294872403, +0.384969354, +0.363638520, -0.845884442, -0.388226986, -0.509362459, -0.681086779E-1, +0.399967074, -0.389128923
1190mean(:,0) = getMean(sample, dim)
1191mean(:,0) ! reference
1192-0.898956209E-1, +0.184799768E-1, -0.152595043
1193do isam = 1, nsam
1194 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1195end do
1196call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1197meanMerged
1198-0.898955911E-1, +0.184799843E-1, -0.152595028
1199call setMeanMerged(mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1200mean(:,2)
1201-0.898955911E-1, +0.184799843E-1, -0.152595028
1202mean(:,0) ! reference
1203-0.898956209E-1, +0.184799768E-1, -0.152595043
1204
1205
1206dim = 2; lb(1) = 1; ub(1) = getUnifRand(1, 7)
1207do isam = 2, nsam
1208 lb(isam) = ub(isam - 1) + 1
1209 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1210end do
1211lb
1212+1, +2
1213ub
1214+1, +3
1215ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1216call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1217call setResized(meanMerged, ndim)
1218sample = getUnifRand(-1., +1., ndim, ub(nsam))
1219sample
1220-0.908590198, -0.302977085, -0.435143232
1221mean(:,0) = getMean(sample, dim)
1222mean(:,0) ! reference
1223-0.548903525
1224do isam = 1, nsam
1225 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
1226end do
1227call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1228meanMerged
1229-0.548903525
1230call setMeanMerged(mean(:,2), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG))
1231mean(:,2)
1232-0.548903525
1233mean(:,0) ! reference
1234-0.548903525
1235
1236
1237!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1238!Compute the merged mean of a frequency weighted multivariate sample.
1239!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1240
1241
1242dim = 2; lb(1) = 1; ub(1) = getUnifRand(1, 7)
1243do isam = 2, nsam
1244 lb(isam) = ub(isam - 1) + 1
1245 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1246end do
1247lb
1248+1, +7
1249ub
1250+6, +12
1251ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1252call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1253call setResized(meanMerged, ndim)
1254sample = getUnifRand(-1., +1., ndim, ub(nsam))
1255sample
1256-0.384712934, +0.549722552, -0.137264729, +0.115150094, -0.100257397E-1, +0.840308785, -0.550587416, -0.964916825, +0.822875261, -0.500732899, -0.533808827, +0.936962247
1257iweight = getUnifRand(1, 10, size(sample, dim, IK))
1258iweight
1259+5, +9, +2, +10, +5, +9, +5, +3, +4, +2, +6, +7
1260mean(:,0) = getMean(sample, 2_IK, iweight)
1261mean(:,0) ! reference
1262+0.170325220
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.170325220
1269call setMeanMerged(mean(:,2), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1270mean(:,2)
1271+0.170325220
1272mean(:,0) ! reference
1273+0.170325220
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, +5
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.279239058, +0.994216681, -0.575693250, +0.922137499E-1, -0.759993434
1291-0.427760720, -0.801674724, +0.427672267, +0.767664909E-1, -0.371416569
1292iweight = getUnifRand(1, 10, size(sample, dim, IK))
1293iweight
1294+5, +9, +8, +5, +4
1295mean(:,0) = getMean(sample, 2_IK, iweight)
1296mean(:,0) ! reference
1297+0.101925634, -0.226913929
1298do isam = 1, nsam
1299 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1300end do
1301call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1302meanMerged
1303+0.101925634, -0.226913929
1304call setMeanMerged(mean(:,2), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1305mean(:,2)
1306+0.101925634, -0.226913929
1307mean(:,0) ! reference
1308+0.101925634, -0.226913929
1309
1310
1311dim = 2; lb(1) = 1; ub(1) = getUnifRand(1, 7)
1312do isam = 2, nsam
1313 lb(isam) = ub(isam - 1) + 1
1314 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1315end do
1316lb
1317+1, +4
1318ub
1319+3, +7
1320ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1321call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1322call setResized(meanMerged, ndim)
1323sample = getUnifRand(-1., +1., ndim, ub(nsam))
1324sample
1325+0.730616331, -0.132999539, +0.476830125, -0.251829743, +0.729217172, +0.875183105, +0.172075510
1326-0.682505846, +0.933519244, -0.287114024, -0.702607870, +0.840710402, -0.154170752, +0.926141858
1327+0.404745817, +0.138210416, +0.761262894, -0.433515072, +0.669943213, +0.527891040, +0.612375617
1328iweight = getUnifRand(1, 10, size(sample, dim, IK))
1329iweight
1330+9, +8, +2, +2, +4, +2, +3
1331mean(:,0) = getMean(sample, 2_IK, iweight)
1332mean(:,0) ! reference
1333+0.371500462, +0.172636136, +0.365885794
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.371500432, +0.172636122, +0.365885794
1340call setMeanMerged(mean(:,2), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1341mean(:,2)
1342+0.371500432, +0.172636122, +0.365885794
1343mean(:,0) ! reference
1344+0.371500462, +0.172636136, +0.365885794
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, +4
1354ub
1355+3, +8
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.645502090, +0.669400930, +0.343166232, -0.371553659, +0.558206797, +0.305296898, +0.789406538, +0.235946059
1362iweight = getUnifRand(1, 10, size(sample, dim, IK))
1363iweight
1364+6, +1, +9, +3, +4, +6, +4, +6
1365mean(:,0) = getMean(sample, 2_IK, iweight)
1366mean(:,0) ! reference
1367+0.189952165
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.189952165
1374call setMeanMerged(mean(:,2), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1375mean(:,2)
1376+0.189952165
1377mean(:,0) ! reference
1378+0.189952165
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, +5
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.595678687, -0.202252388, +0.264178634, +0.703871250, -0.252048373
1396iweight = getUnifRand(1, 10, size(sample, dim, IK))
1397iweight
1398+2, +1, +1, +6, +3
1399mean(:,0) = getMean(sample, 2_IK, iweight)
1400mean(:,0) ! reference
1401+0.363105088
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.363105088
1408call setMeanMerged(mean(:,2), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1409mean(:,2)
1410+0.363105088
1411mean(:,0) ! reference
1412+0.363105088
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, +7
1422ub
1423+6, +7
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.783409595, -0.403064728, +0.469662547, -0.770673156, +0.333247185, +0.380345225, +0.717551708
1430iweight = getUnifRand(1, 10, size(sample, dim, IK))
1431iweight
1432+7, +3, +4, +1, +10, +10, +6
1433mean(:,0) = getMean(sample, 2_IK, iweight)
1434mean(:,0) ! reference
1435+0.142832920
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.142832905
1442call setMeanMerged(mean(:,2), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1443mean(:,2)
1444+0.142832905
1445mean(:,0) ! reference
1446+0.142832920
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, +3
1456ub
1457+2, +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.168335438E-1, +0.140553713, -0.199712873, +0.934781551, -0.214332819, +0.518136501, +0.138473868
1464-0.638781548, -0.714817882, +0.895185471E-1, -0.236177444E-1, -0.561852098, +0.222158670, +0.131550312
1465iweight = getUnifRand(1, 10, size(sample, dim, IK))
1466iweight
1467+5, +3, +1, +1, +1, +6, +10
1468mean(:,0) = getMean(sample, 2_IK, iweight)
1469mean(:,0) ! reference
1470+0.204448983, -0.117994718
1471do isam = 1, nsam
1472 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1473end do
1474call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1475meanMerged
1476+0.204448998, -0.117994718
1477call setMeanMerged(mean(:,2), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1478mean(:,2)
1479+0.204448998, -0.117994718
1480mean(:,0) ! reference
1481+0.204448983, -0.117994718
1482
1483
1484dim = 2; lb(1) = 1; ub(1) = getUnifRand(1, 7)
1485do isam = 2, nsam
1486 lb(isam) = ub(isam - 1) + 1
1487 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1488end do
1489lb
1490+1, +5
1491ub
1492+4, +10
1493ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1494call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1495call setResized(meanMerged, ndim)
1496sample = getUnifRand(-1., +1., ndim, ub(nsam))
1497sample
1498+0.668281317E-1, +0.803951263, -0.436257243, -0.256437182, -0.922491908, +0.282671809, -0.533916473, -0.124479532, +0.271448731, +0.451467514
1499+0.926629543, -0.446412802, -0.170309901, -0.568793416, -0.936034203, +0.437713504, -0.681233048, -0.723099232, +0.909014106, -0.826038122E-1
1500iweight = getUnifRand(1, 10, size(sample, dim, IK))
1501iweight
1502+10, +2, +8, +2, +10, +1, +3, +4, +1, +5
1503mean(:,0) = getMean(sample, 2_IK, iweight)
1504mean(:,0) ! reference
1505-0.222606018, -0.162811413
1506do isam = 1, nsam
1507 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1508end do
1509call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1510meanMerged
1511-0.222606018, -0.162811443
1512call setMeanMerged(mean(:,2), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1513mean(:,2)
1514-0.222606018, -0.162811443
1515mean(:,0) ! reference
1516-0.222606018, -0.162811413
1517
1518
1519dim = 2; lb(1) = 1; ub(1) = getUnifRand(1, 7)
1520do isam = 2, nsam
1521 lb(isam) = ub(isam - 1) + 1
1522 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1523end do
1524lb
1525+1, +6
1526ub
1527+5, +12
1528ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1529call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1530call setResized(meanMerged, ndim)
1531sample = getUnifRand(-1., +1., ndim, ub(nsam))
1532sample
1533+0.280038595, +0.882654428, +0.306001306, +0.278992653E-1, -0.862076402, -0.309554338E-1, -0.718109369, -0.290211439, -0.396250844, -0.553926229, +0.684447765, -0.910490274
1534iweight = getUnifRand(1, 10, size(sample, dim, IK))
1535iweight
1536+5, +8, +9, +8, +8, +5, +7, +7, +6, +7, +3, +6
1537mean(:,0) = getMean(sample, 2_IK, iweight)
1538mean(:,0) ! reference
1539-0.156146675
1540do isam = 1, nsam
1541 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1542end do
1543call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1544meanMerged
1545-0.156146660
1546call setMeanMerged(mean(:,2), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1547mean(:,2)
1548-0.156146660
1549mean(:,0) ! reference
1550-0.156146675
1551
1552
1553dim = 2; lb(1) = 1; ub(1) = getUnifRand(1, 7)
1554do isam = 2, nsam
1555 lb(isam) = ub(isam - 1) + 1
1556 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1557end do
1558lb
1559+1, +6
1560ub
1561+5, +7
1562ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1563call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1564call setResized(meanMerged, ndim)
1565sample = getUnifRand(-1., +1., ndim, ub(nsam))
1566sample
1567-0.527770281, -0.955617428E-2, +0.224102855, +0.468953490, +0.914654732, -0.933868885E-1, -0.558397412
1568-0.498374701, +0.854009986, +0.767431259E-1, +0.936418176, +0.796172738, +0.176037550E-1, +0.467400074
1569iweight = getUnifRand(1, 10, size(sample, dim, IK))
1570iweight
1571+6, +9, +3, +10, +7, +5, +8
1572mean(:,0) = getMean(sample, 2_IK, iweight)
1573mean(:,0) ! reference
1574+0.745351166E-1, +0.493555874
1575do isam = 1, nsam
1576 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
1577end do
1578call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1579meanMerged
1580+0.745351240E-1, +0.493555844
1581call setMeanMerged(mean(:,2), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
1582mean(:,2)
1583+0.745351240E-1, +0.493555844
1584mean(:,0) ! reference
1585+0.745351166E-1, +0.493555874
1586
1587
1588!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1589!Compute the merged mean of a reliability weighted multivariate sample.
1590!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1591
1592
1593lb(1) = 1; ub(1) = getUnifRand(1, 7)
1594do isam = 2, nsam
1595 lb(isam) = ub(isam - 1) + 1
1596 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1597end do
1598lb
1599+1, +7
1600ub
1601+6, +12
1602ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1603call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1604call setResized(meanMerged, ndim)
1605sample = getUnifRand(-1., +1., ndim, ub(nsam))
1606sample
1607+0.800471544, +0.140030146, +0.504118919, +0.608778596, +0.364939332, +0.792155981, -0.663981557, +0.506578684, +0.644219875, +0.904301763, +0.311916947, -0.754499316
1608-0.660890818, +0.115471721, +0.656057358, -0.441813707, -0.218908787, -0.567436576, +0.327087879, +0.777155280, +0.534326434, +0.395199895, +0.894017220, -0.138114810
1609-0.742075562, -0.189094543, +0.891225100, +0.959707975, -0.786428452, +0.627806187E-1, +0.923795581, -0.439095497E-1, +0.679832339, +0.613041639, -0.507868528E-1, -0.554790616
1610-0.423260093, +0.428040028E-1, -0.466392398, -0.171620369, +0.509369850, +0.376764536, -0.272278428, -0.643194556, -0.311586261, +0.736231804E-1, -0.832336307, +0.790560603
1611+0.870278120, +0.606098533, +0.980907917, +0.840212822, -0.985554576, -0.686565638, -0.172982216, +0.364545584E-1, -0.954738140, +0.489278674, +0.535527706, -0.369416118
1612rweight = getUnifRand(1, 10, size(sample, dim, IK))
1613rweight
1614+4.00000000, +9.00000000, +10.0000000, +6.00000000, +2.00000000, +10.0000000, +8.00000000, +5.00000000, +5.00000000, +9.00000000, +9.00000000, +8.00000000
1615mean(:,0) = getMean(sample, dim, rweight)
1616mean(:,0) ! reference
1617+0.319524378, +0.186651036, +0.238202900, -0.113778017, +0.179320514
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.319524378, +0.186651006, +0.238202810, -0.113778003, +0.179320499
1624call setMeanMerged(mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
1625mean(:,2)
1626+0.319524378, +0.186651006, +0.238202810, -0.113778003, +0.179320499
1627mean(:,0) ! reference
1628+0.319524378, +0.186651036, +0.238202900, -0.113778017, +0.179320514
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, +2
1638ub
1639+1, +5
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.503708124E-1, +0.597526789, +0.169150472, +0.614407063, -0.893617749
1646rweight = getUnifRand(1, 10, size(sample, dim, IK))
1647rweight
1648+4.00000000, +8.00000000, +9.00000000, +1.00000000, +5.00000000
1649mean(:,0) = getMean(sample, dim, rweight)
1650mean(:,0) ! reference
1651+0.832371712E-1
1652do isam = 1, nsam
1653 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, rweight(lb(isam):ub(isam)))
1654end do
1655call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
1656meanMerged
1657+0.832371637E-1
1658call setMeanMerged(mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
1659mean(:,2)
1660+0.832371637E-1
1661mean(:,0) ! reference
1662+0.832371712E-1
1663
1664
1665lb(1) = 1; ub(1) = getUnifRand(1, 7)
1666do isam = 2, nsam
1667 lb(isam) = ub(isam - 1) + 1
1668 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1669end do
1670lb
1671+1, +8
1672ub
1673+7, +13
1674ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1675call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1676call setResized(meanMerged, ndim)
1677sample = getUnifRand(-1., +1., ndim, ub(nsam))
1678sample
1679+0.190246105, -0.607671618, +0.561362743, -0.114269495, +0.839279413, +0.430876255, +0.992139101, -0.282889247, +0.723344088E-1, -0.988511562, -0.454624891E-1, +0.149570584, +0.339024067E-1
1680+0.615563273, -0.338718891, -0.645978808, -0.167361379, +0.767328382, +0.139996886, +0.739565730, +0.783224463, -0.904332995, +0.784183979, +0.820348024, -0.710049033, +0.687514424
1681+0.204392195, +0.935039520, +0.618576288, +0.794567704, +0.462361574, -0.517475605E-1, +0.537747145E-1, -0.694197774, +0.891687989, +0.696514249, -0.946390033, -0.865288258, +0.324153781
1682+0.815904737, +0.375840306, -0.755804777E-1, -0.968709588, +0.730776310, +0.837359190, -0.927855849, +0.693623185, +0.728870034, -0.109955907, -0.629399538, +0.817830086, +0.666112304
1683rweight = getUnifRand(1, 10, size(sample, dim, IK))
1684rweight
1685+7.00000000, +2.00000000, +6.00000000, +1.00000000, +10.0000000, +2.00000000, +8.00000000, +3.00000000, +8.00000000, +6.00000000, +8.00000000, +4.00000000, +6.00000000
1686mean(:,0) = getMean(sample, dim, rweight)
1687mean(:,0) ! reference
1688+0.208434954, +0.297547340, +0.181687504, +0.226554215
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.208434939, +0.297547340, +0.181687504, +0.226554215
1695call setMeanMerged(mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
1696mean(:,2)
1697+0.208434939, +0.297547340, +0.181687504, +0.226554215
1698mean(:,0) ! reference
1699+0.208434954, +0.297547340, +0.181687504, +0.226554215
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, +6
1709ub
1710+5, +8
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.921881676, -0.398877025, +0.370139599, +0.702141523, +0.120090127, -0.752707124, +0.725308895, +0.978895426
1717rweight = getUnifRand(1, 10, size(sample, dim, IK))
1718rweight
1719+10.0000000, +1.00000000, +2.00000000, +4.00000000, +9.00000000, +8.00000000, +10.0000000, +9.00000000
1720mean(:,0) = getMean(sample, dim, rweight)
1721mean(:,0) ! reference
1722+0.953481644E-1
1723do isam = 1, nsam
1724 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, rweight(lb(isam):ub(isam)))
1725end do
1726call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
1727meanMerged
1728+0.953481719E-1
1729call setMeanMerged(mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
1730mean(:,2)
1731+0.953481719E-1
1732mean(:,0) ! reference
1733+0.953481644E-1
1734
1735
1736lb(1) = 1; ub(1) = getUnifRand(1, 7)
1737do isam = 2, nsam
1738 lb(isam) = ub(isam - 1) + 1
1739 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1740end do
1741lb
1742+1, +2
1743ub
1744+1, +8
1745ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1746call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1747call setResized(meanMerged, ndim)
1748sample = getUnifRand(-1., +1., ndim, ub(nsam))
1749sample
1750+0.234567642, +0.312389135E-1, -0.326205850, -0.980954170, -0.703580379, -0.539213657, -0.102962613, -0.677458525
1751rweight = getUnifRand(1, 10, size(sample, dim, IK))
1752rweight
1753+5.00000000, +4.00000000, +1.00000000, +10.0000000, +5.00000000, +9.00000000, +5.00000000, +6.00000000
1754mean(:,0) = getMean(sample, dim, rweight)
1755mean(:,0) ! reference
1756-0.484185368
1757do isam = 1, nsam
1758 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, rweight(lb(isam):ub(isam)))
1759end do
1760call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
1761meanMerged
1762-0.484185398
1763call setMeanMerged(mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
1764mean(:,2)
1765-0.484185398
1766mean(:,0) ! reference
1767-0.484185368
1768
1769
1770lb(1) = 1; ub(1) = getUnifRand(1, 7)
1771do isam = 2, nsam
1772 lb(isam) = ub(isam - 1) + 1
1773 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1774end do
1775lb
1776+1, +8
1777ub
1778+7, +13
1779ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1780call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1781call setResized(meanMerged, ndim)
1782sample = getUnifRand(-1., +1., ndim, ub(nsam))
1783sample
1784-0.753197193, +0.172114730, +0.854082704, +0.575641036, +0.174626112, -0.459991217, -0.211122274, +0.437294126, -0.767268538, +0.496149063E-2, -0.348613262, -0.847686291, +0.812623978
1785+0.411628127, +0.276562333, +0.935594201, +0.346701145E-1, +0.276611090, +0.495509148, -0.803940415, +0.611291170, -0.729983568, +0.119412065, +0.936248541, -0.183007598, +0.776155591
1786-0.329596519, +0.261848211, +0.929041743, -0.492847443, +0.461137056, +0.728097796, +0.905899763, -0.339400411, -0.184212685, -0.268014669, +0.298787355E-1, -0.435762405, +0.909954667
1787+0.905327320, -0.163976312, -0.164536834, +0.650094748, +0.144749880E-1, -0.764482379, -0.767233610, +0.967568874, +0.788559556, +0.142902136E-1, +0.885273576, -0.643710375, -0.503027439
1788+0.846656203, -0.382355452E-1, -0.571891546, +0.134841919, -0.131641984, -0.699191689, +0.105100155, +0.783560276E-1, +0.401389241, +0.941381097, -0.987400174, +0.383214235, -0.843565702
1789+0.841886044, +0.233924389E-1, +0.848460913, -0.457740545, -0.128737092, +0.648412108, -0.692012429, -0.231123924, +0.350592852, -0.860209465, +0.380976915, +0.340142846, -0.316105008
1790rweight = getUnifRand(1, 10, size(sample, dim, IK))
1791rweight
1792+2.00000000, +10.0000000, +6.00000000, +2.00000000, +6.00000000, +6.00000000, +4.00000000, +3.00000000, +9.00000000, +7.00000000, +10.0000000, +3.00000000, +6.00000000
1793mean(:,0) = getMean(sample, dim, rweight)
1794mean(:,0) ! reference
1795-0.375459380E-1, +0.273770928, +0.232511654, +0.934877768E-1, -0.131943583, +0.786087438E-1
1796do isam = 1, nsam
1797 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, rweight(lb(isam):ub(isam)))
1798end do
1799call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
1800meanMerged
1801-0.375459380E-1, +0.273770928, +0.232511654, +0.934877843E-1, -0.131943583, +0.786087438E-1
1802call setMeanMerged(mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
1803mean(:,2)
1804-0.375459380E-1, +0.273770928, +0.232511654, +0.934877843E-1, -0.131943583, +0.786087438E-1
1805mean(:,0) ! reference
1806-0.375459380E-1, +0.273770928, +0.232511654, +0.934877768E-1, -0.131943583, +0.786087438E-1
1807
1808
1809lb(1) = 1; ub(1) = getUnifRand(1, 7)
1810do isam = 2, nsam
1811 lb(isam) = ub(isam - 1) + 1
1812 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1813end do
1814lb
1815+1, +6
1816ub
1817+5, +9
1818ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1819call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1820call setResized(meanMerged, ndim)
1821sample = getUnifRand(-1., +1., ndim, ub(nsam))
1822sample
1823+0.672057867E-1, -0.878316402, -0.956241608, +0.925262809, +0.848703861, -0.332255125, +0.144010544, -0.515627861E-2, -0.229692221
1824rweight = getUnifRand(1, 10, size(sample, dim, IK))
1825rweight
1826+10.0000000, +6.00000000, +9.00000000, +9.00000000, +7.00000000, +1.00000000, +7.00000000, +1.00000000, +3.00000000
1827mean(:,0) = getMean(sample, dim, rweight)
1828mean(:,0) ! reference
1829+0.197332632E-1
1830do isam = 1, nsam
1831 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, rweight(lb(isam):ub(isam)))
1832end do
1833call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
1834meanMerged
1835+0.197332613E-1
1836call setMeanMerged(mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
1837mean(:,2)
1838+0.197332613E-1
1839mean(:,0) ! reference
1840+0.197332632E-1
1841
1842
1843lb(1) = 1; ub(1) = getUnifRand(1, 7)
1844do isam = 2, nsam
1845 lb(isam) = ub(isam - 1) + 1
1846 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1847end do
1848lb
1849+1, +3
1850ub
1851+2, +7
1852ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1853call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1854call setResized(meanMerged, ndim)
1855sample = getUnifRand(-1., +1., ndim, ub(nsam))
1856sample
1857+0.133295655, -0.931665063, -0.268453121, +0.452363372, -0.309066534, -0.750119686, -0.393433928
1858rweight = getUnifRand(1, 10, size(sample, dim, IK))
1859rweight
1860+10.0000000, +7.00000000, +4.00000000, +1.00000000, +3.00000000, +6.00000000, +2.00000000
1861mean(:,0) = getMean(sample, dim, rweight)
1862mean(:,0) ! reference
1863-0.364391953
1864do isam = 1, nsam
1865 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, rweight(lb(isam):ub(isam)))
1866end do
1867call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
1868meanMerged
1869-0.364391923
1870call setMeanMerged(mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
1871mean(:,2)
1872-0.364391923
1873mean(:,0) ! reference
1874-0.364391953
1875
1876
1877lb(1) = 1; ub(1) = getUnifRand(1, 7)
1878do isam = 2, nsam
1879 lb(isam) = ub(isam - 1) + 1
1880 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1881end do
1882lb
1883+1, +2
1884ub
1885+1, +3
1886ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1887call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1888call setResized(meanMerged, ndim)
1889sample = getUnifRand(-1., +1., ndim, ub(nsam))
1890sample
1891+0.687152743, -0.565898180, -0.154854059
1892rweight = getUnifRand(1, 10, size(sample, dim, IK))
1893rweight
1894+10.0000000, +1.00000000, +5.00000000
1895mean(:,0) = getMean(sample, dim, rweight)
1896mean(:,0) ! reference
1897+0.345709980
1898do isam = 1, nsam
1899 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, rweight(lb(isam):ub(isam)))
1900end do
1901call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
1902meanMerged
1903+0.345709980
1904call setMeanMerged(mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
1905mean(:,2)
1906+0.345709980
1907mean(:,0) ! reference
1908+0.345709980
1909
1910
1911lb(1) = 1; ub(1) = getUnifRand(1, 7)
1912do isam = 2, nsam
1913 lb(isam) = ub(isam - 1) + 1
1914 ub(isam) = ub(isam - 1) + getUnifRand(1, 7)
1915end do
1916lb
1917+1, +5
1918ub
1919+4, +6
1920ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1921call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1922call setResized(meanMerged, ndim)
1923sample = getUnifRand(-1., +1., ndim, ub(nsam))
1924sample
1925+0.726318836, -0.640252709, +0.172882915, -0.439074516, -0.703207850, -0.568240166
1926rweight = getUnifRand(1, 10, size(sample, dim, IK))
1927rweight
1928+5.00000000, +10.0000000, +6.00000000, +8.00000000, +5.00000000, +7.00000000
1929mean(:,0) = getMean(sample, dim, rweight)
1930mean(:,0) ! reference
1931-0.310730517
1932do isam = 1, nsam
1933 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, rweight(lb(isam):ub(isam)))
1934end do
1935call setMeanMerged(meanMerged, mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
1936meanMerged
1937-0.310730547
1938call setMeanMerged(mean(:,2), mean(:,1), real(sum(rweight(:ub(1))) / sum(rweight), TKG))
1939mean(:,2)
1940-0.310730547
1941mean(:,0) ! reference
1942-0.310730517
1943
1944
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 at Austin

Definition at line 4548 of file pm_sampleMean.F90.


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