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, +4
14ub
15+3, +9
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.983392239, -0.906538248, +0.566596746, +0.285900354, +0.919802070, +0.801415443, -0.394834876, +0.815028310, +0.655870080
24cov(:,:,0) = getCov(sample, dim)
25cov(:,:,0) ! reference
26+0.509573102
27mean(:,0) = getMean(sample, dim)
28mean(:,0) ! reference
29+0.195538625
30do isam = 1, nsam
31 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
32 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
33end do
34call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
35covMerged
36+0.509573102
37call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), lowDia)
38covMerged
39+0.509573102
40call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
41cov(:,:,2)
42+0.509573102
43cov(:,:,0) ! reference
44+0.509573102
45
46
47dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
48do isam = 2, nsam
49 lb(isam) = ub(isam - 1) + 1
50 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
51end do
52lb
53+1, +7
54ub
55+6, +8
56ndim = getUnifRand(1, minval(ub - lb + 1, 1))
57call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
58call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
59call setResized(covMerged, [ndim, ndim])
60call setResized(meanMerged, ndim)
61sample = getUnifRand(-1., +1., ndim, ub(nsam))
62sample
63-0.476266146, -0.145911813, +0.230103374, +0.302848935, +0.429608107, +0.946276426, +0.772754312, +0.711741447
64cov(:,:,0) = getCov(sample, dim)
65cov(:,:,0) ! reference
66+0.202075064
67mean(:,0) = getMean(sample, dim)
68mean(:,0) ! reference
69+0.346394330
70do isam = 1, nsam
71 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
72 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
73end do
74call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
75covMerged
76+0.202074975
77call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), lowDia)
78covMerged
79+0.202074975
80call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
81cov(:,:,2)
82+0.202074975
83cov(:,:,0) ! reference
84+0.202075064
85
86
87dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
88do isam = 2, nsam
89 lb(isam) = ub(isam - 1) + 1
90 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
91end do
92lb
93+1, +4
94ub
95+3, +7
96ndim = getUnifRand(1, minval(ub - lb + 1, 1))
97call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
98call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
99call setResized(covMerged, [ndim, ndim])
100call setResized(meanMerged, ndim)
101sample = getUnifRand(-1., +1., ndim, ub(nsam))
102sample
103+0.762442112, +0.728666782E-2, +0.231051087, +0.820343733, -0.950583220E-1, +0.120338082, -0.888931751E-2
104+0.368424654E-1, -0.805558801, -0.838758945E-1, -0.458779693, +0.910453200, +0.856227756, +0.996220112
105+0.412815809, -0.711351991, -0.280172348, -0.586521268, +0.456707716, -0.254994631, -0.517393827
106cov(:,:,0) = getCov(sample, dim)
107cov(:,:,0) ! reference
108+0.121280611, -0.106701516, +0.118461680E-1
109-0.106701516, +0.445901543, +0.124278843
110+0.118461680E-1, +0.124278843, +0.189563289
111mean(:,0) = getMean(sample, dim)
112mean(:,0) ! reference
113+0.262502015, +0.207361311, -0.211558655
114do isam = 1, nsam
115 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
116 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
117end do
118call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
119covMerged
120+0.121280707, -0.106701545, +0.118461791E-1
121+0.00000000, +0.445901543, +0.124278821
122+0.00000000, +0.00000000, +0.189563334
123call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), lowDia)
124covMerged
125+0.121280707, -0.106701545, +0.118461791E-1
126-0.106701545, +0.445901543, +0.124278821
127+0.118461791E-1, +0.124278821, +0.189563334
128call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
129cov(:,:,2)
130+0.121280707, -0.106701545, +0.118461791E-1
131-0.212676644, +0.445901543, +0.124278821
132-0.904808640E-1, +0.117704809, +0.189563334
133cov(:,:,0) ! reference
134+0.121280611, -0.106701516, +0.118461680E-1
135-0.106701516, +0.445901543, +0.124278843
136+0.118461680E-1, +0.124278843, +0.189563289
137
138
139dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
140do isam = 2, nsam
141 lb(isam) = ub(isam - 1) + 1
142 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
143end do
144lb
145+1, +7
146ub
147+6, +11
148ndim = getUnifRand(1, minval(ub - lb + 1, 1))
149call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
150call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
151call setResized(covMerged, [ndim, ndim])
152call setResized(meanMerged, ndim)
153sample = getUnifRand(-1., +1., ndim, ub(nsam))
154sample
155+0.998388290, +0.230247140, +0.619487762E-1, -0.617218018E-2, +0.607528329, -0.175619245, +0.369630814, -0.142510176, -0.411397934, -0.274683237E-1, +0.649638891
156cov(:,:,0) = getCov(sample, dim)
157cov(:,:,0) ! reference
158+0.161881194
159mean(:,0) = getMean(sample, dim)
160mean(:,0) ! reference
161+0.195837677
162do isam = 1, nsam
163 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
164 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
165end do
166call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
167covMerged
168+0.161881283
169call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), lowDia)
170covMerged
171+0.161881283
172call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
173cov(:,:,2)
174+0.161881283
175cov(:,:,0) ! reference
176+0.161881194
177
178
179dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
180do isam = 2, nsam
181 lb(isam) = ub(isam - 1) + 1
182 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
183end do
184lb
185+1, +3
186ub
187+2, +6
188ndim = getUnifRand(1, minval(ub - lb + 1, 1))
189call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
190call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
191call setResized(covMerged, [ndim, ndim])
192call setResized(meanMerged, ndim)
193sample = getUnifRand(-1., +1., ndim, ub(nsam))
194sample
195+0.294937968, +0.349892616, +0.674491882, -0.816441059, -0.647302985, -0.428435206
196cov(:,:,0) = getCov(sample, dim)
197cov(:,:,0) ! reference
198+0.313132077
199mean(:,0) = getMean(sample, dim)
200mean(:,0) ! reference
201-0.954761356E-1
202do isam = 1, nsam
203 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
204 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
205end do
206call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
207covMerged
208+0.313131958
209call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), lowDia)
210covMerged
211+0.313131958
212call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
213cov(:,:,2)
214+0.313131958
215cov(:,:,0) ! reference
216+0.313132077
217
218
219dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
220do isam = 2, nsam
221 lb(isam) = ub(isam - 1) + 1
222 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
223end do
224lb
225+1, +3
226ub
227+2, +5
228ndim = getUnifRand(1, minval(ub - lb + 1, 1))
229call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
230call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
231call setResized(covMerged, [ndim, ndim])
232call setResized(meanMerged, ndim)
233sample = getUnifRand(-1., +1., ndim, ub(nsam))
234sample
235+0.922245979, -0.145381093, -0.990380406, +0.878242135, -0.139081359
236cov(:,:,0) = getCov(sample, dim)
237cov(:,:,0) ! reference
238+0.517583907
239mean(:,0) = getMean(sample, dim)
240mean(:,0) ! reference
241+0.105129056
242do isam = 1, nsam
243 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
244 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
245end do
246call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
247covMerged
248+0.517583847
249call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), lowDia)
250covMerged
251+0.517583847
252call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
253cov(:,:,2)
254+0.517583847
255cov(:,:,0) ! reference
256+0.517583907
257
258
259dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
260do isam = 2, nsam
261 lb(isam) = ub(isam - 1) + 1
262 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
263end do
264lb
265+1, +4
266ub
267+3, +7
268ndim = getUnifRand(1, minval(ub - lb + 1, 1))
269call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
270call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
271call setResized(covMerged, [ndim, ndim])
272call setResized(meanMerged, ndim)
273sample = getUnifRand(-1., +1., ndim, ub(nsam))
274sample
275-0.370319843, -0.512055159, -0.463492513, +0.932714224, -0.507686853, -0.410154581, +0.200248837
276-0.742630363, -0.347755909, +0.612773657, +0.655895710, -0.401390791E-1, +0.340716124, +0.818808079E-1
277cov(:,:,0) = getCov(sample, dim)
278cov(:,:,0) ! reference
279+0.252505064, +0.109776556
280+0.109776556, +0.222515658
281mean(:,0) = getMean(sample, dim)
282mean(:,0) ! reference
283-0.161535129, +0.801058561E-1
284do isam = 1, nsam
285 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
286 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
287end do
288call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
289covMerged
290+0.252505124, +0.109776571
291+0.307935338E-40, +0.222515613
292call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), lowDia)
293covMerged
294+0.252505124, +0.109776571
295+0.109776571, +0.222515613
296call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
297cov(:,:,2)
298+0.252505124, +0.109776571
299+0.113237143, +0.222515613
300cov(:,:,0) ! reference
301+0.252505064, +0.109776556
302+0.109776556, +0.222515658
303
304
305dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
306do isam = 2, nsam
307 lb(isam) = ub(isam - 1) + 1
308 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
309end do
310lb
311+1, +3
312ub
313+2, +5
314ndim = getUnifRand(1, minval(ub - lb + 1, 1))
315call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
316call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
317call setResized(covMerged, [ndim, ndim])
318call setResized(meanMerged, ndim)
319sample = getUnifRand(-1., +1., ndim, ub(nsam))
320sample
321+0.410302639, -0.943424106, +0.937252045E-1, +0.418286800, -0.195232153
322cov(:,:,0) = getCov(sample, dim)
323cov(:,:,0) ! reference
324+0.254180133
325mean(:,0) = getMean(sample, dim)
326mean(:,0) ! reference
327-0.432683229E-1
328do isam = 1, nsam
329 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
330 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
331end do
332call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
333covMerged
334+0.254180104
335call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), lowDia)
336covMerged
337+0.254180104
338call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
339cov(:,:,2)
340+0.254180104
341cov(:,:,0) ! reference
342+0.254180133
343
344
345dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
346do isam = 2, nsam
347 lb(isam) = ub(isam - 1) + 1
348 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
349end do
350lb
351+1, +3
352ub
353+2, +6
354ndim = getUnifRand(1, minval(ub - lb + 1, 1))
355call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
356call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
357call setResized(covMerged, [ndim, ndim])
358call setResized(meanMerged, ndim)
359sample = getUnifRand(-1., +1., ndim, ub(nsam))
360sample
361-0.959451199, -0.289603949, -0.944484591, +0.637496710E-1, +0.522669315, -0.953766465
362+0.618827820, +0.365375876, -0.806772828, +0.877617121, +0.617314458, -0.152364731
363cov(:,:,0) = getCov(sample, dim)
364cov(:,:,0) ! reference
365+0.331727028, +0.205851972
366+0.205851972, +0.326128066
367mean(:,0) = getMean(sample, dim)
368mean(:,0) ! reference
369-0.426814497, +0.253332973
370do isam = 1, nsam
371 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
372 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
373end do
374call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
375covMerged
376+0.331726998, +0.205851942
377+0.307935338E-40, +0.326128095
378call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), lowDia)
379covMerged
380+0.331726998, +0.205851942
381+0.205851942, +0.326128095
382call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
383cov(:,:,2)
384+0.331726998, +0.205851942
385+0.365405500, +0.326128095
386cov(:,:,0) ! reference
387+0.331727028, +0.205851972
388+0.205851972, +0.326128066
389
390
391dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
392do isam = 2, nsam
393 lb(isam) = ub(isam - 1) + 1
394 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
395end do
396lb
397+1, +6
398ub
399+5, +11
400ndim = getUnifRand(1, minval(ub - lb + 1, 1))
401call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
402call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
403call setResized(covMerged, [ndim, ndim])
404call setResized(meanMerged, ndim)
405sample = getUnifRand(-1., +1., ndim, ub(nsam))
406sample
407+0.673266053, +0.837436795, -0.464135408E-1, +0.327112556, +0.704258919, -0.931052923, +0.939259171, -0.103528619, -0.196568489, +0.914087772, +0.763027191
408+0.830568790, -0.993834376, -0.204558730, +0.117491722, -0.396186113E-1, -0.548318982, +0.644092560E-1, -0.575642586E-1, -0.384115100, +0.937119126, -0.563284516
409+0.692670345E-1, -0.798385859, +0.469762087, +0.861128926, +0.125003457, +0.617935061, -0.892008305, +0.848717213, -0.754354358, -0.434735656, -0.305904150E-1
410-0.547821879, -0.689647555, +0.261740804, -0.999858379, +0.903812289, -0.384301186, -0.429983735, +0.866266370, -0.947055221, -0.982833385, +0.407021046
411-0.867243886, +0.338432431, -0.280110002, +0.750241518, -0.786336899, -0.574440956, -0.652234674, +0.628817081E-1, +0.972767830, +0.254431129, +0.448332071
412cov(:,:,0) = getCov(sample, dim)
413cov(:,:,0) ! reference
414+0.327882856, +0.102108091, -0.188759327, -0.263094474E-1, -0.162821263E-1
415+0.102108091, +0.301954985, +0.283485502E-1, -0.749415532E-1, -0.930879787E-1
416-0.188759327, +0.283485502E-1, +0.388752818, +0.174273610, -0.445051007E-1
417-0.263094474E-1, -0.749415532E-1, +0.174273610, +0.471328914, -0.163878277
418-0.162821263E-1, -0.930879787E-1, -0.445051007E-1, -0.163878277, +0.371596426
419mean(:,0) = getMean(sample, dim)
420mean(:,0) ! reference
421+0.352807760, -0.765186995E-1, +0.743083563E-2, -0.231150985, -0.302981585E-1
422do isam = 1, nsam
423 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
424 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
425end do
426call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
427covMerged
428+0.327882707, +0.102108099, -0.188759327, -0.263094380E-1, -0.162821002E-1
429+0.205851942, +0.301954955, +0.283485651E-1, -0.749415755E-1, -0.930880532E-1
430+0.00000000, +0.00000000, +0.388752788, +0.174273610, -0.445050597E-1
431+0.00000000, +0.00000000, +0.00000000, +0.471328855, -0.163878277
432+0.00000000, +0.00000000, +0.00000000, +0.00000000, +0.371596485
433call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), lowDia)
434covMerged
435+0.327882707, +0.102108099, -0.188759327, -0.263094380E-1, -0.162821002E-1
436+0.102108099, +0.301954955, +0.283485651E-1, -0.749415755E-1, -0.930880532E-1
437-0.188759327, +0.283485651E-1, +0.388752788, +0.174273610, -0.445050597E-1
438-0.263094380E-1, -0.749415755E-1, +0.174273610, +0.471328855, -0.163878277
439-0.162821002E-1, -0.930880532E-1, -0.445050634E-1, -0.163878277, +0.371596485
440call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(ub(1), TKG) / real(ub(2), TKG), uppDia)
441cov(:,:,2)
442+0.327882707, +0.102108099, -0.188759327, -0.263094380E-1, -0.162821002E-1
443+0.201111168, +0.301954955, +0.283485651E-1, -0.749415755E-1, -0.930880532E-1
444-0.270758241, -0.100810155, +0.388752788, +0.174273610, -0.445050597E-1
445-0.329711549E-1, -0.131437525, +0.308733165, +0.471328855, -0.163878277
446+0.301681366E-1, -0.118925376E-1, -0.871535167E-1, -0.512859225E-1, +0.371596485
447cov(:,:,0) ! reference
448+0.327882856, +0.102108091, -0.188759327, -0.263094474E-1, -0.162821263E-1
449+0.102108091, +0.301954985, +0.283485502E-1, -0.749415532E-1, -0.930879787E-1
450-0.188759327, +0.283485502E-1, +0.388752818, +0.174273610, -0.445051007E-1
451-0.263094474E-1, -0.749415532E-1, +0.174273610, +0.471328914, -0.163878277
452-0.162821263E-1, -0.930879787E-1, -0.445051007E-1, -0.163878277, +0.371596426
453
454
455!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
456!Compute the biased merged covariance of a frequency weighted multivariate sample.
457!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
458
459
460dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
461do isam = 2, nsam
462 lb(isam) = ub(isam - 1) + 1
463 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
464end do
465lb
466+1, +6
467ub
468+5, +8
469ndim = getUnifRand(1, minval(ub - lb + 1, 1))
470call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
471call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
472call setResized(covMerged, [ndim, ndim])
473call setResized(meanMerged, ndim)
474sample = getUnifRand(-1., +1., ndim, ub(nsam))
475sample
476-0.872341275, +0.439786077, +0.664734125, -0.315796137E-1, +0.412347674, +0.121695399, +0.274711847, +0.570886016
477+0.323488116, -0.585140228, -0.647064328, +0.549629092, +0.733035088, +0.445165873, +0.611363888, -0.431539536
478+0.550215840, -0.536445975, -0.914926291, +0.879891038, +0.932551742, -0.722442031, -0.433287382, +0.852670908
479iweight = getUnifRand(1, 10, size(sample, dim, IK))
480iweight
481+8, +6, +3, +6, +7, +6, +8, +9
482cov(:,:,0) = getCov(sample, dim, iweight)
483cov(:,:,0) ! reference
484+0.227531940, -0.961641073E-1, -0.615194812E-1
485-0.961641073E-1, +0.263486385, +0.687750205E-1
486-0.615194812E-1, +0.687750205E-1, +0.502598107
487mean(:,0) = getMean(sample, dim, iweight)
488mean(:,0) ! reference
489+0.158811063, +0.174395114, +0.190916374
490do isam = 1, nsam
491 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
492 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
493end do
494call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
495covMerged
496+0.227531955, -0.961641148E-1, -0.615195073E-1
497+0.307935338E-40, +0.263486415, +0.687749982E-1
498+0.00000000, -0.192902848, +0.502598166
499call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), lowDia)
500covMerged
501+0.227531955, -0.961641148E-1, -0.615195073E-1
502-0.961641148E-1, +0.263486415, +0.687749982E-1
503-0.615195073E-1, +0.687749982E-1, +0.502598166
504call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
505cov(:,:,2)
506+0.227531955, -0.961641148E-1, -0.615195073E-1
507-0.799326450E-1, +0.263486415, +0.687749982E-1
508+0.128076866, -0.319137603, +0.502598166
509cov(:,:,0) ! reference
510+0.227531940, -0.961641073E-1, -0.615194812E-1
511-0.961641073E-1, +0.263486385, +0.687750205E-1
512-0.615194812E-1, +0.687750205E-1, +0.502598107
513
514
515dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
516do isam = 2, nsam
517 lb(isam) = ub(isam - 1) + 1
518 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
519end do
520lb
521+1, +4
522ub
523+3, +9
524ndim = getUnifRand(1, minval(ub - lb + 1, 1))
525call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
526call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
527call setResized(covMerged, [ndim, ndim])
528call setResized(meanMerged, ndim)
529sample = getUnifRand(-1., +1., ndim, ub(nsam))
530sample
531+0.871731997, +0.906964898, -0.902264357, -0.408882141, +0.938417435, +0.426919460, -0.851143360, -0.659917593, -0.386589766
532+0.527657747, -0.542777300, +0.201543689, +0.843955278, -0.584905267, -0.989788890, +0.452311397, -0.598481297, -0.406501412
533+0.533214092, +0.397715449, +0.177038670, -0.640622854, +0.970257401, +0.342923641, -0.348046303, +0.161872268, +0.480622530
534iweight = getUnifRand(1, 10, size(sample, dim, IK))
535iweight
536+8, +2, +7, +8, +1, +1, +3, +6, +2
537cov(:,:,0) = getCov(sample, dim, iweight)
538cov(:,:,0) ! reference
539+0.518954813, +0.105255526E-1, +0.182831869
540+0.105255526E-1, +0.316870838, -0.136866704
541+0.182831869, -0.136866704, +0.206183985
542mean(:,0) = getMean(sample, dim, iweight)
543mean(:,0) ! reference
544-0.176839486, +0.175697476, +0.888671726E-1
545do isam = 1, nsam
546 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
547 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
548end do
549call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
550covMerged
551+0.518954694, +0.105255451E-1, +0.182831764
552-0.961641148E-1, +0.316870809, -0.136866733
553-0.615195073E-1, +0.687749982E-1, +0.206183940
554call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), lowDia)
555covMerged
556+0.518954694, +0.105255451E-1, +0.182831764
557+0.105255451E-1, +0.316870809, -0.136866733
558+0.182831764, -0.136866733, +0.206183940
559call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
560cov(:,:,2)
561+0.518954694, +0.105255451E-1, +0.182831764
562-0.605103485E-1, +0.316870809, -0.136866733
563+0.832844526E-1, -0.303807318, +0.206183940
564cov(:,:,0) ! reference
565+0.518954813, +0.105255526E-1, +0.182831869
566+0.105255526E-1, +0.316870838, -0.136866704
567+0.182831869, -0.136866704, +0.206183985
568
569
570dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
571do isam = 2, nsam
572 lb(isam) = ub(isam - 1) + 1
573 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
574end do
575lb
576+1, +6
577ub
578+5, +11
579ndim = getUnifRand(1, minval(ub - lb + 1, 1))
580call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
581call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
582call setResized(covMerged, [ndim, ndim])
583call setResized(meanMerged, ndim)
584sample = getUnifRand(-1., +1., ndim, ub(nsam))
585sample
586-0.719815969, +0.434856772, -0.514058352, +0.184169888, +0.243343830, -0.580325365, +0.915624022, -0.459622145E-1, -0.802342415, +0.198796272, -0.453128815E-1
587-0.457105041, -0.195128560, +0.943547845, -0.193790197E-1, +0.144334912, -0.268786192, +0.531285524, +0.960040808, -0.706946969, +0.150730610E-1, +0.212450504
588+0.350733995, +0.494531274, -0.960105777, -0.529353499, -0.607080579, +0.116647720, +0.608706713, +0.672276020, +0.596568823, -0.230395079, +0.773772597
589-0.366394758, -0.333453178, -0.935181856, +0.971811891, -0.473067760E-1, +0.823431373, -0.553089738, +0.940012217, +0.684583187E-2, +0.703319788, +0.784388065
590iweight = getUnifRand(1, 10, size(sample, dim, IK))
591iweight
592+6, +10, +7, +9, +4, +9, +9, +10, +10, +10, +7
593cov(:,:,0) = getCov(sample, dim, iweight)
594cov(:,:,0) ! reference
595+0.270221680, +0.101914041, +0.223563369E-1, -0.224917065E-1
596+0.101914041, +0.272711068, -0.444898419E-1, -0.125027336E-1
597+0.223563369E-1, -0.444898419E-1, +0.299578100, +0.287952218E-1
598-0.224917065E-1, -0.125027336E-1, +0.287952218E-1, +0.425186962
599mean(:,0) = getMean(sample, dim, iweight)
600mean(:,0) ! reference
601-0.520045944E-1, +0.971996114E-1, +0.169951305, +0.229708537
602do isam = 1, nsam
603 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
604 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
605end do
606call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
607covMerged
608+0.270221651, +0.101914056, +0.223563053E-1, -0.224917587E-1
609+0.105255451E-1, +0.272711009, -0.444898307E-1, -0.125027318E-1
610+0.182831764, -0.136866733, +0.299578130, +0.287952051E-1
611+0.00000000, +0.145355135, -0.765186995E-1, +0.425186902
612call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), lowDia)
613covMerged
614+0.270221651, +0.101914056, +0.223563053E-1, -0.224917587E-1
615+0.101914056, +0.272711009, -0.444898307E-1, -0.125027318E-1
616+0.223563053E-1, -0.444898307E-1, +0.299578130, +0.287952051E-1
617-0.224917587E-1, -0.125027318E-1, +0.287952051E-1, +0.425186902
618call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
619cov(:,:,2)
620+0.270221651, +0.101914056, +0.223563053E-1, -0.224917587E-1
621+0.207746193, +0.272711009, -0.444898307E-1, -0.125027318E-1
622+0.269905431E-2, +0.605359562E-1, +0.299578130, +0.287952051E-1
623-0.118380889, +0.492995605E-1, -0.562449619E-1, +0.425186902
624cov(:,:,0) ! reference
625+0.270221680, +0.101914041, +0.223563369E-1, -0.224917065E-1
626+0.101914041, +0.272711068, -0.444898419E-1, -0.125027336E-1
627+0.223563369E-1, -0.444898419E-1, +0.299578100, +0.287952218E-1
628-0.224917065E-1, -0.125027336E-1, +0.287952218E-1, +0.425186962
629
630
631dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
632do isam = 2, nsam
633 lb(isam) = ub(isam - 1) + 1
634 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
635end do
636lb
637+1, +6
638ub
639+5, +11
640ndim = getUnifRand(1, minval(ub - lb + 1, 1))
641call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
642call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
643call setResized(covMerged, [ndim, ndim])
644call setResized(meanMerged, ndim)
645sample = getUnifRand(-1., +1., ndim, ub(nsam))
646sample
647+0.653579712, -0.467783213, -0.604078650, -0.804414868, -0.870658159, -0.807228088, +0.510380983, -0.383740783, +0.675415397, +0.493945479, -0.204651356E-1
648iweight = getUnifRand(1, 10, size(sample, dim, IK))
649iweight
650+8, +9, +4, +8, +3, +2, +7, +8, +1, +7, +8
651cov(:,:,0) = getCov(sample, dim, iweight)
652cov(:,:,0) ! reference
653+0.305901676
654mean(:,0) = getMean(sample, dim, iweight)
655mean(:,0) ! reference
656-0.116729565
657do isam = 1, nsam
658 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
659 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
660end do
661call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
662covMerged
663+0.305901647
664call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), lowDia)
665covMerged
666+0.305901647
667call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
668cov(:,:,2)
669+0.305901647
670cov(:,:,0) ! reference
671+0.305901676
672
673
674dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
675do isam = 2, nsam
676 lb(isam) = ub(isam - 1) + 1
677 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
678end do
679lb
680+1, +5
681ub
682+4, +9
683ndim = getUnifRand(1, minval(ub - lb + 1, 1))
684call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
685call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
686call setResized(covMerged, [ndim, ndim])
687call setResized(meanMerged, ndim)
688sample = getUnifRand(-1., +1., ndim, ub(nsam))
689sample
690+0.567971230, -0.926035285, +0.879066229, -0.123556852E-1, +0.388380527, +0.511034966, -0.978226900, +0.212329507, +0.125435352
691+0.522053123, -0.451764941, +0.848307967, +0.150354147, -0.912380099, -0.872391701, -0.863469839E-1, -0.189986944, -0.715277195
692+0.137670159, -0.813375473, +0.347590446, +0.969531536, +0.100210547, -0.365713000, -0.763778090, -0.679090381, -0.292024493
693iweight = getUnifRand(1, 10, size(sample, dim, IK))
694iweight
695+9, +4, +5, +1, +8, +6, +8, +7, +2
696cov(:,:,0) = getCov(sample, dim, iweight)
697cov(:,:,0) ! reference
698+0.405663967, +0.759069994E-1, +0.214887172
699+0.759069994E-1, +0.358743310, +0.930816457E-1
700+0.214887172, +0.930816457E-1, +0.207162485
701mean(:,0) = getMean(sample, dim, iweight)
702mean(:,0) ! reference
703+0.117503822, -0.174026325, -0.242949724
704do isam = 1, nsam
705 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
706 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
707end do
708call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
709covMerged
710+0.405664027, +0.759069696E-1, +0.214887172
711+0.307935338E-40, +0.358743191, +0.930816159E-1
712+0.00000000, -0.136866733, +0.207162529
713call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), lowDia)
714covMerged
715+0.405664027, +0.759069696E-1, +0.214887172
716+0.759069771E-1, +0.358743191, +0.930816159E-1
717+0.214887172, +0.930816159E-1, +0.207162529
718call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
719cov(:,:,2)
720+0.405664027, +0.759069696E-1, +0.214887172
721-0.169425681, +0.358743191, +0.930816159E-1
722+0.132891744, -0.115795963, +0.207162529
723cov(:,:,0) ! reference
724+0.405663967, +0.759069994E-1, +0.214887172
725+0.759069994E-1, +0.358743310, +0.930816457E-1
726+0.214887172, +0.930816457E-1, +0.207162485
727
728
729dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
730do isam = 2, nsam
731 lb(isam) = ub(isam - 1) + 1
732 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
733end do
734lb
735+1, +6
736ub
737+5, +9
738ndim = getUnifRand(1, minval(ub - lb + 1, 1))
739call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
740call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
741call setResized(covMerged, [ndim, ndim])
742call setResized(meanMerged, ndim)
743sample = getUnifRand(-1., +1., ndim, ub(nsam))
744sample
745-0.734853745E-2, -0.715180397, +0.350714684, -0.124251366, -0.147824407, -0.818401694, +0.807071567, -0.686981916, -0.659407377E-1
746+0.626269817, +0.148324251, +0.164194703, -0.286100745, +0.353755951E-1, -0.219994903, +0.274710178, -0.650122285, -0.862091541
747+0.450922728, -0.259552598, +0.153432369, +0.936720610, -0.798994303, -0.578143239, -0.677618980E-1, +0.186652184, -0.628881335
748-0.681552887E-1, -0.739362001, +0.229146242, -0.758110285E-1, +0.323850393, +0.585678458, -0.902093887, +0.684251070, -0.742348075
749iweight = getUnifRand(1, 10, size(sample, dim, IK))
750iweight
751+5, +2, +3, +4, +10, +3, +2, +8, +2
752cov(:,:,0) = getCov(sample, dim, iweight)
753cov(:,:,0) ! reference
754+0.173242986, +0.977050737E-1, +0.195526704E-1, -0.112603299
755+0.977050737E-1, +0.184577450, +0.372023461E-2, -0.693374649E-1
756+0.195526704E-1, +0.372023461E-2, +0.329481274, -0.238904469E-1
757-0.112603299, -0.693374649E-1, -0.238904469E-1, +0.230867073
758mean(:,0) = getMean(sample, dim, iweight)
759mean(:,0) ! reference
760-0.227154046, -0.100148484, -0.944039449E-1, +0.147316888
761do isam = 1, nsam
762 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
763 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
764end do
765call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
766covMerged
767+0.173242956, +0.977050886E-1, +0.195526686E-1, -0.112603292
768+0.759069771E-1, +0.184577420, +0.372027140E-2, -0.693374872E-1
769+0.214887172, +0.930816159E-1, +0.329481363, -0.238904692E-1
770+0.00000000, -0.125027318E-1, +0.287952051E-1, +0.230867088
771call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), lowDia)
772covMerged
773+0.173242956, +0.977050886E-1, +0.195526686E-1, -0.112603292
774+0.977050811E-1, +0.184577420, +0.372027140E-2, -0.693374872E-1
775+0.195526686E-1, +0.372027140E-2, +0.329481363, -0.238904692E-1
776-0.112603292, -0.693374872E-1, -0.238904692E-1, +0.230867088
777call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
778cov(:,:,2)
779+0.173242956, +0.977050886E-1, +0.195526686E-1, -0.112603292
780+0.109069780, +0.184577420, +0.372027140E-2, -0.693374872E-1
781-0.225117225E-1, -0.205860306E-1, +0.329481363, -0.238904692E-1
782-0.323776186, -0.874623284E-1, +0.994289443E-1, +0.230867088
783cov(:,:,0) ! reference
784+0.173242986, +0.977050737E-1, +0.195526704E-1, -0.112603299
785+0.977050737E-1, +0.184577450, +0.372023461E-2, -0.693374649E-1
786+0.195526704E-1, +0.372023461E-2, +0.329481274, -0.238904469E-1
787-0.112603299, -0.693374649E-1, -0.238904469E-1, +0.230867073
788
789
790dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
791do isam = 2, nsam
792 lb(isam) = ub(isam - 1) + 1
793 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
794end do
795lb
796+1, +7
797ub
798+6, +10
799ndim = getUnifRand(1, minval(ub - lb + 1, 1))
800call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
801call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
802call setResized(covMerged, [ndim, ndim])
803call setResized(meanMerged, ndim)
804sample = getUnifRand(-1., +1., ndim, ub(nsam))
805sample
806-0.684488416, -0.759531975, -0.127464533E-1, -0.742536902, -0.352996707, -0.317959905, -0.808501840, +0.903011560E-1, +0.377865553, +0.791180611
807+0.992210746, -0.855833292E-1, +0.904832125, -0.457458973, +0.201971173, -0.945067763, -0.203007102, +0.907687664, -0.740822196, -0.991106629
808iweight = getUnifRand(1, 10, size(sample, dim, IK))
809iweight
810+4, +2, +10, +7, +5, +8, +7, +3, +8, +6
811cov(:,:,0) = getCov(sample, dim, iweight)
812cov(:,:,0) ! reference
813+0.260188103, -0.876784027E-1
814-0.876784027E-1, +0.551104903
815mean(:,0) = getMean(sample, dim, iweight)
816mean(:,0) ! reference
817-0.191825107, -0.124635115
818do isam = 1, nsam
819 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
820 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
821end do
822call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
823covMerged
824+0.260188133, -0.876784623E-1
825+0.977050811E-1, +0.551104903
826call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), lowDia)
827covMerged
828+0.260188133, -0.876784623E-1
829-0.876784623E-1, +0.551104903
830call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
831cov(:,:,2)
832+0.260188133, -0.876784623E-1
833-0.187523782, +0.551104903
834cov(:,:,0) ! reference
835+0.260188103, -0.876784027E-1
836-0.876784027E-1, +0.551104903
837
838
839dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
840do isam = 2, nsam
841 lb(isam) = ub(isam - 1) + 1
842 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
843end do
844lb
845+1, +4
846ub
847+3, +7
848ndim = getUnifRand(1, minval(ub - lb + 1, 1))
849call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
850call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
851call setResized(covMerged, [ndim, ndim])
852call setResized(meanMerged, ndim)
853sample = getUnifRand(-1., +1., ndim, ub(nsam))
854sample
855+0.565159321E-1, -0.808794141, -0.753669381, -0.701167822, -0.391706228, -0.636185765, -0.694110990
856iweight = getUnifRand(1, 10, size(sample, dim, IK))
857iweight
858+10, +3, +3, +3, +5, +6, +4
859cov(:,:,0) = getCov(sample, dim, iweight)
860cov(:,:,0) ! reference
861+0.113912024
862mean(:,0) = getMean(sample, dim, iweight)
863mean(:,0) ! reference
864-0.434641898
865do isam = 1, nsam
866 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
867 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
868end do
869call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
870covMerged
871+0.113911994
872call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), lowDia)
873covMerged
874+0.113911994
875call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
876cov(:,:,2)
877+0.113911994
878cov(:,:,0) ! reference
879+0.113912024
880
881
882dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
883do isam = 2, nsam
884 lb(isam) = ub(isam - 1) + 1
885 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
886end do
887lb
888+1, +6
889ub
890+5, +8
891ndim = getUnifRand(1, minval(ub - lb + 1, 1))
892call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
893call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
894call setResized(covMerged, [ndim, ndim])
895call setResized(meanMerged, ndim)
896sample = getUnifRand(-1., +1., ndim, ub(nsam))
897sample
898+0.956273079E-1, +0.669129610, +0.911620498, +0.222380161, -0.843547702, -0.329590321, -0.329339266, -0.580144048
899-0.234357595, +0.613723636, +0.272315264, -0.175609231, -0.727025032, +0.619257689, -0.450201750, +0.233683825
900iweight = getUnifRand(1, 10, size(sample, dim, IK))
901iweight
902+1, +1, +1, +3, +6, +3, +2, +2
903cov(:,:,0) = getCov(sample, dim, iweight)
904cov(:,:,0) ! reference
905+0.279724836, +0.147062108
906+0.147062108, +0.264122218
907mean(:,0) = getMean(sample, dim, iweight)
908mean(:,0) ! reference
909-0.290816098, -0.148029447
910do isam = 1, nsam
911 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
912 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
913end do
914call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
915covMerged
916+0.279724866, +0.147062108
917+0.307935338E-40, +0.264122248
918call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), lowDia)
919covMerged
920+0.279724866, +0.147062108
921+0.147062108, +0.264122248
922call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
923cov(:,:,2)
924+0.279724866, +0.147062108
925-0.220523356E-2, +0.264122248
926cov(:,:,0) ! reference
927+0.279724836, +0.147062108
928+0.147062108, +0.264122218
929
930
931dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
932do isam = 2, nsam
933 lb(isam) = ub(isam - 1) + 1
934 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
935end do
936lb
937+1, +3
938ub
939+2, +7
940ndim = getUnifRand(1, minval(ub - lb + 1, 1))
941call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
942call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
943call setResized(covMerged, [ndim, ndim])
944call setResized(meanMerged, ndim)
945sample = getUnifRand(-1., +1., ndim, ub(nsam))
946sample
947+0.123158336, -0.346078873, -0.694132805, -0.367417574, +0.769196153, +0.770443678E-1, +0.255964875
948iweight = getUnifRand(1, 10, size(sample, dim, IK))
949iweight
950+1, +4, +6, +7, +8, +8, +3
951cov(:,:,0) = getCov(sample, dim, iweight)
952cov(:,:,0) ! reference
953+0.251399010
954mean(:,0) = getMean(sample, dim, iweight)
955mean(:,0) ! reference
956-0.124340095E-1
957do isam = 1, nsam
958 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
959 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim, iweight(lb(isam):ub(isam)))
960end do
961call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
962covMerged
963+0.251399070
964call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), lowDia)
965covMerged
966+0.251399070
967call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG), uppDia)
968cov(:,:,2)
969+0.251399070
970cov(:,:,0) ! reference
971+0.251399010
972
973
974!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
975!Compute the biased merged covariance of a reliability weighted multivariate sample.
976!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
977
978
979dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
980do isam = 2, nsam
981 lb(isam) = ub(isam - 1) + 1
982 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
983end do
984lb
985+1, +8
986ub
987+7, +13
988ndim = getUnifRand(1, minval(ub - lb + 1, 1))
989call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
990call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
991call setResized(covMerged, [ndim, ndim])
992call setResized(meanMerged, ndim)
993sample = getUnifRand(-1., +1., ndim, ub(nsam))
994sample
995+0.901126862E-2, +0.763417244, +0.437683105, +0.337855816E-1, +0.980162740, -0.672264338, -0.126809120, +0.309169769, -0.149852991, -0.210831523, -0.498251319, -0.843937874, +0.993048191
996rweight = getUnifRand(1., 2., size(sample, dim, IK))
997rweight
998+1.64471579, +1.16781831, +1.39789736, +1.39093733, +1.43399119, +1.63431549, +1.41562998, +1.88521135, +1.53496337, +1.41511810, +1.24166846, +1.51786137, +1.07092404
999cov(:,:,0) = getCov(sample, 2_IK, rweight)
1000cov(:,:,0) ! reference
1001+0.307603598
1002mean(:,0) = getMean(sample, dim, rweight)
1003mean(:,0) ! reference
1004+0.485752225E-1
1005do isam = 1, nsam
1006 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1007 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1008end do
1009call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), uppDia)
1010covMerged
1011+0.307603598
1012call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), lowDia)
1013covMerged
1014+0.307603598
1015call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), uppDia)
1016cov(:,:,2)
1017+0.307603598
1018cov(:,:,0) ! reference
1019+0.307603598
1020
1021
1022dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1023do isam = 2, nsam
1024 lb(isam) = ub(isam - 1) + 1
1025 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1026end do
1027lb
1028+1, +3
1029ub
1030+2, +6
1031ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1032call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
1033call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1034call setResized(covMerged, [ndim, ndim])
1035call setResized(meanMerged, ndim)
1036sample = getUnifRand(-1., +1., ndim, ub(nsam))
1037sample
1038+0.937492847, +0.549838424, +0.444339871, +0.861517429, -0.308555484, +0.156323910
1039rweight = getUnifRand(1., 2., size(sample, dim, IK))
1040rweight
1041+1.04534757, +1.10362363, +1.93200493, +1.11134470, +1.70671940, +1.98849988
1042cov(:,:,0) = getCov(sample, 2_IK, rweight)
1043cov(:,:,0) ! reference
1044+0.171811551
1045mean(:,0) = getMean(sample, dim, rweight)
1046mean(:,0) ! reference
1047+0.358587712
1048do isam = 1, nsam
1049 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1050 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1051end do
1052call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), uppDia)
1053covMerged
1054+0.171811506
1055call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), lowDia)
1056covMerged
1057+0.171811506
1058call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), uppDia)
1059cov(:,:,2)
1060+0.171811506
1061cov(:,:,0) ! reference
1062+0.171811551
1063
1064
1065dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1066do isam = 2, nsam
1067 lb(isam) = ub(isam - 1) + 1
1068 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1069end do
1070lb
1071+1, +8
1072ub
1073+7, +10
1074ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1075call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
1076call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1077call setResized(covMerged, [ndim, ndim])
1078call setResized(meanMerged, ndim)
1079sample = getUnifRand(-1., +1., ndim, ub(nsam))
1080sample
1081-0.736506224, +0.759213686, -0.779147387, -0.152210593, +0.975085735, -0.186195374E-1, +0.111787200, -0.733381987, -0.632111311, +0.696297050
1082+0.127996206E-1, +0.447777271, -0.354464293, -0.496356487E-1, -0.936763883, +0.384133935, +0.759760618, +0.267163515, -0.425451279, +0.563687921
1083+0.538259506, +0.142455816, +0.719458580, +0.691131234, -0.453511119, -0.940337539, +0.225146294, +0.683842421, +0.653871775, -0.276131392
1084rweight = getUnifRand(1., 2., size(sample, dim, IK))
1085rweight
1086+1.97445488, +1.50471163, +1.42919898, +1.68178129, +1.27092385, +1.85202765, +1.72171569, +1.11505628, +1.64370000, +1.48051727
1087cov(:,:,0) = getCov(sample, 2_IK, rweight)
1088cov(:,:,0) ! reference
1089+0.380958050, +0.493932217E-1, -0.216762081
1090+0.493932217E-1, +0.229406312, -0.568168201E-1
1091-0.216762081, -0.568168201E-1, +0.313119262
1092mean(:,0) = getMean(sample, dim, rweight)
1093mean(:,0) ! reference
1094-0.708165318E-1, +0.874738097E-1, +0.189223647
1095do isam = 1, nsam
1096 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1097 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1098end do
1099call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), uppDia)
1100covMerged
1101+0.380958080, +0.493932180E-1, -0.216762111
1102+0.307935338E-40, +0.229406297, -0.568168275E-1
1103+0.00000000, +0.112103877E-43, +0.313119233
1104call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), lowDia)
1105covMerged
1106+0.380958080, +0.493932180E-1, -0.216762111
1107+0.493932180E-1, +0.229406297, -0.568168275E-1
1108-0.216762111, -0.568168275E-1, +0.313119233
1109call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), uppDia)
1110cov(:,:,2)
1111+0.380958080, +0.493932180E-1, -0.216762111
1112+0.209716454, +0.229406297, -0.568168275E-1
1113-0.293673217, -0.148596227, +0.313119233
1114cov(:,:,0) ! reference
1115+0.380958050, +0.493932217E-1, -0.216762081
1116+0.493932217E-1, +0.229406312, -0.568168201E-1
1117-0.216762081, -0.568168201E-1, +0.313119262
1118
1119
1120dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1121do isam = 2, nsam
1122 lb(isam) = ub(isam - 1) + 1
1123 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1124end do
1125lb
1126+1, +8
1127ub
1128+7, +12
1129ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1130call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
1131call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1132call setResized(covMerged, [ndim, ndim])
1133call setResized(meanMerged, ndim)
1134sample = getUnifRand(-1., +1., ndim, ub(nsam))
1135sample
1136+0.583632231, -0.532859445, +0.465836287, +0.685912132, -0.863176107, -0.957157612E-1, +0.302388906, +0.888311863, -0.182961583, -0.445081353, +0.198978186, +0.790772200
1137rweight = getUnifRand(1., 2., size(sample, dim, IK))
1138rweight
1139+1.20540094, +1.63233685, +1.86911774, +1.55541825, +1.55842292, +1.90102434, +1.51036286, +1.86065269, +1.99727106, +1.14192414, +1.26569366, +1.27255952
1140cov(:,:,0) = getCov(sample, 2_IK, rweight)
1141cov(:,:,0) ! reference
1142+0.294928581
1143mean(:,0) = getMean(sample, dim, rweight)
1144mean(:,0) ! reference
1145+0.145878717
1146do isam = 1, nsam
1147 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1148 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1149end do
1150call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), uppDia)
1151covMerged
1152+0.294928670
1153call setCovMeanMerged(covMerged, meanMerged, cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), lowDia)
1154covMerged
1155+0.294928670
1156call setCovMeanMerged(cov(:,:,2), mean(:,2), cov(:,:,1), mean(:,1), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG), uppDia)
1157cov(:,:,2)
1158+0.294928670
1159cov(:,:,0) ! reference
1160+0.294928581
1161
1162
1163dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1164do isam = 2, nsam
1165 lb(isam) = ub(isam - 1) + 1
1166 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1167end do
1168lb
1169+1, +5
1170ub
1171+4, +9
1172ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1173call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
1174call setRebound(mean, [1_IK, 0_IK], [ndim, nsam])
1175call setResized(covMerged, [ndim, ndim])
1176call setResized(meanMerged, ndim)
1177sample = getUnifRand(-1., +1., ndim, ub(nsam))
1178sample
1179+0.839756727E-1, +0.182847857, +0.230667114, -0.878359079, +0.567645073, +0.144941807, +0.186116934, -0.837831497E-1, +0.924179554E-1
1180-0.159936428, +0.270127058, +0.442338228, +0.937236547E-1, +0.263673544, +0.125091672, +0.156951427, +0.848851562, -0.281935573
1181+0.121101379, +0.667280316, +0.388617039, -0.954250813, +0.832293034E-1, -0.789279461, +0.385317922, +0.140124559E-1, -0.419551373
1182+0.451750159, -0.935984373, +0.812960029, -0.791021585, -0.528596640E-1, -0.944455743, -0.517652392, +0.110246778, +0.245691776
1183rweight = getUnifRand(1., 2., size(sample, dim, IK))
1184rweight
1185+1.94029844, +1.50409281, +1.77924180, +1.51067281, +1.39584327, +1.32783890, +1.07654309, +1.56558418, +1.91140485
1186cov(:,:,0) = getCov(sample, 2_IK, rweight)
1187cov(:,:,0) ! reference
1188+0.130324572, +0.524980761E-2, +0.113309860, +0.701396987E-1
1189+0.524980761E-2, +0.106535293, +0.541637056E-1, +0.223275810E-2
1190+0.113309860, +0.541637056E-1, +0.259021789, +0.967521518E-1
1191+0.701396987E-1, +0.223275810E-2, +0.967521518E-1, +0.376871705
1192mean(:,0) = getMean(sample, dim, rweight)
1193mean(:,0) ! reference
1194+0.536773987E-1, +0.179691672, -0.577051714E-1, -0.108676754
1195do isam = 1, nsam
1196 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK<