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

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

Detailed Description

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

See the documentation of pm_sampleCov for more information and definition online updating of sample covariance.

Note
The input and output variances of this generic interface are all biased variances.
A biased covariance can be readily unbiased by multiplying it with the appropriate bias-correction factors detailed in the documentation of pm_sampleCov.
Parameters
[out]cov: The output object of the same type and kind and rank and shape as covA, containing the biased covariance of the sample resulting form the merger of the two samples.
(optional. If missing, the resulting merged covariance will be written to the argument covB.)
[out]mean: 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]covB: The input or input/output object of the same type and kind and rank and shape as the input argument covA, containing the biased covariance of the second sample that must be merged with the first sample.
If the input argument cov is missing, then covB contains the updated biased covariance of the merged sample on return.
Otherwise, the contents of covB remain intact upon return.
[in]meanB: The input or input/output object of the same type and kind and rank as the input argument covA of size size(covA, 1), containing the mean of the second sample that must be merged with the mean of the first sample meanA.
If the input argument mean is missing, then meanB contains the updated mean of the merged sample on return.
Otherwise, the contents of meanB remain intact upon return.
[in]covA: The input contiguous matrix of shape (1 : ndim, 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 biased covariance of the first sample that must be merged with the second sample.
[in]meanA: The input object of the same type and kind as the input argument covA of size size(covA, 1), containing the mean of the first sample that must be merged with the mean of the second sample meanB.
[in]fracA: The input scalar of type real of the same kind as covA, 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)).
[in]subset: The input scalar constant that can be:
  1. The constant lowDia, implying that only the lower-diagonal subset of the input cov, covB, and covA matrices must be accessed and/or manipulated.
  2. The constant uppDia, implying that only the upper-diagonal subset of the input cov, covB, and covA matrices must be accessed and/or manipulated.
This input argument is merely serves to resolve the different procedures of this generic interface from each other at compile-time.


Possible calling interfaces

call setCovMeanMerged(covB(1:ndim, 1:ndim), meanB(1:ndim), covA(1:ndim, 1:ndim), meanA(1:ndim), fracA, subset)
call setCovMeanMerged(cov(1:ndim, 1:ndim), mean(1:ndim), covB(1:ndim, 1:ndim), meanB(1:ndim), covA(1:ndim, 1:ndim), meanA(1:ndim), fracA, subset)
Return the merged covariance and mean of a sample resulting from the merger of two separate (potentia...
This module contains classes and procedures for computing the properties related to the covariance ma...
Warning
The condition 0 < fracA .and. fracA < 1 must hold for the corresponding input arguments.
The condition all(shape(covB) == shape(covA)) must hold for the corresponding input arguments.
The condition all(size(meanB) == shape(covA)) must hold for the corresponding input arguments.
The condition all(size(meanA) == shape(covA)) must hold for the corresponding input arguments.
The condition all(size(mean) == shape(covA)) must hold for the corresponding input arguments.
The condition all(shape(cov) == shape(covA)) 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
setCovMeanMerged
getVarCorrection
getMeanMerged
setMeanMerged
getVarMerged
setVarMerged


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_sampleCov, only: getCov
6 use pm_sampleMean, only: getMean
7 use pm_sampleCov, only: uppDia, lowDia
10 use pm_arrayResize, only: setResized
11 use pm_distUnif, only: getUnifRand
12 use pm_arrayRange, only: getRange
13 use pm_io, only: display_type
14
15 implicit none
16
17 integer(IK) , parameter :: nsam = 2
18 integer(IK) , allocatable :: iweight(:)
19 integer(IK) :: isam, ndim, lb(nsam), ub(nsam)
20 integer(IK) :: dim, itry, ntry = 10
21 type(display_type) :: disp
22 disp = display_type(file = "main.out.F90")
23
24 call disp%skip()
25 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
26 call disp%show("!Compute the biased merged covariance of a multivariate sample.")
27 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
28 call disp%skip()
29
30 block
31 real(TKG), allocatable :: mean(:,:), cov(:,:,:), meanMerged(:), covMerged(:,:)
32 real(TKG), allocatable :: sample(:,:)
33 do itry = 1, ntry
34 call disp%skip()
35 call disp%show("dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)")
36 dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
37 call disp%show("do isam = 2, nsam")
38 call disp%show(" lb(isam) = ub(isam - 1) + 1")
39 call disp%show(" ub(isam) = ub(isam - 1) + getUnifRand(2, 7)")
40 call disp%show("end do")
41 do isam = 2, nsam
42 lb(isam) = ub(isam - 1) + 1
43 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
44 end do
45 call disp%show("lb")
46 call disp%show( lb )
47 call disp%show("ub")
48 call disp%show( ub )
49 call disp%show("ndim = getUnifRand(1, minval(ub - lb + 1, 1))")
50 ndim = getUnifRand(1, minval(ub - lb + 1, 1))
51 call disp%show("call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])")
52 call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
53 call disp%show("call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])")
54 call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
55 call disp%show("call setResized(covMerged, [ndim, ndim])")
56 call setResized(covMerged, [ndim, ndim])
57 call disp%show("call setResized(meanMerged, ndim)")
58 call setResized(meanMerged, ndim)
59 call disp%show("sample = getUnifRand(-1., +1., ndim, ub(nsam))")
60 sample = getUnifRand(-1., +1., ndim, ub(nsam))
61 call disp%show("sample")
62 call disp%show( sample )
63 call disp%show("cov(:,:,0) = getCov(sample, dim)")
64 cov(:,:,0) = getCov(sample, dim)
65 call disp%show("cov(:,:,0) ! reference")
66 call disp%show( cov(:,:,0) )
67 call disp%show("mean(:,0) = getMean(sample, dim)")
68 mean(:,0) = getMean(sample, dim)
69 call disp%show("mean(:,0) ! reference")
70 call disp%show( mean(:,0) )
71 call disp%show("do isam = 1, nsam")
72 call disp%show(" cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)")
73 call disp%show(" mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)")
74 call disp%show("end do")
75 do isam = 1, nsam
76 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
77 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
78 end do
79 call disp%show("call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)")
80 call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
81 call disp%show("covMerged")
82 call disp%show( covMerged )
83 call disp%show("call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), lowDia)")
84 call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), lowDia)
85 call disp%show("covMerged")
86 call disp%show( covMerged )
87 call disp%show("call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)")
88 call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
89 call disp%show("cov(:,:,2)")
90 call disp%show( cov(:,:,2) )
91 call disp%show("cov(:,:,0) ! reference")
92 call disp%show( cov(:,:,0) )
93 call disp%skip()
94 end do
95 end block
96
97 call disp%skip()
98 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
99 call disp%show("!Compute the biased merged covariance of a frequency weighted multivariate sample.")
100 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
101 call disp%skip()
102
103 block
104 real(TKG), allocatable :: mean(:,:), cov(:,:,:), meanMerged(:), covMerged(:,:)
105 real(TKG), allocatable :: sample(:,:)
106 do itry = 1, ntry
107 call disp%skip()
108 call disp%show("dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)")
109 dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
110 call disp%show("do isam = 2, nsam")
111 call disp%show(" lb(isam) = ub(isam - 1) + 1")
112 call disp%show(" ub(isam) = ub(isam - 1) + getUnifRand(2, 7)")
113 call disp%show("end do")
114 do isam = 2, nsam
115 lb(isam) = ub(isam - 1) + 1
116 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
117 end do
118 call disp%show("lb")
119 call disp%show( lb )
120 call disp%show("ub")
121 call disp%show( ub )
122 call disp%show("ndim = getUnifRand(1, minval(ub - lb + 1, 1))")
123 ndim = getUnifRand(1, minval(ub - lb + 1, 1))
124 call disp%show("call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])")
125 call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
126 call disp%show("call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])")
127 call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
128 call disp%show("call setResized(covMerged, [ndim, ndim])")
129 call setResized(covMerged, [ndim, ndim])
130 call disp%show("call setResized(meanMerged, ndim)")
131 call setResized(meanMerged, ndim)
132 call disp%show("sample = getUnifRand(-1., +1., ndim, ub(nsam))")
133 sample = getUnifRand(-1., +1., ndim, ub(nsam))
134 call disp%show("sample")
135 call disp%show( sample )
136 call disp%show("iweight = getUnifRand(1, 10, size(sample, dim, IK))")
137 iweight = getUnifRand(1, 10, size(sample, dim, IK))
138 call disp%show("iweight")
139 call disp%show( iweight )
140 call disp%show("cov(:,:,0) = getCov(sample, dim, iweight)")
141 cov(:,:,0) = getCov(sample, dim, iweight)
142 call disp%show("cov(:,:,0) ! reference")
143 call disp%show( cov(:,:,0) )
144 call disp%show("mean(:,0) = getMean(sample, dim, iweight)")
145 mean(:,0) = getMean(sample, dim, iweight)
146 call disp%show("mean(:,0) ! reference")
147 call disp%show( mean(:,0) )
148 call disp%show("do isam = 1, nsam")
149 call disp%show(" cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))")
150 call disp%show(" mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))")
151 call disp%show("end do")
152 do isam = 1, nsam
153 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
154 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
155 end do
156 call disp%show("call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)")
157 call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
158 call disp%show("covMerged")
159 call disp%show( covMerged )
160 call disp%show("call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), lowDia)")
161 call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), lowDia)
162 call disp%show("covMerged")
163 call disp%show( covMerged )
164 call disp%show("call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)")
165 call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
166 call disp%show("cov(:,:,2)")
167 call disp%show( cov(:,:,2) )
168 call disp%show("cov(:,:,0) ! reference")
169 call disp%show( cov(:,:,0) )
170 call disp%skip()
171 end do
172 end block
173
174 call disp%skip()
175 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
176 call disp%show("!Compute the biased merged covariance of a reliability weighted multivariate sample.")
177 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
178 call disp%skip()
179
180 block
181 real(TKG), allocatable :: mean(:,:), cov(:,:,:), meanMerged(:), covMerged(:,:)
182 real(TKG), allocatable :: sample(:,:)
183 real(TKG), allocatable :: rweight(:)
184 do itry = 1, ntry
185 call disp%skip()
186 call disp%show("dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)")
187 dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
188 call disp%show("do isam = 2, nsam")
189 call disp%show(" lb(isam) = ub(isam - 1) + 1")
190 call disp%show(" ub(isam) = ub(isam - 1) + getUnifRand(2, 7)")
191 call disp%show("end do")
192 do isam = 2, nsam
193 lb(isam) = ub(isam - 1) + 1
194 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
195 end do
196 call disp%show("lb")
197 call disp%show( lb )
198 call disp%show("ub")
199 call disp%show( ub )
200 call disp%show("ndim = getUnifRand(1, minval(ub - lb + 1, 1))")
201 ndim = getUnifRand(1, minval(ub - lb + 1, 1))
202 call disp%show("call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])")
203 call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
204 call disp%show("call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])")
205 call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
206 call disp%show("call setResized(covMerged, [ndim, ndim])")
207 call setResized(covMerged, [ndim, ndim])
208 call disp%show("call setResized(meanMerged, ndim)")
209 call setResized(meanMerged, ndim)
210 call disp%show("sample = getUnifRand(-1., +1., ndim, ub(nsam))")
211 sample = getUnifRand(-1., +1., ndim, ub(nsam))
212 call disp%show("sample")
213 call disp%show( sample )
214 call disp%show("rweight = getUnifRand(1., 2., size(sample, dim, IK))")
215 rweight = getUnifRand(1., 2., size(sample, dim, IK))
216 call disp%show("rweight")
217 call disp%show( rweight )
218 call disp%show("cov(:,:,0) = getCov(sample, 2_IK, rweight)")
219 cov(:,:,0) = getCov(sample, 2_IK, rweight)
220 call disp%show("cov(:,:,0) ! reference")
221 call disp%show( cov(:,:,0) )
222 call disp%show("mean(:,0) = getMean(sample, dim, rweight)")
223 mean(:,0) = getMean(sample, dim, rweight)
224 call disp%show("mean(:,0) ! reference")
225 call disp%show( mean(:,0) )
226 call disp%show("do isam = 1, nsam")
227 call disp%show(" cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))")
228 call disp%show(" mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))")
229 call disp%show("end do")
230 do isam = 1, nsam
231 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
232 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
233 end do
234 call disp%show("call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), uppDia)")
235 call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), uppDia)
236 call disp%show("covMerged")
237 call disp%show( covMerged )
238 call disp%show("call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), lowDia)")
239 call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), lowDia)
240 call disp%show("covMerged")
241 call disp%show( covMerged )
242 call disp%show("call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), uppDia)")
243 call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), uppDia)
244 call disp%show("cov(:,:,2)")
245 call disp%show( cov(:,:,2) )
246 call disp%show("cov(:,:,0) ! reference")
247 call disp%show( cov(:,:,0) )
248 call disp%skip()
249 end do
250 end block
251
252end 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 (optionally unbiased) covariance matrix of a pair of (potentially weighted) t...
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
This module contains classes and procedures for computing the first moment (i.e., the statistical mea...
Generate and return an object of type display_type.
Definition: pm_io.F90:10282

Example Unix compile command via Intel ifort compiler
1#!/usr/bin/env sh
2rm main.exe
3ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example Windows Batch compile command via Intel ifort compiler
1del main.exe
2set PATH=..\..\..\lib;%PATH%
3ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
4main.exe

Example Unix / MinGW compile command via GNU gfortran compiler
1#!/usr/bin/env sh
2rm main.exe
3gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example output
1
2!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3!Compute the biased merged covariance of a multivariate sample.
4!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5
6
7dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
8do isam = 2, nsam
9 lb(isam) = ub(isam - 1) + 1
10 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
11end do
12lb
13+1, +5
14ub
15+4, +8
16ndim = getUnifRand(1, minval(ub - lb + 1, 1))
17call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
18call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
19call setResized(covMerged, [ndim, ndim])
20call setResized(meanMerged, ndim)
21sample = getUnifRand(-1., +1., ndim, ub(nsam))
22sample
23-0.177876234, -0.361559272, +0.172226548, -0.955668449, +0.982272983, -0.982040763, -0.170473456, -0.640297532
24+0.357866287E-2, -0.398587108, +0.366217256, +0.926423669, +0.744472265, -0.590144515, +0.526790023, -0.606699109
25+0.144594312, -0.452466011E-1, +0.400626540, +0.359095812, +0.708134532, +0.822257519, +0.824316859, -0.178211570
26-0.580209374, +0.362073898, -0.269213438, +0.597606063, +0.927723527, -0.353467464E-2, -0.988077044, -0.305322051
27cov(:,:,0) = getCov(sample, dim)
28cov(:,:,0) ! reference
29+0.363087833, +0.148737967, +0.484566018E-1, +0.705556571E-1
30+0.148737967, +0.322656333, +0.891751274E-1, +0.871994719E-1
31+0.484566018E-1, +0.891751274E-1, +0.131174013, -0.163108110E-3
32+0.705556571E-1, +0.871994719E-1, -0.163108110E-3, +0.352396071
33mean(:,0) = getMean(sample, dim)
34mean(:,0) ! reference
35-0.266677022, +0.121506393, +0.379445910, -0.323691368E-1
36do isam = 1, nsam
37 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
38 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
39end do
40call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
41covMerged
42+0.363087744, +0.148737937, +0.484566130E-1, +0.705556199E-1
43+0.00000000, +0.322656333, +0.891751200E-1, +0.871994719E-1
44+0.00000000, +0.00000000, +0.131174013, -0.163140707E-3
45+0.00000000, +0.00000000, +0.00000000, +0.352396101
46call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), lowDia)
47covMerged
48+0.363087744, +0.148737937, +0.484566130E-1, +0.705556199E-1
49+0.148737937, +0.322656333, +0.891751200E-1, +0.871994719E-1
50+0.484566130E-1, +0.891751200E-1, +0.131174013, -0.163140707E-3
51+0.705556199E-1, +0.871994719E-1, -0.163140707E-3, +0.352396101
52call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
53cov(:,:,2)
54+0.363087744, +0.148737937, +0.484566130E-1, +0.705556199E-1
55+0.406141222, +0.322656333, +0.891751200E-1, +0.871994719E-1
56+0.756773204E-1, +0.135951370, +0.131174013, -0.163140707E-3
57+0.300967932, +0.910872221E-1, +0.237165689E-1, +0.352396101
58cov(:,:,0) ! reference
59+0.363087833, +0.148737967, +0.484566018E-1, +0.705556571E-1
60+0.148737967, +0.322656333, +0.891751274E-1, +0.871994719E-1
61+0.484566018E-1, +0.891751274E-1, +0.131174013, -0.163108110E-3
62+0.705556571E-1, +0.871994719E-1, -0.163108110E-3, +0.352396071
63
64
65dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
66do isam = 2, nsam
67 lb(isam) = ub(isam - 1) + 1
68 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
69end do
70lb
71+1, +4
72ub
73+3, +5
74ndim = getUnifRand(1, minval(ub - lb + 1, 1))
75call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
76call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
77call setResized(covMerged, [ndim, ndim])
78call setResized(meanMerged, ndim)
79sample = getUnifRand(-1., +1., ndim, ub(nsam))
80sample
81-0.933376551, -0.617475152, +0.333265781, +0.424602151, +0.981680274
82+0.284943223, +0.192029476E-1, +0.234178305E-1, +0.255623579, -0.404457927
83cov(:,:,0) = getCov(sample, dim)
84cov(:,:,0) ! reference
85+0.500078976, -0.113053516
86-0.113053516, +0.609301105E-1
87mean(:,0) = getMean(sample, dim)
88mean(:,0) ! reference
89+0.377393030E-1, +0.357459299E-1
90do isam = 1, nsam
91 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
92 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
93end do
94call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
95covMerged
96+0.500079036, -0.113053493
97+0.148737937, +0.609301105E-1
98call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), lowDia)
99covMerged
100+0.500079036, -0.113053493
101-0.113053493, +0.609301105E-1
102call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
103cov(:,:,2)
104+0.500079036, -0.113053493
105-0.919292420E-1, +0.609301105E-1
106cov(:,:,0) ! reference
107+0.500078976, -0.113053516
108-0.113053516, +0.609301105E-1
109
110
111dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
112do isam = 2, nsam
113 lb(isam) = ub(isam - 1) + 1
114 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
115end do
116lb
117+1, +6
118ub
119+5, +8
120ndim = getUnifRand(1, minval(ub - lb + 1, 1))
121call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
122call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
123call setResized(covMerged, [ndim, ndim])
124call setResized(meanMerged, ndim)
125sample = getUnifRand(-1., +1., ndim, ub(nsam))
126sample
127-0.852448106, +0.999969959, +0.409474015, +0.880648136, +0.545521259, +0.311303377, -0.891739368, +0.500106335
128cov(:,:,0) = getCov(sample, dim)
129cov(:,:,0) ! reference
130+0.457128644
131mean(:,0) = getMean(sample, dim)
132mean(:,0) ! reference
133+0.237854451
134do isam = 1, nsam
135 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
136 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
137end do
138call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
139covMerged
140+0.457128614
141call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), lowDia)
142covMerged
143+0.457128614
144call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
145cov(:,:,2)
146+0.457128614
147cov(:,:,0) ! reference
148+0.457128644
149
150
151dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
152do isam = 2, nsam
153 lb(isam) = ub(isam - 1) + 1
154 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
155end do
156lb
157+1, +7
158ub
159+6, +9
160ndim = getUnifRand(1, minval(ub - lb + 1, 1))
161call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
162call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
163call setResized(covMerged, [ndim, ndim])
164call setResized(meanMerged, ndim)
165sample = getUnifRand(-1., +1., ndim, ub(nsam))
166sample
167+0.482845068, -0.122419000, -0.300304055, +0.281539440, -0.153982520, -0.385295630, -0.587049723, -0.145734072, -0.779858232
168-0.695247650, +0.518956661, -0.640314460, -0.472386479, -0.694907904, -0.731938362, +0.158470869, +0.640313983, -0.668274999
169+0.823003411, +0.216121078, +0.913636923, -0.416251779, -0.134503365, +0.778416634, +0.518478274, -0.927660704, +0.608380556
170cov(:,:,0) = getCov(sample, dim)
171cov(:,:,0) ! reference
172+0.137642547, -0.119322138E-1, -0.545865186E-1
173-0.119322138E-1, +0.282612920, -0.173281297
174-0.545865186E-1, -0.173281297, +0.358487576
175mean(:,0) = getMean(sample, dim)
176mean(:,0) ! reference
177-0.190028742, -0.287258714, +0.264402330
178do isam = 1, nsam
179 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
180 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
181end do
182call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
183covMerged
184+0.137642503, -0.119322240E-1, -0.545865148E-1
185+0.00000000, +0.282612920, -0.173281282
186+0.00000000, +0.00000000, +0.358487517
187call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), lowDia)
188covMerged
189+0.137642503, -0.119322240E-1, -0.545865148E-1
190-0.119322240E-1, +0.282612920, -0.173281282
191-0.545865148E-1, -0.173281282, +0.358487517
192call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
193cov(:,:,2)
194+0.137642503, -0.119322240E-1, -0.545865148E-1
195+0.133539617, +0.282612920, -0.173281282
196-0.181064278, -0.309020579, +0.358487517
197cov(:,:,0) ! reference
198+0.137642547, -0.119322138E-1, -0.545865186E-1
199-0.119322138E-1, +0.282612920, -0.173281297
200-0.545865186E-1, -0.173281297, +0.358487576
201
202
203dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
204do isam = 2, nsam
205 lb(isam) = ub(isam - 1) + 1
206 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
207end do
208lb
209+1, +7
210ub
211+6, +12
212ndim = getUnifRand(1, minval(ub - lb + 1, 1))
213call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
214call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
215call setResized(covMerged, [ndim, ndim])
216call setResized(meanMerged, ndim)
217sample = getUnifRand(-1., +1., ndim, ub(nsam))
218sample
219-0.691641569, -0.338720798, -0.409465075, +0.768656611, -0.855988383, +0.684281945, +0.767985821, +0.817631960, +0.542664528E-2, -0.348792195, +0.555361390, -0.222706914
220+0.709180355, +0.275342107, +0.643460631, -0.500606894, +0.326210976, -0.109436512E-1, +0.666172028, +0.327508688, -0.572234869, +0.228335500, -0.421917915, -0.511809230
221-0.694199562, -0.912366152, -0.289777637, +0.371205211, -0.164107680, +0.453360796, -0.230311155, +0.568914771, -0.774578929, -0.422897577, -0.689661264, -0.463103771
222-0.997918129, -0.192276955, +0.413474917, +0.848413825, -0.848082066, -0.267962098, +0.716509938, +0.585188389, +0.645674586, -0.830441952, -0.434357047, -0.787943602
223+0.629280567, -0.815215230, +0.853885293, +0.560186505, -0.386650205, -0.862288237, +0.665596724E-1, -0.299691439, +0.720275640E-1, -0.398051262, +0.938534141, +0.493514180
224cov(:,:,0) = getCov(sample, dim)
225cov(:,:,0) ! reference
226+0.353827566, -0.844269991E-1, +0.166139826, +0.258919656, -0.271550822E-2
227-0.844269991E-1, +0.217387483, +0.390364742E-2, -0.321335420E-1, -0.452198014E-1
228+0.166139826, +0.390364742E-2, +0.227942437, +0.121106312, -0.648786277E-1
229+0.258919656, -0.321335420E-1, +0.121106312, +0.448029518, +0.375481062E-1
230-0.271550822E-2, -0.452198014E-1, -0.648786277E-1, +0.375481062E-1, +0.359859467
231mean(:,0) = getMean(sample, dim)
232mean(:,0) ! reference
233+0.610024557E-1, +0.965581462E-1, -0.270626932, -0.958100185E-1, +0.710076317E-1
234do isam = 1, nsam
235 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
236 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
237end do
238call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
239covMerged
240+0.353827566, -0.844271109E-1, +0.166139841, +0.258919686, -0.271555968E-2
241-0.119322240E-1, +0.217387527, +0.390359573E-2, -0.321335718E-1, -0.452198125E-1
242-0.545865148E-1, -0.173281282, +0.227942482, +0.121106312, -0.648786873E-1
243+0.00000000, +0.00000000, +0.00000000, +0.448029399, +0.375480913E-1
244+0.00000000, +0.00000000, +0.00000000, +0.00000000, +0.359859496
245call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), lowDia)
246covMerged
247+0.353827566, -0.844271109E-1, +0.166139841, +0.258919686, -0.271555968E-2
248-0.844271109E-1, +0.217387527, +0.390359573E-2, -0.321335718E-1, -0.452198125E-1
249+0.166139841, +0.390359573E-2, +0.227942482, +0.121106312, -0.648786873E-1
250+0.258919686, -0.321335718E-1, +0.121106312, +0.448029399, +0.375480913E-1
251-0.271555968E-2, -0.452198125E-1, -0.648786873E-1, +0.375480913E-1, +0.359859496
252call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
253cov(:,:,2)
254+0.353827566, -0.844271109E-1, +0.166139841, +0.258919686, -0.271555968E-2
255+0.108473778, +0.217387527, +0.390359573E-2, -0.321335718E-1, -0.452198125E-1
256+0.113289356, +0.135396361, +0.227942482, +0.121106312, -0.648786873E-1
257+0.213967770, +0.115238190, +0.108016565, +0.448029399, +0.375480913E-1
258+0.212505721E-1, -0.132196307, -0.109407678, -0.886352062E-1, +0.359859496
259cov(:,:,0) ! reference
260+0.353827566, -0.844269991E-1, +0.166139826, +0.258919656, -0.271550822E-2
261-0.844269991E-1, +0.217387483, +0.390364742E-2, -0.321335420E-1, -0.452198014E-1
262+0.166139826, +0.390364742E-2, +0.227942437, +0.121106312, -0.648786277E-1
263+0.258919656, -0.321335420E-1, +0.121106312, +0.448029518, +0.375481062E-1
264-0.271550822E-2, -0.452198014E-1, -0.648786277E-1, +0.375481062E-1, +0.359859467
265
266
267dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
268do isam = 2, nsam
269 lb(isam) = ub(isam - 1) + 1
270 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
271end do
272lb
273+1, +3
274ub
275+2, +7
276ndim = getUnifRand(1, minval(ub - lb + 1, 1))
277call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
278call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
279call setResized(covMerged, [ndim, ndim])
280call setResized(meanMerged, ndim)
281sample = getUnifRand(-1., +1., ndim, ub(nsam))
282sample
283-0.682912946, -0.472841859, +0.986112237, -0.530444503, -0.537260532, +0.549008489, -0.503179908
284+0.701766014E-1, -0.239465237, -0.737786293, +0.463063836, +0.937633038, +0.941482425, -0.950945735
285cov(:,:,0) = getCov(sample, dim)
286cov(:,:,0) ! reference
287+0.369167209, -0.476896502E-1
288-0.476896502E-1, +0.493911564
289mean(:,0) = getMean(sample, dim)
290mean(:,0) ! reference
291-0.170217007, +0.691655204E-1
292do isam = 1, nsam
293 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
294 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
295end do
296call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
297covMerged
298+0.369167328, -0.476896167E-1
299-0.844271109E-1, +0.493911564
300call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), lowDia)
301covMerged
302+0.369167328, -0.476896167E-1
303-0.476896167E-1, +0.493911564
304call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
305cov(:,:,2)
306+0.369167328, -0.476896167E-1
307-0.953740105E-1, +0.493911564
308cov(:,:,0) ! reference
309+0.369167209, -0.476896502E-1
310-0.476896502E-1, +0.493911564
311
312
313dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
314do isam = 2, nsam
315 lb(isam) = ub(isam - 1) + 1
316 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
317end do
318lb
319+1, +4
320ub
321+3, +7
322ndim = getUnifRand(1, minval(ub - lb + 1, 1))
323call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
324call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
325call setResized(covMerged, [ndim, ndim])
326call setResized(meanMerged, ndim)
327sample = getUnifRand(-1., +1., ndim, ub(nsam))
328sample
329-0.561617136, +0.375880361, -0.673499346, +0.408841968, +0.787211657, -0.290076256, +0.898340940
330+0.627154708, +0.172219396, -0.114531636, +0.664874673, +0.453838229, -0.913095474, +0.485044718E-1
331-0.938320637, -0.773239017, -0.515133500, -0.879667282, -0.734491110, -0.872322321E-1, -0.402647376
332cov(:,:,0) = getCov(sample, dim)
333cov(:,:,0) ! reference
334+0.351531297, +0.857736096E-1, -0.151831936E-1
335+0.857736096E-1, +0.256324708, -0.134258971
336-0.151831936E-1, -0.134258971, +0.782019794E-1
337mean(:,0) = getMean(sample, dim)
338mean(:,0) ! reference
339+0.135011747, +0.134137779, -0.618675947
340do isam = 1, nsam
341 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
342 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
343end do
344call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
345covMerged
346+0.351531237, +0.857735798E-1, -0.151831843E-1
347-0.476896167E-1, +0.256324679, -0.134258956
348+0.00000000, +0.363403797, +0.782019943E-1
349call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), lowDia)
350covMerged
351+0.351531237, +0.857735798E-1, -0.151831843E-1
352+0.857735798E-1, +0.256324679, -0.134258956
353-0.151831843E-1, -0.134258956, +0.782019943E-1
354call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
355cov(:,:,2)
356+0.351531237, +0.857735798E-1, -0.151831843E-1
357+0.205726773, +0.256324679, -0.134258956
358-0.812917352E-1, -0.181104228, +0.782019943E-1
359cov(:,:,0) ! reference
360+0.351531297, +0.857736096E-1, -0.151831936E-1
361+0.857736096E-1, +0.256324708, -0.134258971
362-0.151831936E-1, -0.134258971, +0.782019794E-1
363
364
365dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
366do isam = 2, nsam
367 lb(isam) = ub(isam - 1) + 1
368 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
369end do
370lb
371+1, +5
372ub
373+4, +8
374ndim = getUnifRand(1, minval(ub - lb + 1, 1))
375call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
376call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
377call setResized(covMerged, [ndim, ndim])
378call setResized(meanMerged, ndim)
379sample = getUnifRand(-1., +1., ndim, ub(nsam))
380sample
381+0.837372541, +0.629957914, +0.381481886, +0.976212025E-1, +0.485449672, -0.911913514, +0.552992463, -0.239327431
382+0.646268964, -0.182771564, -0.915897250, -0.937613130, -0.254046082, -0.460657716, -0.831046462, +0.540019274E-1
383-0.864213586, +0.658664584, -0.476663947, -0.694015265, -0.893869758, +0.299902797, +0.658563972, -0.110039115
384-0.959608197, +0.243432522, -0.494021058, +0.105207562, +0.330160737, +0.338303566, -0.855590582, +0.200062275
385cov(:,:,0) = getCov(sample, dim)
386cov(:,:,0) ! reference
387+0.282893270, +0.587349534E-1, -0.686714947E-1, -0.155915797
388+0.587349534E-1, +0.262660980, -0.710037947E-1, -0.277611613E-1
389-0.686714947E-1, -0.710037947E-1, +0.371460855, +0.223635435E-1
390-0.155915797, -0.277611613E-1, +0.223635435E-1, +0.260209501
391mean(:,0) = getMean(sample, dim)
392mean(:,0) ! reference
393+0.229204357, -0.360220194, -0.177708790, -0.136506647
394do isam = 1, nsam
395 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
396 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
397end do
398call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
399covMerged
400+0.282893360, +0.587349124E-1, -0.686714947E-1, -0.155915767
401+0.857735798E-1, +0.262660682, -0.710036531E-1, -0.277609397E-1
402-0.151831843E-1, -0.134258956, +0.371460795, +0.223634206E-1
403+0.00000000, -0.205980837, +0.965581462E-1, +0.260209441
404call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), lowDia)
405covMerged
406+0.282893360, +0.587349124E-1, -0.686714947E-1, -0.155915767
407+0.587349124E-1, +0.262660682, -0.710036531E-1, -0.277609397E-1
408-0.686714947E-1, -0.710036531E-1, +0.371460795, +0.223634206E-1
409-0.155915767, -0.277609397E-1, +0.223634206E-1, +0.260209441
410call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
411cov(:,:,2)
412+0.282893360, +0.587349124E-1, -0.686714947E-1, -0.155915767
413-0.544500016E-1, +0.262660682, -0.710036531E-1, -0.277609397E-1
414-0.795448422E-1, -0.120313771, +0.371460795, +0.223634206E-1
415-0.167219460, +0.121736348, -0.194747835, +0.260209441
416cov(:,:,0) ! reference
417+0.282893270, +0.587349534E-1, -0.686714947E-1, -0.155915797
418+0.587349534E-1, +0.262660980, -0.710037947E-1, -0.277611613E-1
419-0.686714947E-1, -0.710037947E-1, +0.371460855, +0.223635435E-1
420-0.155915797, -0.277611613E-1, +0.223635435E-1, +0.260209501
421
422
423dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
424do isam = 2, nsam
425 lb(isam) = ub(isam - 1) + 1
426 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
427end do
428lb
429+1, +7
430ub
431+6, +13
432ndim = getUnifRand(1, minval(ub - lb + 1, 1))
433call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
434call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
435call setResized(covMerged, [ndim, ndim])
436call setResized(meanMerged, ndim)
437sample = getUnifRand(-1., +1., ndim, ub(nsam))
438sample
439-0.482158661E-1, -0.966465235, -0.533014297, -0.916833997, +0.535360336, -0.842154264, -0.492914438, +0.233028293, +0.458183289E-1, +0.916609287, -0.732045770, -0.989500642, -0.186408281
440+0.464743733, -0.117652297, -0.245836973E-1, +0.862036467, -0.534664512, -0.691024423, -0.909916162, +0.657994866, -0.321883798, -0.226676702, +0.196818590, -0.659555197, -0.149192214
441-0.949039340, -0.614194632, -0.374286652, -0.831207991, +0.393341064, +0.843568683, -0.290917039, +0.921784759, +0.683548450, -0.301113963, +0.753409028, -0.180672288, +0.518642426
442-0.276767135, +0.164960146, +0.689949036, +0.365379930, +0.923110843, -0.926342130, +0.915016890, +0.530890107, -0.194544792E-1, +0.302486420E-1, -0.871881485, +0.113889217, -0.338071108
443-0.744399786, +0.378924370, -0.468488932, +0.167960644, -0.965648651, -0.281494617, +0.751441598, -0.564488769, -0.894801378, -0.677835464, -0.420681953, +0.610504508, -0.130862594
444cov(:,:,0) = getCov(sample, dim)
445cov(:,:,0) ! reference
446+0.348438263, +0.621563662E-2, +0.708016306E-1, +0.855041444E-1, -0.226276129
447+0.621563662E-2, +0.268177003, -0.689049885E-1, -0.183181036E-1, -0.742394403E-1
448+0.708016306E-1, -0.689049885E-1, +0.408575147, -0.117561162, -0.123588197
449+0.855041444E-1, -0.183181036E-1, -0.117561162, +0.330864280, +0.435081646E-1
450-0.226276129, -0.742394403E-1, -0.123588197, +0.435081646E-1, +0.296918184
451mean(:,0) = getMean(sample, dim)
452mean(:,0) ! reference
453-0.305902809, -0.111811951, +0.440663397E-1, +0.100071415, -0.249220863
454do isam = 1, nsam
455 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
456 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
457end do
458call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
459covMerged
460+0.348438263, +0.621564221E-2, +0.708016753E-1, +0.855041221E-1, -0.226276144
461+0.587349124E-1, +0.268177003, -0.689050108E-1, -0.183180980E-1, -0.742394626E-1
462-0.686714947E-1, -0.710036531E-1, +0.408574969, -0.117561154, -0.123588204
463-0.155915767, -0.277609397E-1, +0.223634206E-1, +0.330864251, +0.435081869E-1
464-0.271555968E-2, -0.452198125E-1, -0.648786873E-1, +0.375480913E-1, +0.296918303
465call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), lowDia)
466covMerged
467+0.348438263, +0.621564221E-2, +0.708016753E-1, +0.855041221E-1, -0.226276144
468+0.621564128E-2, +0.268177003, -0.689050108E-1, -0.183180980E-1, -0.742394626E-1
469+0.708016753E-1, -0.689050108E-1, +0.408574969, -0.117561154, -0.123588204
470+0.855041221E-1, -0.183180980E-1, -0.117561154, +0.330864251, +0.435081869E-1
471-0.226276144, -0.742394626E-1, -0.123588204, +0.435081832E-1, +0.296918303
472call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
473cov(:,:,2)
474+0.348438263, +0.621564221E-2, +0.708016753E-1, +0.855041221E-1, -0.226276144
475+0.960659012E-1, +0.268177003, -0.689050108E-1, -0.183180980E-1, -0.742394626E-1
476+0.930104987E-3, +0.190601498, +0.408574969, -0.117561154, -0.123588204
477+0.500296392E-1, -0.867676809E-1, -0.108637750, +0.330864251, +0.435081869E-1
478-0.237779185, -0.192448631, -0.177527472, +0.133387432, +0.296918303
479cov(:,:,0) ! reference
480+0.348438263, +0.621563662E-2, +0.708016306E-1, +0.855041444E-1, -0.226276129
481+0.621563662E-2, +0.268177003, -0.689049885E-1, -0.183181036E-1, -0.742394403E-1
482+0.708016306E-1, -0.689049885E-1, +0.408575147, -0.117561162, -0.123588197
483+0.855041444E-1, -0.183181036E-1, -0.117561162, +0.330864280, +0.435081646E-1
484-0.226276129, -0.742394403E-1, -0.123588197, +0.435081646E-1, +0.296918184
485
486
487dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
488do isam = 2, nsam
489 lb(isam) = ub(isam - 1) + 1
490 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
491end do
492lb
493+1, +7
494ub
495+6, +13
496ndim = getUnifRand(1, minval(ub - lb + 1, 1))
497call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
498call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
499call setResized(covMerged, [ndim, ndim])
500call setResized(meanMerged, ndim)
501sample = getUnifRand(-1., +1., ndim, ub(nsam))
502sample
503-0.467836738, +0.213333845, +0.447243452E-1, -0.991155148, -0.337496877, +0.323708296, -0.208257675, +0.483616710, +0.545839548, +0.676100373, -0.464686513, -0.266594291, +0.916165829
504+0.466560125, -0.375170708E-1, +0.534408331, +0.429911017, +0.501823068, +0.877427936, -0.940223098, -0.624384999, +0.793041945, -0.471326470, +0.422169685, +0.705943227, -0.624538064
505+0.371526480E-1, +0.356992364, +0.265710592, -0.813974142E-1, +0.172747254, -0.275851130, +0.238473415, +0.674963951, -0.410033464, -0.745040894, -0.834289193, +0.561887026, +0.715548396
506+0.897610188, -0.556929588, -0.655685663, +0.195357919, -0.982787609, -0.655648708, -0.440299749, -0.218513250, +0.820313454, -0.248515606E-2, +0.950882792, +0.740228295, +0.119511127
507+0.509435296, -0.742669463, -0.847878814, -0.836725354, +0.227827311, +0.130081892, -0.129153728E-1, -0.650998712, +0.465313196E-1, +0.880343914E-1, +0.168287039, +0.649148703, +0.934236646
508+0.886109471, +0.880077958, +0.692146301, +0.364983559, -0.871842861, +0.806062102, +0.542632341E-1, +0.499251008, +0.540310144, +0.405249476, +0.570945382, +0.266824603, -0.482262373E-1
509cov(:,:,0) = getCov(sample, dim)
510cov(:,:,0) ! reference
511+0.277640641, -0.118110351, +0.324673429E-1, -0.574979447E-1, +0.576479100E-1, +0.180420522E-1
512-0.118110351, +0.352673531, -0.901832804E-1, +0.863993540E-1, +0.721931504E-2, +0.555351153E-1
513+0.324673429E-1, -0.901832804E-1, +0.233551517, -0.949527621E-1, -0.128015771E-2, -0.514511541E-1
514-0.574979447E-1, +0.863993540E-1, -0.949527621E-1, +0.412092298, +0.145980760, +0.932936370E-1
515+0.576479100E-1, +0.721931504E-2, -0.128015771E-2, +0.145980760, +0.311272562, -0.844482332E-1
516+0.180420522E-1, +0.555351153E-1, -0.514511541E-1, +0.932936370E-1, -0.844482332E-1, +0.210074365
517mean(:,0) = getMean(sample, dim)
518mean(:,0) ! reference
519+0.359585956E-1, +0.156407356, +0.520664304E-1, +0.162733793E-1, -0.259696264E-1, +0.388165683
520do isam = 1, nsam
521 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
522 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
523end do
524call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
525covMerged
526+0.277640641, -0.118110374, +0.324673392E-1, -0.574979261E-1, +0.576478839E-1, +0.180420578E-1
527+0.621564128E-2, +0.352673501, -0.901832730E-1, +0.863993466E-1, +0.721932575E-2, +0.555351451E-1
528+0.708016753E-1, -0.689050108E-1, +0.233551502, -0.949527696E-1, -0.128013780E-2, -0.514511466E-1
529+0.855041221E-1, -0.183180980E-1, -0.117561154, +0.412092179, +0.145980835, +0.932936817E-1
530-0.226276144, -0.742394626E-1, -0.123588204, +0.435081832E-1, +0.311272591, -0.844481736E-1
531+0.00000000, +0.00000000, +0.00000000, +0.00000000, +0.00000000, +0.210074365
532call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), lowDia)
533covMerged
534+0.277640641, -0.118110374, +0.324673392E-1, -0.574979261E-1, +0.576478839E-1, +0.180420578E-1
535-0.118110366, +0.352673501, -0.901832730E-1, +0.863993466E-1, +0.721932575E-2, +0.555351451E-1
536+0.324673392E-1, -0.901832730E-1, +0.233551502, -0.949527696E-1, -0.128013780E-2, -0.514511466E-1
537-0.574979261E-1, +0.863993391E-1, -0.949527696E-1, +0.412092179, +0.145980835, +0.932936817E-1
538+0.576478802E-1, +0.721932575E-2, -0.128013780E-2, +0.145980820, +0.311272591, -0.844481736E-1
539+0.180420596E-1, +0.555351451E-1, -0.514511466E-1, +0.932936817E-1, -0.844481736E-1, +0.210074365
540call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
541cov(:,:,2)
542+0.277640641, -0.118110374, +0.324673392E-1, -0.574979261E-1, +0.576478839E-1, +0.180420578E-1
543-0.110119313, +0.352673501, -0.901832730E-1, +0.863993466E-1, +0.721932575E-2, +0.555351451E-1
544+0.563211367E-1, -0.142975330, +0.233551502, -0.949527696E-1, -0.128013780E-2, -0.514511466E-1
545-0.815628991E-1, +0.322787285, -0.133651912, +0.412092179, +0.145980835, +0.932936817E-1
546+0.119558666E-1, +0.698521137E-1, +0.472147837E-1, +0.848781988E-1, +0.311272591, -0.844481736E-1
547-0.187932253E-1, +0.822819844E-1, -0.857649818E-1, +0.571310557E-1, -0.628988147E-1, +0.210074365
548cov(:,:,0) ! reference
549+0.277640641, -0.118110351, +0.324673429E-1, -0.574979447E-1, +0.576479100E-1, +0.180420522E-1
550-0.118110351, +0.352673531, -0.901832804E-1, +0.863993540E-1, +0.721931504E-2, +0.555351153E-1
551+0.324673429E-1, -0.901832804E-1, +0.233551517, -0.949527621E-1, -0.128015771E-2, -0.514511541E-1
552-0.574979447E-1, +0.863993540E-1, -0.949527621E-1, +0.412092298, +0.145980760, +0.932936370E-1
553+0.576479100E-1, +0.721931504E-2, -0.128015771E-2, +0.145980760, +0.311272562, -0.844482332E-1
554+0.180420522E-1, +0.555351153E-1, -0.514511541E-1, +0.932936370E-1, -0.844482332E-1, +0.210074365
555
556
557!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
558!Compute the biased merged covariance of a frequency weighted multivariate sample.
559!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
560
561
562dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
563do isam = 2, nsam
564 lb(isam) = ub(isam - 1) + 1
565 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
566end do
567lb
568+1, +3
569ub
570+2, +9
571ndim = getUnifRand(1, minval(ub - lb + 1, 1))
572call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
573call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
574call setResized(covMerged, [ndim, ndim])
575call setResized(meanMerged, ndim)
576sample = getUnifRand(-1., +1., ndim, ub(nsam))
577sample
578+0.143622279, -0.691289425, +0.802574277, -0.318239212, -0.133623123, +0.399448037, -0.936397791, +0.530570269, -0.207484126
579+0.171091318, +0.536007047, +0.340320230, -0.139461756E-1, +0.107171059, +0.376647830, -0.336355686, +0.552503347, -0.994741917E-2
580iweight = getUnifRand(1, 10, size(sample, dim, IK))
581iweight
582+4, +2, +8, +1, +2, +2, +8, +3, +7
583cov(:,:,0) = getCov(sample, dim, iweight)
584cov(:,:,0) ! reference
585+0.398514509, +0.146246314
586+0.146246314, +0.875685662E-1
587mean(:,0) = getMean(sample, dim, iweight)
588mean(:,0) ! reference
589-0.412417613E-1, +0.117017969
590do isam = 1, nsam
591 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
592 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
593end do
594call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
595covMerged
596+0.398514599, +0.146246314
597+0.309644922E-40, +0.875685588E-1
598call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), lowDia)
599covMerged
600+0.398514599, +0.146246314
601+0.146246314, +0.875685588E-1
602call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
603cov(:,:,2)
604+0.398514599, +0.146246314
605+0.191449076, +0.875685588E-1
606cov(:,:,0) ! reference
607+0.398514509, +0.146246314
608+0.146246314, +0.875685662E-1
609
610
611dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
612do isam = 2, nsam
613 lb(isam) = ub(isam - 1) + 1
614 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
615end do
616lb
617+1, +5
618ub
619+4, +6
620ndim = getUnifRand(1, minval(ub - lb + 1, 1))
621call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
622call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
623call setResized(covMerged, [ndim, ndim])
624call setResized(meanMerged, ndim)
625sample = getUnifRand(-1., +1., ndim, ub(nsam))
626sample
627-0.795607328, +0.762604833, -0.657132268, +0.611700654, -0.366850853, -0.493130684E-1
628+0.979378343, +0.539112926, -0.265010715, -0.979659200, +0.100330472, -0.852316499
629iweight = getUnifRand(1, 10, size(sample, dim, IK))
630iweight
631+1, +1, +1, +10, +9, +1
632cov(:,:,0) = getCov(sample, dim, iweight)
633cov(:,:,0) ! reference
634+0.278888702, -0.248227328
635-0.248227328, +0.373855591
636mean(:,0) = getMean(sample, dim, iweight)
637mean(:,0) ! reference
638+0.902565494E-1, -0.369237125
639do isam = 1, nsam
640 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
641 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
642end do
643call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
644covMerged
645+0.278888702, -0.248227268
646+0.146246314, +0.373855650
647call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), lowDia)
648covMerged
649+0.278888702, -0.248227268
650-0.248227268, +0.373855650
651call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
652cov(:,:,2)
653+0.278888702, -0.248227268
654-0.272251274E-1, +0.373855650
655cov(:,:,0) ! reference
656+0.278888702, -0.248227328
657-0.248227328, +0.373855591
658
659
660dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
661do isam = 2, nsam
662 lb(isam) = ub(isam - 1) + 1
663 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
664end do
665lb
666+1, +3
667ub
668+2, +5
669ndim = getUnifRand(1, minval(ub - lb + 1, 1))
670call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
671call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
672call setResized(covMerged, [ndim, ndim])
673call setResized(meanMerged, ndim)
674sample = getUnifRand(-1., +1., ndim, ub(nsam))
675sample
676-0.483086109, +0.980264068, +0.174478531, -0.691427827, -0.728550553
677+0.455371499, +0.948888183, -0.921891212, -0.882871151E-1, +0.351266980
678iweight = getUnifRand(1, 10, size(sample, dim, IK))
679iweight
680+6, +5, +6, +7, +3
681cov(:,:,0) = getCov(sample, dim, iweight)
682cov(:,:,0) ! reference
683+0.397809237, +0.880000591E-1
684+0.880000591E-1, +0.409635693
685mean(:,0) = getMean(sample, dim, iweight)
686mean(:,0) ! reference
687-0.147258207, +0.881894082E-1
688do isam = 1, nsam
689 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
690 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
691end do
692call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
693covMerged
694+0.397809207, +0.880000517E-1
695-0.248227268, +0.409635663
696call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), lowDia)
697covMerged
698+0.397809207, +0.880000517E-1
699+0.880000517E-1, +0.409635663
700call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
701cov(:,:,2)
702+0.397809207, +0.880000517E-1
703-0.200600892, +0.409635663
704cov(:,:,0) ! reference
705+0.397809237, +0.880000591E-1
706+0.880000591E-1, +0.409635693
707
708
709dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
710do isam = 2, nsam
711 lb(isam) = ub(isam - 1) + 1
712 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
713end do
714lb
715+1, +8
716ub
717+7, +12
718ndim = getUnifRand(1, minval(ub - lb + 1, 1))
719call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
720call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
721call setResized(covMerged, [ndim, ndim])
722call setResized(meanMerged, ndim)
723sample = getUnifRand(-1., +1., ndim, ub(nsam))
724sample
725-0.538747907, -0.712080956, +0.641097069, +0.989222407, +0.512566328, +0.289221168, -0.148916245, -0.790004969, -0.199229836, +0.250847101, -0.585680962, -0.437396407
726+0.784807324, -0.101656556, +0.979553580, +0.368613601, +0.489375830, +0.159325361, -0.572312474, -0.205666423, -0.160999656, +0.235195756, -0.196423411, -0.472108722
727-0.609753132, -0.984997511, -0.878700852, +0.623722792, +0.986507773, +0.779661179, -0.562969089, -0.713206530, +0.852186441, -0.232910037, -0.962665558, -0.240844607
728+0.859571934, -0.607070446, -0.583140731, +0.150378585, -0.405737042, +0.489415050, +0.439680099, +0.624104857, -0.637497187, -0.799849272, +0.989638805, -0.120074868
729-0.528232455, +0.616743803, -0.980387688, -0.265039206E-1, +0.144208312, -0.301153898, -0.623649836, -0.359984398, +0.145144463, +0.857237101, +0.825942397, -0.683146834
730iweight = getUnifRand(1, 10, size(sample, dim, IK))
731iweight
732+7, +8, +4, +8, +4, +5, +3, +10, +3, +5, +9, +7
733cov(:,:,0) = getCov(sample, dim, iweight)
734cov(:,:,0) ! reference
735+0.361379951, +0.137051553, +0.292993367, -0.125250757, -0.388979204E-1
736+0.137051553, +0.185666651, +0.600162670E-1, -0.266295653E-1, -0.489308089E-1
737+0.292993367, +0.600162670E-1, +0.478267878, -0.966908187E-1, -0.472666211E-1
738-0.125250757, -0.266295653E-1, -0.966908187E-1, +0.380761862, -0.473377295E-1
739-0.388979204E-1, -0.489308089E-1, -0.472666211E-1, -0.473377295E-1, +0.341630608
740mean(:,0) = getMean(sample, dim, iweight)
741mean(:,0) ! reference
742-0.157760277, +0.842254683E-1, -0.282298654, +0.144789174, -0.263550114E-1
743do isam = 1, nsam
744 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
745 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
746end do
747call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
748covMerged
749+0.361379981, +0.137051538, +0.292993367, -0.125250801, -0.388979279E-1
750+0.880000517E-1, +0.185666680, +0.600163043E-1, -0.266295448E-1, -0.489307679E-1
751+0.00000000, -0.689050108E-1, +0.478267878, -0.966908783E-1, -0.472666360E-1
752+0.00000000, -0.183180980E-1, -0.117561154, +0.380761981, -0.473376848E-1
753-0.226276144, -0.742394626E-1, -0.123588204, +0.435081832E-1, +0.341630608
754call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), lowDia)
755covMerged
756+0.361379981, +0.137051538, +0.292993367, -0.125250801, -0.388979279E-1
757+0.137051538, +0.185666680, +0.600163043E-1, -0.266295448E-1, -0.489307679E-1
758+0.292993367, +0.600163043E-1, +0.478267878, -0.966908783E-1, -0.472666360E-1
759-0.125250801, -0.266295448E-1, -0.966908783E-1, +0.380761981, -0.473376848E-1
760-0.388979241E-1, -0.489307642E-1, -0.472666360E-1, -0.473376848E-1, +0.341630608
761call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
762cov(:,:,2)
763+0.361379981, +0.137051538, +0.292993367, -0.125250801, -0.388979279E-1
764+0.455358177E-1, +0.185666680, +0.600163043E-1, -0.266295448E-1, -0.489307679E-1
765+0.962752774E-1, +0.685919914E-2, +0.478267878, -0.966908783E-1, -0.472666360E-1
766-0.192801788, -0.494016409E-1, -0.280830115, +0.380761981, -0.473376848E-1
767+0.970276967E-1, +0.938282534E-1, -0.670118630E-1, +0.307758562E-1, +0.341630608
768cov(:,:,0) ! reference
769+0.361379951, +0.137051553, +0.292993367, -0.125250757, -0.388979204E-1
770+0.137051553, +0.185666651, +0.600162670E-1, -0.266295653E-1, -0.489308089E-1
771+0.292993367, +0.600162670E-1, +0.478267878, -0.966908187E-1, -0.472666211E-1
772-0.125250757, -0.266295653E-1, -0.966908187E-1, +0.380761862, -0.473377295E-1
773-0.388979204E-1, -0.489308089E-1, -0.472666211E-1, -0.473377295E-1, +0.341630608
774
775
776dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
777do isam = 2, nsam
778 lb(isam) = ub(isam - 1) + 1
779 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
780end do
781lb
782+1, +4
783ub
784+3, +7
785ndim = getUnifRand(1, minval(ub - lb + 1, 1))
786call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
787call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
788call setResized(covMerged, [ndim, ndim])
789call setResized(meanMerged, ndim)
790sample = getUnifRand(-1., +1., ndim, ub(nsam))
791sample
792-0.667372823, +0.465199947E-1, +0.396987200, +0.515209436E-1, -0.748082042, +0.230819583, -0.521903515
793iweight = getUnifRand(1, 10, size(sample, dim, IK))
794iweight
795+5, +4, +2, +6, +1, +8, +2
796cov(:,:,0) = getCov(sample, dim, iweight)
797cov(:,:,0) ! reference
798+0.141266629
799mean(:,0) = getMean(sample, dim, iweight)
800mean(:,0) ! reference
801-0.711791515E-1
802do isam = 1, nsam
803 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
804 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
805end do
806call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
807covMerged
808+0.141266674
809call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), lowDia)
810covMerged
811+0.141266674
812call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
813cov(:,:,2)
814+0.141266674
815cov(:,:,0) ! reference
816+0.141266629
817
818
819dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
820do isam = 2, nsam
821 lb(isam) = ub(isam - 1) + 1
822 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
823end do
824lb
825+1, +6
826ub
827+5, +8
828ndim = getUnifRand(1, minval(ub - lb + 1, 1))
829call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
830call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
831call setResized(covMerged, [ndim, ndim])
832call setResized(meanMerged, ndim)
833sample = getUnifRand(-1., +1., ndim, ub(nsam))
834sample
835-0.192716241, +0.261526108E-1, +0.804340124, +0.570011139E-1, -0.409588814E-1, -0.442317486, -0.837724209, +0.784672499
836-0.504324317, +0.428298235, +0.339344859, -0.411368489, -0.732769132, -0.272634983, -0.967671752, +0.168741345
837iweight = getUnifRand(1, 10, size(sample, dim, IK))
838iweight
839+6, +8, +9, +10, +3, +8, +2, +1
840cov(:,:,0) = getCov(sample, dim, iweight)
841cov(:,:,0) ! reference
842+0.203391880, +0.128461897
843+0.128461897, +0.188162416
844mean(:,0) = getMean(sample, dim, iweight)
845mean(:,0) ! reference
846+0.491447486E-1, -0.144790009
847do isam = 1, nsam
848 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
849 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
850end do
851call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
852covMerged
853+0.203391880, +0.128461897
854+0.309644922E-40, +0.188162401
855call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), lowDia)
856covMerged
857+0.203391880, +0.128461897
858+0.128461897, +0.188162401
859call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
860cov(:,:,2)
861+0.203391880, +0.128461897
862+0.102620624, +0.188162401
863cov(:,:,0) ! reference
864+0.203391880, +0.128461897
865+0.128461897, +0.188162416
866
867
868dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
869do isam = 2, nsam
870 lb(isam) = ub(isam - 1) + 1
871 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
872end do
873lb
874+1, +3
875ub
876+2, +4
877ndim = getUnifRand(1, minval(ub - lb + 1, 1))
878call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
879call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
880call setResized(covMerged, [ndim, ndim])
881call setResized(meanMerged, ndim)
882sample = getUnifRand(-1., +1., ndim, ub(nsam))
883sample
884+0.186303139, +0.763330460, +0.243037343, -0.382143855
885iweight = getUnifRand(1, 10, size(sample, dim, IK))
886iweight
887+5, +3, +1, +10
888cov(:,:,0) = getCov(sample, dim, iweight)
889cov(:,:,0) ! reference
890+0.180750892
891mean(:,0) = getMean(sample, dim, iweight)
892mean(:,0) ! reference
893-0.187839083E-1
894do isam = 1, nsam
895 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
896 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
897end do
898call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
899covMerged
900+0.180750877
901call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), lowDia)
902covMerged
903+0.180750877
904call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
905cov(:,:,2)
906+0.180750877
907cov(:,:,0) ! reference
908+0.180750892
909
910
911dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
912do isam = 2, nsam
913 lb(isam) = ub(isam - 1) + 1
914 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
915end do
916lb
917+1, +7
918ub
919+6, +9
920ndim = getUnifRand(1, minval(ub - lb + 1, 1))
921call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
922call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
923call setResized(covMerged, [ndim, ndim])
924call setResized(meanMerged, ndim)
925sample = getUnifRand(-1., +1., ndim, ub(nsam))
926sample
927-0.508342505, +0.960931301, -0.610504985, +0.549737215E-1, +0.489521384, +0.752978206, -0.160428047, -0.918736339, -0.715671897
928-0.199847341, +0.541318536, +0.278843760, -0.800789833, +0.242379069, -0.852173448, +0.208382726, +0.941164494E-1, -0.226362109
929-0.742190361, -0.460544825, +0.222635031, -0.100099802, +0.998266459, +0.923573971E-1, +0.376461387, -0.588809967, -0.398628592
930iweight = getUnifRand(1, 10, size(sample, dim, IK))
931iweight
932+3, +10, +8, +2, +1, +2, +5, +6, +4
933cov(:,:,0) = getCov(sample, dim, iweight)
934cov(:,:,0) ! reference
935+0.518214345, +0.803906098E-1, -0.902196765E-2
936+0.803906098E-1, +0.156252205, -0.123697368E-2
937-0.902196765E-2, -0.123697368E-2, +0.178626075
938mean(:,0) = getMean(sample, dim, iweight)
939mean(:,0) ! reference
940-0.944286510E-1, +0.114195354, -0.178371325
941do isam = 1, nsam
942 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
943 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
944end do
945call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
946covMerged
947+0.518214405, +0.803905874E-1, -0.902199931E-2
948+0.309644922E-40, +0.156252205, -0.123699498E-2
949+0.00000000, +0.112103877E-43, +0.178626031
950call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), lowDia)
951covMerged
952+0.518214405, +0.803905874E-1, -0.902199931E-2
953+0.803905874E-1, +0.156252205, -0.123699498E-2
954-0.902200025E-2, -0.123699510E-2, +0.178626031
955call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
956cov(:,:,2)
957+0.518214405, +0.803905874E-1, -0.902199931E-2
958+0.260684025E-1, +0.156252205, -0.123699498E-2
959+0.139970377, +0.381577127E-1, +0.178626031
960cov(:,:,0) ! reference
961+0.518214345, +0.803906098E-1, -0.902196765E-2
962+0.803906098E-1, +0.156252205, -0.123697368E-2
963-0.902196765E-2, -0.123697368E-2, +0.178626075
964
965
966dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
967do isam = 2, nsam
968 lb(isam) = ub(isam - 1) + 1
969 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
970end do
971lb
972+1, +4
973ub
974+3, +9
975ndim = getUnifRand(1, minval(ub - lb + 1, 1))
976call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
977call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
978call setResized(covMerged, [ndim, ndim])
979call setResized(meanMerged, ndim)
980sample = getUnifRand(-1., +1., ndim, ub(nsam))
981sample
982+0.741920471, -0.950920939, -0.495087624, -0.609568357E-1, -0.837507725, +0.296243787, +0.712715864, +0.263849854, +0.851902604
983-0.861274958, +0.301911831E-1, +0.680193901E-1, +0.349821806, -0.934062958, -0.473973870, -0.362100959, +0.660920024, -0.455881476
984iweight = getUnifRand(1, 10, size(sample, dim, IK))
985iweight
986+6, +3, +2, +6, +5, +9, +5, +3, +5
987cov(:,:,0) = getCov(sample, dim, iweight)
988cov(:,:,0) ! reference
989+0.363161117, -0.423099995E-1
990-0.423099995E-1, +0.231921136
991mean(:,0) = getMean(sample, dim, iweight)
992mean(:,0) ! reference
993+0.166730478, -0.315575868
994do isam = 1, nsam
995 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
996 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
997end do
998call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
999covMerged
1000+0.363161057, -0.423099399E-1
1001+0.803905874E-1, +0.231921047
1002call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), lowDia)
1003covMerged
1004+0.363161057, -0.423099399E-1
1005-0.423099399E-1, +0.231921047
1006call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
1007cov(:,:,2)
1008+0.363161057, -0.423099399E-1
1009+0.495197289E-1, +0.231921047
1010cov(:,:,0) ! reference
1011+0.363161117, -0.423099995E-1
1012-0.423099995E-1, +0.231921136
1013
1014
1015dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1016do isam = 2, nsam
1017 lb(isam) = ub(isam - 1) + 1
1018 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1019end do
1020lb
1021+1, +7
1022ub
1023+6, +9
1024ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1025call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
1026call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1027call setResized(covMerged, [ndim, ndim])
1028call setResized(meanMerged, ndim)
1029sample = getUnifRand(-1., +1., ndim, ub(nsam))
1030sample
1031+0.408728838, +0.918609619, -0.654876232, -0.796104670, -0.599706173E-1, -0.262605190, +0.894245625, +0.106521368, -0.268722773
1032iweight = getUnifRand(1, 10, size(sample, dim, IK))
1033iweight
1034+2, +3, +2, +8, +1, +3, +4, +7, +10
1035cov(:,:,0) = getCov(sample, dim, iweight)
1036cov(:,:,0) ! reference
1037+0.318229675
1038mean(:,0) = getMean(sample, dim, iweight)
1039mean(:,0) ! reference
1040-0.829421207E-1
1041do isam = 1, nsam
1042 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
1043 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
1044end do
1045call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
1046covMerged
1047+0.318229735
1048call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), lowDia)
1049covMerged
1050+0.318229735
1051call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
1052cov(:,:,2)
1053+0.318229735
1054cov(:,:,0) ! reference
1055+0.318229675
1056
1057
1058!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1059!Compute the biased merged covariance of a reliability weighted multivariate sample.
1060!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1061
1062
1063dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1064do isam = 2, nsam
1065 lb(isam) = ub(isam - 1) + 1
1066 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1067end do
1068lb
1069+1, +8
1070ub
1071+7, +14
1072ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1073call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
1074call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1075call setResized(covMerged, [ndim, ndim])
1076call setResized(meanMerged, ndim)
1077sample = getUnifRand(-1., +1., ndim, ub(nsam))
1078sample
1079+0.220641613, +0.249752998, +0.603205085, +0.959820867, +0.663006306E-2, +0.596881270, -0.532084703E-1, +0.996329188, +0.567072153, -0.234163523, -0.197180510, -0.179159284, -0.604590416, +0.983396292
1080-0.463200808E-1, +0.280499220, +0.446917653, -0.171684027, -0.288970470, -0.374649882, +0.586117387, +0.378354788E-1, +0.546097755E-3, -0.627355576, -0.364794970, +0.213299155, +0.684250355, +0.372061729
1081rweight = getUnifRand(1., 2., size(sample, dim, IK))
1082rweight
1083+1.05581248, +1.92775071, +1.08070076, +1.63637590, +1.74237680, +1.81073666, +1.96432018, +1.78459883, +1.84558606, +1.90701520, +1.34289694, +1.16032696, +1.70988250, +1.91112065
1084cov(:,:,0) = getCov(sample, 2_IK, rweight)
1085cov(:,:,0) ! reference
1086+0.253830135, -0.119767953E-1
1087-0.119767953E-1, +0.152187169
1088mean(:,0) = getMean(sample, dim, rweight)
1089mean(:,0) ! reference
1090+0.291779399, +0.513173789E-1
1091do isam = 1, nsam
1092 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1093 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1094end do
1095call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), uppDia)
1096covMerged
1097+0.253830165, -0.119767869E-1
1098+0.309644922E-40, +0.152187183
1099call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), lowDia)
1100covMerged
1101+0.253830165, -0.119767869E-1
1102-0.119767869E-1, +0.152187183
1103call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), uppDia)
1104cov(:,:,2)
1105+0.253830165, -0.119767869E-1
1106+0.232929066E-1, +0.152187183
1107cov(:,:,0) ! reference
1108+0.253830135, -0.119767953E-1
1109-0.119767953E-1, +0.152187169
1110
1111
1112dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1113do isam = 2, nsam
1114 lb(isam) = ub(isam - 1) + 1
1115 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1116end do
1117lb
1118+1, +4
1119ub
1120+3, +5
1121ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1122call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
1123call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1124call setResized(covMerged, [ndim, ndim])
1125call setResized(meanMerged, ndim)
1126sample = getUnifRand(-1., +1., ndim, ub(nsam))
1127sample
1128+0.677185774, -0.872355580, +0.540846944, +0.604822636, +0.614191294E-1
1129-0.719237328E-2, -0.558667302, +0.774869680, +0.977316380, -0.169100881
1130rweight = getUnifRand(1., 2., size(sample, dim, IK))
1131rweight
1132+1.97891152, +1.40132535, +1.16943693, +1.63090038, +1.55900216
1133cov(:,:,0) = getCov(sample, 2_IK, rweight)
1134cov(:,:,0) ! reference
1135+0.321036637, +0.228757948
1136+0.228757948, +0.319692284
1137mean(:,0) = getMean(sample, dim, rweight)
1138mean(:,0) ! reference
1139+0.236741781, +0.185970202
1140do isam = 1, nsam
1141 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1142 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1143end do
1144call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), uppDia)
1145covMerged
1146+0.321036607, +0.228757977
1147-0.119767869E-1, +0.319692284
1148call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), lowDia)
1149covMerged
1150+0.321036607, +0.228757977
1151+0.228757977, +0.319692284
1152call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), uppDia)
1153cov(:,:,2)
1154+0.321036607, +0.228757977
1155+0.155662656, +0.319692284
1156cov(:,:,0) ! reference
1157+0.321036637, +0.228757948
1158+0.228757948, +0.319692284
1159
1160
1161dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1162do isam = 2, nsam
1163 lb(isam) = ub(isam - 1) + 1
1164 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1165end do
1166lb
1167+1, +8
1168ub
1169+7, +14
1170ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1171call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
1172call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1173call setResized(covMerged, [ndim, ndim])
1174call setResized(meanMerged, ndim)
1175sample = getUnifRand(-1., +1., ndim, ub(nsam))
1176sample
1177+0.610578179, -0.449559808, -0.945291281, +0.406886697, -0.218414903, -0.556303263E-1, -0.927885771E-1, -0.520625949, -0.232324243, -0.449238539, +0.485743403, +0.710683227, -0.551551700, +0.785034657
1178-0.853079319, -0.105601072, -0.783247113, +0.813920140, +0.240611315, +0.641767740, -0.603666902, +0.786884189, -0.822765708, -0.290630221, -0.298721194, -0.653063059E-1, +0.798190117, +0.376960039
1179+0.583073854, -0.588920593, -0.909489870, +0.703981161, +0.409826756, +0.288593411, -0.183014750, -0.937265873, -0.669755936, -0.159920454E-1, -0.332995653E-1, +0.715230227, +0.288418293, +0.653531790
1180+0.663299680, -0.342481017, -0.274271131, +0.117063761, -0.815028191, +0.882334232, +0.897420764, +0.504166842, +0.975333452E-1, +0.861684561, +0.688891888, -0.790803552, -0.756432056, +0.987561941
1181-0.404181480E-1, +0.971472025, +0.245023608, -0.144691825, +0.805784702, -0.749020696, +0.769148469, -0.328063130, -0.161630630, -0.935390711, +0.313806534, +0.407929420, +0.877890944, -0.679058075
1182-0.368136048, -0.918040514, -0.260388851E-2, +0.183504820, +0.747896433, +0.339145064, -0.718849540, +0.510390043, -0.717882514, -0.346935511, -0.715403676, +0.553724051, +0.708801866, -0.842862725
1183+0.762993097, -0.276903152, -0.282737255, -0.476635933, -0.720870733, +0.552948713, -0.119877696, -0.264874339, -0.855201006, -0.875382781, +0.613751650, -0.153351307, +0.875710249E-1, -0.138880372
1184rweight = getUnifRand(1., 2., size(sample, dim, IK))
1185rweight
1186+1.24061298, +1.05963659, +1.73998237, +1.18830609, +1.48993516, +1.55730212, +1.73404074, +1.02855253, +1.59388852, +1.73865700, +1.04860163, +1.40516591, +1.42632985, +1.33752847
1187cov(:,:,0) = getCov(sample, 2_IK, rweight)
1188cov(:,:,0) ! reference
1189+0.273344487, +0.325893164E-1, +0.223039657, +0.868719593E-1, -0.533030368E-1, -0.533509254E-1, +0.101322755
1190+0.325893164E-1, +0.364312708, +0.139973029, -0.503431484E-1, -0.397755243E-1, +0.204536423, +0.295754038E-1
1191+0.223039657, +0.139973029, +0.320595413, -0.505119888E-2, -0.293963887E-1, +0.895182341E-1, +0.819598809E-1
1192+0.868719593E-1, -0.503431484E-1, -0.505119888E-2, +0.445087671, -0.271676511, -0.227707937, +0.874403864E-1
1193-0.533030368E-1, -0.397755243E-1, -0.293963887E-1, -0.271676511, +0.387472361, +0.547892377E-1, +0.179296341E-1
1194-0.533509254E-1, +0.204536423, +0.895182341E-1, -0.227707937, +0.547892377E-1, +0.342593551, +0.489691505E-2
1195+0.101322755, +0.295754038E-1, +0.819598809E-1, +0.874403864E-1, +0.179296341E-1, +0.489691505E-2, +0.247861028
1196mean(:,0) = getMean(sample, dim, rweight)
1197mean(:,0) ! reference
1198-0.698719844E-1, -0.522974841E-1, +0.149225695E-1, +0.197211504, +0.830233768E-1, -0.108785570, -0.184611857
1199do isam = 1, nsam
1200 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1201 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1202end do
1203call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), uppDia)
1204covMerged
1205+0.273344487, +0.325894654E-1, +0.223039538, +0.868719146E-1, -0.533030219E-1, -0.533508696E-1, +0.101322718
1206+0.228757977, +0.364312679, +0.139973164, -0.503430627E-1, -0.397755429E-1, +0.204536438, +0.295753796E-1
1207+0.00000000, +0.489375830, +0.320595384, -0.505125104E-2, -0.293963477E-1, +0.895183086E-1, +0.819598287E-1
1208+0.00000000, +0.986507773, -0.301153898, +0.445087731, -0.271676570, -0.227707967, +0.874403343E-1
1209+0.368613601, -0.405737042, -0.148916245, -0.713206530, +0.387472421, +0.547892489E-1, +0.179296695E-1
1210+0.623722792, +0.144208312, -0.572312474, +0.624104857, +0.250847101, +0.342593521, +0.489694811E-2
1211+0.150378585, +0.289221168, -0.562969089, -0.359984398, +0.235195756, +0.989638805, +0.247861013
1212call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), lowDia)
1213covMerged
1214+0.273344487, +0.325894654E-1, +0.223039538, +0.868719146E-1, -0.533030219E-1, -0.533508696E-1, +0.101322718
1215+0.325894654E-1, +0.364312679, +0.139973164, -0.503430627E-1, -0.397755429E-1, +0.204536438, +0.295753796E-1
1216+0.223039538, +0.139973164, +0.320595384, -0.505125104E-2, -0.293963477E-1, +0.895183086E-1, +0.819598287E-1
1217+0.868719146E-1, -0.503430627E-1, -0.505125104E-2, +0.445087731, -0.271676570, -0.227707967, +0.874403343E-1
1218-0.533030219E-1, -0.397755429E-1, -0.293963477E-1, -0.271676570, +0.387472421, +0.547892489E-1, +0.179296695E-1
1219-0.533508696E-1, +0.204536438, +0.895183086E-1, -0.227707967, +0.547892489E-1, +0.342593521, +0.489694811E-2
1220+0.101322718, +0.295753796E-1, +0.819598287E-1, +0.874403343E-1, +0.179296676E-1, +0.489694811E-2, +0.247861013
1221call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), uppDia)
1222cov(:,:,2)
1223+0.273344487, +0.325894654E-1, +0.223039538, +0.868719146E-1, -0.533030219E-1, -0.533508696E-1, +0.101322718
1224-0.356225669E-1, +0.364312679, +0.139973164, -0.503430627E-1, -0.397755429E-1, +0.204536438, +0.295753796E-1
1225+0.200159296, +0.757682174E-1, +0.320595384, -0.505125104E-2, -0.293963477E-1, +0.895183086E-1, +0.819598287E-1
1226+0.204844158E-1, -0.741696060E-1, -0.962929726E-1, +0.445087731, -0.271676570, -0.227707967, +0.874403343E-1
1227+0.144371353E-1, +0.100629918, +0.732228979E-1, -0.361339986, +0.387472421, +0.547892489E-1, +0.179296695E-1
1228-0.102204673, +0.220970392, +0.466800146E-1, -0.323600769, +0.227436125, +0.342593521, +0.489694811E-2
1229+0.116049506, +0.132382601, +0.103236020, -0.684814677E-1, +0.187824965, +0.679645315E-1, +0.247861013
1230cov(:,:,0) ! reference
1231+0.273344487, +0.325893164E-1, +0.223039657, +0.868719593E-1, -0.533030368E-1, -0.533509254E-1, +0.101322755
1232+0.325893164E-1, +0.364312708, +0.139973029, -0.503431484E-1, -0.397755243E-1, +0.204536423, +0.295754038E-1
1233+0.223039657, +0.139973029, +0.320595413, -0.505119888E-2, -0.293963887E-1, +0.895182341E-1, +0.819598809E-1
1234+0.868719593E-1, -0.503431484E-1, -0.505119888E-2, +0.445087671, -0.271676511, -0.227707937, +0.874403864E-1
1235-0.533030368E-1, -0.397755243E-1, -0.293963887E-1, -0.271676511, +0.387472361, +0.547892377E-1, +0.179296341E-1
1236-0.533509254E-1, +0.204536423, +0.895182341E-1, -0.227707937, +0.547892377E-1, +0.342593551, +0.489691505E-2
1237+0.101322755, +0.295754038E-1, +0.819598809E-1, +0.874403864E-1, +0.179296341E-1, +0.489691505E-2, +0.247861028
1238
1239
1240dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1241do isam = 2, nsam
1242 lb(isam) = ub(isam - 1) + 1
1243 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1244end do
1245lb
1246+1, +3
1247ub
1248+2, +9
1249ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1250call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
1251call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1252call setResized(covMerged, [ndim, ndim])
1253call setResized(meanMerged, ndim)
1254sample = getUnifRand(-1., +1., ndim, ub(nsam))
1255sample
1256-0.364782929, +0.562209010, -0.910783291, +0.890349150E-1, -0.974240899, +0.694241405, -0.932756782, +0.368341208E-1, +0.154431701
1257-0.546958804, -0.941768885, +0.997972488E-1, +0.819314003, +0.475482345, -0.445040584, +0.413689017, +0.642032623, +0.195834875
1258rweight = getUnifRand(1., 2., size(sample, dim, IK))
1259rweight
1260+1.77579474, +1.31979239, +1.23255384, +1.60045755, +1.84926271, +1.90900147, +1.11731791, +1.10087025, +1.35728812
1261cov(:,:,0) = getCov(sample, 2_IK, rweight)
1262cov(:,:,0) ! reference
1263+0.378510863, -0.153749824
1264-0.153749824, +0.320180535
1265mean(:,0) = getMean(sample, dim, rweight)
1266mean(:,0) ! reference
1267-0.162431449, +0.516188256E-1
1268do isam = 1, nsam
1269 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1270 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1271end do
1272call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), uppDia)
1273covMerged
1274+0.378510892, -0.153749794
1275+0.325894654E-1, +0.320180535
1276call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), lowDia)
1277covMerged
1278+0.378510892, -0.153749794
1279-0.153749794, +0.320180535
1280call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), uppDia)
1281cov(:,:,2)
1282+0.378510892, -0.153749794
1283-0.114560388, +0.320180535
1284cov(:,:,0) ! reference
1285+0.378510863, -0.153749824
1286-0.153749824, +0.320180535
1287
1288
1289dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1290do isam = 2, nsam
1291 lb(isam) = ub(isam - 1) + 1
1292 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1293end do
1294lb
1295+1, +8
1296ub
1297+7, +12
1298ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1299call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
1300call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1301call setResized(covMerged, [ndim, ndim])
1302call setResized(meanMerged, ndim)
1303sample = getUnifRand(-1., +1., ndim, ub(nsam))
1304sample
1305+0.284682870, -0.401530147, +0.927176714, -0.252158284, +0.378445387E-1, +0.254675150, +0.485324502, -0.422390819, -0.881710172, -0.359008074, +0.805591702, -0.791039824
1306+0.454248786, +0.765923262E-1, -0.409702182, -0.863860488, -0.245853424, +0.402251482E-1, +0.393501878, +0.309485435, -0.575598478E-1, +0.294158697, -0.351195097, -0.230782390
1307+0.511663437, +0.923591018, +0.741496086, -0.767393231, -0.834389210, -0.934226871, +0.490014553E-1, +0.354897976E-2, -0.269481063, +0.297237754, +0.694117546, -0.601908207
1308rweight = getUnifRand(1., 2., size(sample, dim, IK))
1309rweight
1310+1.26015925, +1.44424069, +1.73698831, +1.31978297, +1.65833807, +1.78393304, +1.61078715, +1.14928770, +1.37083530, +1.18768120, +1.68166256, +1.12738848
1311cov(:,:,0) = getCov(sample, 2_IK, rweight)
1312cov(:,:,0) ! reference
1313+0.323242784, -0.216532834E-1, +0.135197356
1314-0.216532834E-1, +0.133465841, +0.521769971E-1
1315+0.135197356, +0.521769971E-1, +0.428669840
1316mean(:,0) = getMean(sample, dim, rweight)
1317mean(:,0) ! reference
1318+0.402621292E-1, -0.632065237E-1, -0.139142200E-1
1319do isam = 1, nsam
1320 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1321 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1322end do
1323call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), uppDia)
1324covMerged
1325+0.323242754, -0.216532815E-1, +0.135197371
1326-0.153749794, +0.133465871, +0.521769524E-1
1327+0.00000000, +0.510390043, +0.428669870
1328call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), lowDia)
1329covMerged
1330+0.323242754, -0.216532815E-1, +0.135197371
1331-0.216532815E-1, +0.133465871, +0.521769524E-1
1332+0.135197371, +0.521769524E-1, +0.428669870
1333call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), uppDia)
1334cov(:,:,2)
1335+0.323242754, -0.216532815E-1, +0.135197371
1336-0.818169191E-1, +0.133465871, +0.521769524E-1
1337+0.275524706, -0.169628151E-1, +0.428669870
1338cov(:,:,0) ! reference
1339+0.323242784, -0.216532834E-1, +0.135197356
1340-0.216532834E-1, +0.133465841, +0.521769971E-1
1341+0.135197356, +0.521769971E-1, +0.428669840
1342
1343
1344dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1345do isam = 2, nsam
1346 lb(isam) = ub(isam - 1) + 1
1347 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1348end do
1349lb
1350+1, +6
1351ub
1352+5, +7
1353ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1354call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
1355call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1356call setResized(covMerged, [ndim, ndim])
1357call setResized(meanMerged, ndim)
1358sample = getUnifRand(-1., +1., ndim, ub(nsam))
1359sample
1360+0.198379159, +0.860306859, +0.685080290, +0.471668601, -0.400528312, -0.790850878, -0.970156074
1361-0.694168568, -0.990393758, +0.799539566, +0.326654553, +0.779116035, -0.891628981, +0.422747970
1362rweight = getUnifRand(1., 2., size(sample, dim, IK))
1363rweight
1364+1.19416857, +1.87470651, +1.42873812, +1.79117393, +1.27568805, +1.16546857, +1.27826309
1365cov(:,:,0) = getCov(sample, 2_IK, rweight)
1366cov(:,:,0) ! reference
1367+0.453649312, -0.756815821E-1
1368-0.756815821E-1, +0.542224824
1369mean(:,0) = getMean(sample, dim, rweight)
1370mean(:,0) ! reference
1371+0.999765545E-1, -0.462717824E-1
1372do isam = 1, nsam
1373 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1374 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1375end do
1376call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), uppDia)
1377covMerged
1378+0.453649282, -0.756815970E-1
1379-0.216532815E-1, +0.542224765
1380call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), lowDia)
1381covMerged
1382+0.453649282, -0.756815970E-1
1383-0.756815970E-1, +0.542224765
1384call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), uppDia)
1385cov(:,:,2)
1386+0.453649282, -0.756815970E-1
1387-0.587931313E-1, +0.542224765
1388cov(:,:,0) ! reference
1389+0.453649312, -0.756815821E-1
1390-0.756815821E-1, +0.542224824
1391
1392
1393dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1394do isam = 2, nsam
1395 lb(isam) = ub(isam - 1) + 1
1396 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1397end do
1398lb
1399+1, +8
1400ub
1401+7, +13
1402ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1403call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
1404call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1405call setResized(covMerged, [ndim, ndim])
1406call setResized(meanMerged, ndim)
1407sample = getUnifRand(-1., +1., ndim, ub(nsam))
1408sample
1409-0.637768269, -0.572798491, +0.852273583, +0.207036257, +0.664001346, -0.747300386E-1, -0.187005639, -0.933661699, -0.550592065, -0.808828712, -0.180240870E-1, +0.572303176, -0.134260774
1410-0.471598864, -0.619143605, +0.886198282, -0.178279996, -0.829753518, -0.865887046, +0.363854885, -0.332523227, -0.734901786, -0.617503405, -0.769416928, +0.871335268, -0.146354675
1411rweight = getUnifRand(1., 2., size(sample, dim, IK))
1412rweight
1413+1.20331740, +1.60440254, +1.99883926, +1.52046013, +1.61292195, +1.47081423, +1.76240599, +1.93759918, +1.87376571, +1.31656253, +1.69392014, +1.67854643, +1.14919329
1414cov(:,:,0) = getCov(sample, 2_IK, rweight)
1415cov(:,:,0) ! reference
1416+0.325506270, +0.185583726
1417+0.185583726, +0.376335144
1418mean(:,0) = getMean(sample, dim, rweight)
1419mean(:,0) ! reference
1420-0.104040176, -0.234091178
1421do isam = 1, nsam
1422 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1423 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1424end do
1425call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), uppDia)
1426covMerged
1427+0.325506330, +0.185583740
1428-0.756815970E-1, +0.376335084
1429call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), lowDia)
1430covMerged
1431+0.325506330, +0.185583740
1432+0.185583740, +0.376335084
1433call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), uppDia)
1434cov(:,:,2)
1435+0.325506330, +0.185583740
1436+0.205005050, +0.376335084
1437cov(:,:,0) ! reference
1438+0.325506270, +0.185583726
1439+0.185583726, +0.376335144
1440
1441
1442dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1443do isam = 2, nsam
1444 lb(isam) = ub(isam - 1) + 1
1445 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1446end do
1447lb
1448+1, +5
1449ub
1450+4, +6
1451ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1452call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
1453call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1454call setResized(covMerged, [ndim, ndim])
1455call setResized(meanMerged, ndim)
1456sample = getUnifRand(-1., +1., ndim, ub(nsam))
1457sample
1458+0.114047647, +0.872656584, -0.746947169, -0.857316613, +0.225495100E-1, +0.733369589E-1
1459+0.768610001, -0.965306401, -0.355260491, +0.100766778, -0.164914250, +0.900192022
1460rweight = getUnifRand(1., 2., size(sample, dim, IK))
1461rweight
1462+1.21395910, +1.59794521, +1.78429461, +1.10883307, +1.05881429, +1.71864104
1463cov(:,:,0) = getCov(sample, 2_IK, rweight)
1464cov(:,:,0) ! reference
1465+0.354899138, -0.866957754E-1
1466-0.866957754E-1, +0.454731673
1467mean(:,0) = getMean(sample, dim, rweight)
1468mean(:,0) ! reference
1469-0.708014593E-1, +0.283987354E-1
1470do isam = 1, nsam
1471 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1472 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1473end do
1474call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), uppDia)
1475covMerged
1476+0.354899198, -0.866958126E-1
1477+0.185583740, +0.454731643
1478call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), lowDia)
1479covMerged
1480+0.354899198, -0.866958126E-1
1481-0.866958126E-1, +0.454731643
1482call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), uppDia)
1483cov(:,:,2)
1484+0.354899198, -0.866958126E-1
1485+0.127602806E-1, +0.454731643
1486cov(:,:,0) ! reference
1487+0.354899138, -0.866957754E-1
1488-0.866957754E-1, +0.454731673
1489
1490
1491dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1492do isam = 2, nsam
1493 lb(isam) = ub(isam - 1) + 1
1494 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1495end do
1496lb
1497+1, +6
1498ub
1499+5, +12
1500ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1501call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
1502call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1503call setResized(covMerged, [ndim, ndim])
1504call setResized(meanMerged, ndim)
1505sample = getUnifRand(-1., +1., ndim, ub(nsam))
1506sample
1507-0.134383440, +0.668292880, -0.981108189, +0.642374754, +0.599830270, +0.113338232E-1, -0.510498047, +0.311696649, -0.110272646, +0.491379499E-1, +0.972718000, +0.922557235
1508+0.664835691, -0.606065631, -0.399395227E-1, +0.666492701, +0.537111640, +0.742463470, +0.261466026, -0.764688492, +0.723342657, -0.987396836, -0.520306706, +0.137618661
1509-0.103532434, +0.634918571, +0.511402488, +0.382364392, -0.495603919, -0.512769580, +0.660613298, +0.134296417, +0.122379661, +0.211508870, -0.463375926, +0.588508964
1510+0.667518258, -0.216832876, +0.452569962, -0.485853791, -0.628410697, +0.970719576, -0.607280374, -0.395638585, -0.334935308, +0.892861605, -0.783654451, +0.860171318E-1
1511rweight = getUnifRand(1., 2., size(sample, dim, IK))
1512rweight
1513+1.43962586, +1.95259380, +1.11726665, +1.26644111, +1.03364336, +1.34260237, +1.51329207, +1.25581944, +1.95354509, +1.93212700, +1.12510920, +1.51937652
1514cov(:,:,0) = getCov(sample, 2_IK, rweight)
1515cov(:,:,0) ! reference
1516+0.291394770, -0.718131736E-1, -0.277069900E-1, -0.111240342
1517-0.718131736E-1, +0.401456028, -0.667291582E-1, -0.272614099E-1
1518-0.277069900E-1, -0.667291582E-1, +0.165624991, -0.339414403E-1
1519-0.111240342, -0.272614099E-1, -0.339414403E-1, +0.352444142
1520mean(:,0) = getMean(sample, dim, rweight)
1521mean(:,0) ! reference
1522+0.198183432, +0.395121053E-1, +0.179612026, -0.823587005E-3
1523do isam = 1, nsam
1524 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1525 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1526end do
1527call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), uppDia)
1528covMerged
1529+0.291394770, -0.718132034E-1, -0.277069807E-1, -0.111240335
1530-0.866958126E-1, +0.401456118, -0.667292103E-1, -0.272614844E-1
1531+0.00000000, +0.890349150E-1, +0.165625021, -0.339414366E-1
1532+0.00000000, +0.819314003, -0.445040584, +0.352444082
1533call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), lowDia)
1534covMerged
1535+0.291394770, -0.718132034E-1, -0.277069807E-1, -0.111240335
1536-0.718132034E-1, +0.401456118, -0.667292103E-1, -0.272614844E-1
1537-0.277069807E-1, -0.667292103E-1, +0.165625021, -0.339414366E-1
1538-0.111240335, -0.272614844E-1, -0.339414366E-1, +0.352444082
1539call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), uppDia)
1540cov(:,:,2)
1541+0.291394770, -0.718132034E-1, -0.277069807E-1, -0.111240335
1542-0.970925540E-1, +0.401456118, -0.667292103E-1, -0.272614844E-1
1543-0.411051624E-1, -0.143883601E-1, +0.165625021, -0.339414366E-1
1544-0.272735581E-1, -0.548861772E-1, -0.564805195E-1, +0.352444082
1545cov(:,:,0) ! reference
1546+0.291394770, -0.718131736E-1, -0.277069900E-1, -0.111240342
1547-0.718131736E-1, +0.401456028, -0.667291582E-1, -0.272614099E-1
1548-0.277069900E-1, -0.667291582E-1, +0.165624991, -0.339414403E-1
1549-0.111240342, -0.272614099E-1, -0.339414403E-1, +0.352444142
1550
1551
1552dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1553do isam = 2, nsam
1554 lb(isam) = ub(isam - 1) + 1
1555 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1556end do
1557lb
1558+1, +7
1559ub
1560+6, +9
1561ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1562call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
1563call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1564call setResized(covMerged, [ndim, ndim])
1565call setResized(meanMerged, ndim)
1566sample = getUnifRand(-1., +1., ndim, ub(nsam))
1567sample
1568-0.371549845, -0.940125823, +0.552572012, -0.378828406, +0.143991232, +0.344724655, -0.237148046, +0.183525443, -0.239717960
1569-0.886319160, +0.169373751, -0.467748642, -0.508481503, -0.657418966, +0.398223996, -0.259941101, -0.673931241, +0.372308731
1570-0.995718241, +0.520385861, +0.673666000E-1, +0.144657493, +0.371309519E-1, -0.693965197, +0.728614450, -0.709504724, +0.181189418
1571rweight = getUnifRand(1., 2., size(sample, dim, IK))
1572rweight
1573+1.35897279, +1.90364122, +1.02796865, +1.63284600, +1.49253178, +1.14223552, +1.71650648, +1.26713538, +1.01298201
1574cov(:,:,0) = getCov(sample, 2_IK, rweight)
1575cov(:,:,0) ! reference
1576+0.192192137, -0.444007628E-1, -0.103154436
1577-0.444007628E-1, +0.188817501, +0.905196890E-1
1578-0.103154436, +0.905196890E-1, +0.321062654
1579mean(:,0) = getMean(sample, dim, rweight)
1580mean(:,0) ! reference
1581-0.171552166, -0.290129483, -0.206414647E-1
1582do isam = 1, nsam
1583 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1584 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1585end do
1586call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), uppDia)
1587covMerged
1588+0.192192122, -0.444007628E-1, -0.103154443
1589-0.718132034E-1, +0.188817471, +0.905196741E-1
1590-0.277069807E-1, -0.667292103E-1, +0.321062595
1591call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), lowDia)
1592covMerged
1593+0.192192122, -0.444007628E-1, -0.103154443
1594-0.444007628E-1, +0.188817471, +0.905196741E-1
1595-0.103154443, +0.905196741E-1, +0.321062595
1596call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), uppDia)
1597cov(:,:,2)
1598+0.192192122, -0.444007628E-1, -0.103154443
1599-0.594759472E-1, +0.188817471, +0.905196741E-1
1600-0.112520918, +0.118280001, +0.321062595
1601cov(:,:,0) ! reference
1602+0.192192137, -0.444007628E-1, -0.103154436
1603-0.444007628E-1, +0.188817501, +0.905196890E-1
1604-0.103154436, +0.905196890E-1, +0.321062654
1605
1606
Test:
test_pm_sampleCov


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 7883 of file pm_sampleCov.F90.


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