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

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

Detailed Description

Generate and return the merged covariance 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
[in]covB: The input 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.
Only the upper-diagonal triangle of covB is referenced.
[in]covA: The input 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.
Only the upper-diagonal triangle of covA is referenced.
[in]meanDiff: The input vector of the same type and kind as the input argument covA of shape (1:ndim), containing the difference of mean of the two samples meanDiff = meanA - meanB.
The subtraction order is immaterial.
[in]fracA: The input scalar of type real of the same kind as covA, containing the sum of the weights of all points in sample \(A\) divided by the sum of the weights of all points in the merged sample.
If the sample is unweighted, then fracA is simply size(sampleA) / (size(sampleA) + size(sampleB)).
Returns
cov : The output object of the same type and kind and rank and shape as meanDiff, containing the full matrix of biased covariance of the sample resulting form the merger of the two samples.


Possible calling interfaces

cov(1:ndim, 1:ndim) = getCovMerged(covB(1:ndim, 1:ndim), covA(1:ndim, 1:ndim), meanDiff(1:ndim), fracA)
Generate and return the merged covariance of a sample resulting from the merger of two separate (pote...
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(shape(covA) == size(meanDiff)) 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
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(:,:,:), 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, 1_IK], [ndim, nsam])")
54 call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
55 call disp%show("call setResized(covMerged, [ndim, ndim])")
56 call setResized(covMerged, [ndim, ndim])
57 call disp%show("sample = getUnifRand(-1., +1., ndim, ub(nsam))")
58 sample = getUnifRand(-1., +1., ndim, ub(nsam))
59 call disp%show("sample")
60 call disp%show( sample )
61 call disp%show("cov(:,:,0) = getCov(sample, dim)")
62 cov(:,:,0) = getCov(sample, dim)
63 call disp%show("cov(:,:,0) ! reference")
64 call disp%show( cov(:,:,0) )
65 call disp%show("do isam = 1, nsam")
66 call disp%show(" cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)")
67 call disp%show(" mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)")
68 call disp%show("end do")
69 do isam = 1, nsam
70 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
71 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
72 end do
73 call disp%show("covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))")
74 covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
75 call disp%show("covMerged")
76 call disp%show( covMerged )
77 call disp%show("covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))")
78 covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
79 call disp%show("covMerged")
80 call disp%show( covMerged )
81 call disp%show("cov(:,:,0) ! reference")
82 call disp%show( cov(:,:,0) )
83 call disp%skip()
84 end do
85 end block
86
87 call disp%skip()
88 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
89 call disp%show("!Compute the biased merged covariance of a frequency weighted multivariate sample.")
90 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
91 call disp%skip()
92
93 block
94 real(TKG), allocatable :: mean(:,:), cov(:,:,:), covMerged(:,:)
95 real(TKG), allocatable :: sample(:,:)
96 do itry = 1, ntry
97 call disp%skip()
98 call disp%show("dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)")
99 dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
100 call disp%show("do isam = 2, nsam")
101 call disp%show(" lb(isam) = ub(isam - 1) + 1")
102 call disp%show(" ub(isam) = ub(isam - 1) + getUnifRand(2, 7)")
103 call disp%show("end do")
104 do isam = 2, nsam
105 lb(isam) = ub(isam - 1) + 1
106 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
107 end do
108 call disp%show("lb")
109 call disp%show( lb )
110 call disp%show("ub")
111 call disp%show( ub )
112 call disp%show("ndim = getUnifRand(1, minval(ub - lb + 1, 1))")
113 ndim = getUnifRand(1, minval(ub - lb + 1, 1))
114 call disp%show("call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])")
115 call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
116 call disp%show("call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])")
117 call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
118 call disp%show("call setResized(covMerged, [ndim, ndim])")
119 call setResized(covMerged, [ndim, ndim])
120 call disp%show("sample = getUnifRand(-1., +1., ndim, ub(nsam))")
121 sample = getUnifRand(-1., +1., ndim, ub(nsam))
122 call disp%show("sample")
123 call disp%show( sample )
124 call disp%show("iweight = getUnifRand(1, 10, size(sample, dim, IK))")
125 iweight = getUnifRand(1, 10, size(sample, dim, IK))
126 call disp%show("iweight")
127 call disp%show( iweight )
128 call disp%show("cov(:,:,0) = getCov(sample, 2_IK, iweight)")
129 cov(:,:,0) = getCov(sample, 2_IK, iweight)
130 call disp%show("cov(:,:,0) ! reference")
131 call disp%show( cov(:,:,0) )
132 call disp%show("do isam = 1, nsam")
133 call disp%show(" cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))")
134 call disp%show(" mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))")
135 call disp%show("end do")
136 do isam = 1, nsam
137 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
138 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
139 end do
140 call disp%show("covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))")
141 covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
142 call disp%show("covMerged")
143 call disp%show( covMerged )
144 call disp%show("covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))")
145 covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
146 call disp%show("covMerged")
147 call disp%show( covMerged )
148 call disp%show("cov(:,:,0) ! reference")
149 call disp%show( cov(:,:,0) )
150 call disp%skip()
151 end do
152 end block
153
154 call disp%skip()
155 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
156 call disp%show("!Compute the biased merged covariance of a reliability weighted multivariate sample.")
157 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
158 call disp%skip()
159
160 block
161 real(TKG), allocatable :: mean(:,:), cov(:,:,:), covMerged(:,:)
162 real(TKG), allocatable :: sample(:,:)
163 real(TKG), allocatable :: rweight(:)
164 do itry = 1, ntry
165 call disp%skip()
166 call disp%show("dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)")
167 dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
168 call disp%show("do isam = 2, nsam")
169 call disp%show(" lb(isam) = ub(isam - 1) + 1")
170 call disp%show(" ub(isam) = ub(isam - 1) + getUnifRand(2, 7)")
171 call disp%show("end do")
172 do isam = 2, nsam
173 lb(isam) = ub(isam - 1) + 1
174 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
175 end do
176 call disp%show("lb")
177 call disp%show( lb )
178 call disp%show("ub")
179 call disp%show( ub )
180 call disp%show("ndim = getUnifRand(1, minval(ub - lb + 1, 1))")
181 ndim = getUnifRand(1, minval(ub - lb + 1, 1))
182 call disp%show("call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])")
183 call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
184 call disp%show("call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])")
185 call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
186 call disp%show("call setResized(covMerged, [ndim, ndim])")
187 call setResized(covMerged, [ndim, ndim])
188 call disp%show("sample = getUnifRand(-1., +1., ndim, ub(nsam))")
189 sample = getUnifRand(-1., +1., ndim, ub(nsam))
190 call disp%show("sample")
191 call disp%show( sample )
192 call disp%show("rweight = getUnifRand(1., 2., size(sample, dim, IK))")
193 rweight = getUnifRand(1., 2., size(sample, dim, IK))
194 call disp%show("rweight")
195 call disp%show( rweight )
196 call disp%show("cov(:,:,0) = getCov(sample, 2_IK, rweight)")
197 cov(:,:,0) = getCov(sample, 2_IK, rweight)
198 call disp%show("cov(:,:,0) ! reference")
199 call disp%show( cov(:,:,0) )
200 call disp%show("do isam = 1, nsam")
201 call disp%show(" cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))")
202 call disp%show(" mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))")
203 call disp%show("end do")
204 do isam = 1, nsam
205 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
206 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
207 end do
208 call disp%show("covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))")
209 covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
210 call disp%show("covMerged")
211 call disp%show( covMerged )
212 call disp%show("covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))")
213 covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
214 call disp%show("covMerged")
215 call disp%show( covMerged )
216 call disp%show("cov(:,:,0) ! reference")
217 call disp%show( cov(:,:,0) )
218 call disp%skip()
219 end do
220 end block
221
222end 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, +5
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, 1_IK], [ndim, nsam])
19call setResized(covMerged, [ndim, ndim])
20sample = getUnifRand(-1., +1., ndim, ub(nsam))
21sample
22+0.516826034, +0.792227030, +0.328134894, -0.440360904, -0.657570362E-1
23cov(:,:,0) = getCov(sample, dim)
24cov(:,:,0) ! reference
25+0.188956633
26do isam = 1, nsam
27 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
28 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
29end do
30covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
31covMerged
32+0.188956648
33covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
34covMerged
35+0.188956648
36cov(:,:,0) ! reference
37+0.188956633
38
39
40dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
41do isam = 2, nsam
42 lb(isam) = ub(isam - 1) + 1
43 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
44end do
45lb
46+1, +5
47ub
48+4, +10
49ndim = getUnifRand(1, minval(ub - lb + 1, 1))
50call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
51call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
52call setResized(covMerged, [ndim, ndim])
53sample = getUnifRand(-1., +1., ndim, ub(nsam))
54sample
55-0.929594994, +0.436816573, +0.632729769, -0.539220691, -0.394586325E-1, +0.920131207, +0.127034664, -0.955117226, -0.688022375E-1, +0.993142366
56cov(:,:,0) = getCov(sample, dim)
57cov(:,:,0) ! reference
58+0.448034286
59do isam = 1, nsam
60 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
61 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
62end do
63covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
64covMerged
65+0.448034346
66covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
67covMerged
68+0.448034346
69cov(:,:,0) ! reference
70+0.448034286
71
72
73dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
74do isam = 2, nsam
75 lb(isam) = ub(isam - 1) + 1
76 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
77end do
78lb
79+1, +6
80ub
81+5, +11
82ndim = getUnifRand(1, minval(ub - lb + 1, 1))
83call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
84call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
85call setResized(covMerged, [ndim, ndim])
86sample = getUnifRand(-1., +1., ndim, ub(nsam))
87sample
88+0.361089468, -0.535390854, -0.968912482, +0.264635324, +0.120630264E-1, -0.544026017, +0.192158103, -0.520289779, +0.350813031, +0.291080236, -0.880505919
89+0.230461359E-1, -0.993716717, +0.169888854, -0.231464386, +0.228006840E-1, +0.904440999, +0.623671889, +0.202726364, -0.415415168, +0.859754682, -0.943331957
90cov(:,:,0) = getCov(sample, dim)
91cov(:,:,0) ! reference
92+0.241568461, +0.738365054E-1
93+0.738365054E-1, +0.374196976
94do isam = 1, nsam
95 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
96 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
97end do
98covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
99covMerged
100+0.241568431, +0.738364905E-1
101+0.738364905E-1, +0.374196887
102covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
103covMerged
104+0.241568431, +0.738364905E-1
105+0.738364905E-1, +0.374196887
106cov(:,:,0) ! reference
107+0.241568461, +0.738365054E-1
108+0.738365054E-1, +0.374196976
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, +3
118ub
119+2, +6
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, 1_IK], [ndim, nsam])
123call setResized(covMerged, [ndim, ndim])
124sample = getUnifRand(-1., +1., ndim, ub(nsam))
125sample
126+0.568608642, +0.869689822, +0.628063679, -0.522292852E-1, -0.551448584, -0.512825489
127+0.163981318, -0.136163354, +0.784253836, +0.885677934, -0.510733008, +0.114840508
128cov(:,:,0) = getCov(sample, dim)
129cov(:,:,0) ! reference
130+0.315596938, +0.729629099E-1
131+0.729629099E-1, +0.239412397
132do isam = 1, nsam
133 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
134 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
135end do
136covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
137covMerged
138+0.315596938, +0.729629025E-1
139+0.729629025E-1, +0.239412367
140covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
141covMerged
142+0.315596938, +0.729629025E-1
143+0.729629025E-1, +0.239412367
144cov(:,:,0) ! reference
145+0.315596938, +0.729629099E-1
146+0.729629099E-1, +0.239412397
147
148
149dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
150do isam = 2, nsam
151 lb(isam) = ub(isam - 1) + 1
152 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
153end do
154lb
155+1, +8
156ub
157+7, +13
158ndim = getUnifRand(1, minval(ub - lb + 1, 1))
159call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
160call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
161call setResized(covMerged, [ndim, ndim])
162sample = getUnifRand(-1., +1., ndim, ub(nsam))
163sample
164-0.534685254, -0.672600985, -0.407761097, -0.432819366, +0.605178475, +0.538234591, +0.866307020E-1, +0.102880359, +0.457062840, -0.804008722, -0.598505855, -0.173407555, +0.516078472
165-0.796876550, -0.429785609, +0.338528395, -0.896916628, -0.511332273, +0.690571547, -0.848548889, -0.212320924, +0.161644340, +0.696067929, +0.913596034, -0.505671740, -0.359255791
166+0.197930813, -0.555932641, -0.174853206, -0.202628613, -0.555898070, -0.216881752, -0.492387295, +0.386825919, +0.472961426, -0.590429783, +0.975373507, +0.333472133, +0.550759554
167+0.718626618, +0.314231277, +0.543329477, +0.456759453, +0.812556386, +0.734400988, +0.160040140, +0.821339369, +0.929993272, +0.505266190, -0.156544566, -0.173611283, -0.507399321
168cov(:,:,0) = getCov(sample, dim)
169cov(:,:,0) ! reference
170+0.241714865, -0.289614219E-1, +0.244316831E-1, +0.287885591E-1
171-0.289614219E-1, +0.364150763, +0.677974597E-1, +0.135139870E-1
172+0.244316831E-1, +0.677974597E-1, +0.238841236, -0.762695372E-1
173+0.287885591E-1, +0.135139870E-1, -0.762695372E-1, +0.184905261
174do isam = 1, nsam
175 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
176 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
177end do
178covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
179covMerged
180+0.241714865, -0.289613716E-1, +0.244316962E-1, +0.287885480E-1
181-0.289613716E-1, +0.364150882, +0.677974373E-1, +0.135139860E-1
182+0.244316962E-1, +0.677974373E-1, +0.238841221, -0.762695372E-1
183+0.287885480E-1, +0.135139860E-1, -0.762695372E-1, +0.184905261
184covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
185covMerged
186+0.241714865, -0.289613716E-1, +0.244316962E-1, +0.287885480E-1
187-0.289613716E-1, +0.364150882, +0.677974373E-1, +0.135139860E-1
188+0.244316962E-1, +0.677974373E-1, +0.238841221, -0.762695372E-1
189+0.287885480E-1, +0.135139860E-1, -0.762695372E-1, +0.184905261
190cov(:,:,0) ! reference
191+0.241714865, -0.289614219E-1, +0.244316831E-1, +0.287885591E-1
192-0.289614219E-1, +0.364150763, +0.677974597E-1, +0.135139870E-1
193+0.244316831E-1, +0.677974597E-1, +0.238841236, -0.762695372E-1
194+0.287885591E-1, +0.135139870E-1, -0.762695372E-1, +0.184905261
195
196
197dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
198do isam = 2, nsam
199 lb(isam) = ub(isam - 1) + 1
200 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
201end do
202lb
203+1, +3
204ub
205+2, +9
206ndim = getUnifRand(1, minval(ub - lb + 1, 1))
207call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
208call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
209call setResized(covMerged, [ndim, ndim])
210sample = getUnifRand(-1., +1., ndim, ub(nsam))
211sample
212-0.609524846, +0.903454900, -0.992637634, -0.367419004, -0.395920634, +0.878209352, +0.877282619E-1, +0.142601967, -0.619130135E-1
213-0.225129008, +0.984055519, -0.917810440, +0.593317866, +0.360621452, +0.929785371, +0.132153511, -0.274257064, +0.233273268
214cov(:,:,0) = getCov(sample, dim)
215cov(:,:,0) ! reference
216+0.360974699, +0.270551324
217+0.270551324, +0.332073838
218do isam = 1, nsam
219 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
220 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
221end do
222covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
223covMerged
224+0.360974669, +0.270551264
225+0.270551264, +0.332073718
226covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
227covMerged
228+0.360974669, +0.270551264
229+0.270551264, +0.332073718
230cov(:,:,0) ! reference
231+0.360974699, +0.270551324
232+0.270551324, +0.332073838
233
234
235dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
236do isam = 2, nsam
237 lb(isam) = ub(isam - 1) + 1
238 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
239end do
240lb
241+1, +4
242ub
243+3, +10
244ndim = getUnifRand(1, minval(ub - lb + 1, 1))
245call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
246call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
247call setResized(covMerged, [ndim, ndim])
248sample = getUnifRand(-1., +1., ndim, ub(nsam))
249sample
250+0.365581155, -0.731999874E-1, -0.106020689, +0.480873466, -0.866870403, -0.144724965, +0.486977220, -0.958377838, +0.492727280, -0.502603650
251+0.846296549E-1, -0.704701543, +0.119326115E-1, +0.612583756, +0.363431931, -0.785944223, +0.561885834E-1, +0.121662021, -0.946765304, +0.375353932
252cov(:,:,0) = getCov(sample, dim)
253cov(:,:,0) ! reference
254+0.273675501, -0.636867508E-1
255-0.636867508E-1, +0.261829853
256do isam = 1, nsam
257 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
258 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
259end do
260covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
261covMerged
262+0.273675442, -0.636867881E-1
263-0.636867881E-1, +0.261829883
264covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
265covMerged
266+0.273675442, -0.636867881E-1
267-0.636867881E-1, +0.261829883
268cov(:,:,0) ! reference
269+0.273675501, -0.636867508E-1
270-0.636867508E-1, +0.261829853
271
272
273dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
274do isam = 2, nsam
275 lb(isam) = ub(isam - 1) + 1
276 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
277end do
278lb
279+1, +8
280ub
281+7, +12
282ndim = getUnifRand(1, minval(ub - lb + 1, 1))
283call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
284call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
285call setResized(covMerged, [ndim, ndim])
286sample = getUnifRand(-1., +1., ndim, ub(nsam))
287sample
288-0.349876881E-1, -0.626652241E-1, -0.591000199, +0.294861317, +0.597044230, -0.914378405, -0.837277174E-1, +0.373550534, -0.429550409, -0.663632393, +0.433650494, -0.258920670
289-0.908768177E-2, +0.549182296, -0.112284660, +0.657070637, -0.665625811, -0.785636902, +0.635945082, -0.436999202, -0.299843550, -0.986699581, +0.663479686, -0.250535011
290+0.660431743, -0.825237751, +0.444016695, +0.427774310, +0.234203815, -0.325801373E-1, -0.164177299, -0.801920891E-1, +0.848542571, -0.327888131, -0.937605739, -0.472491264
291cov(:,:,0) = getCov(sample, dim)
292cov(:,:,0) ! reference
293+0.209242567, +0.112537101, -0.342129432E-1
294+0.112537101, +0.323154479, -0.734827146E-1
295-0.342129432E-1, -0.734827146E-1, +0.292690605
296do isam = 1, nsam
297 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
298 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
299end do
300covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
301covMerged
302+0.209242582, +0.112537108, -0.342129506E-1
303+0.112537108, +0.323154479, -0.734827220E-1
304-0.342129506E-1, -0.734827220E-1, +0.292690665
305covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
306covMerged
307+0.209242582, +0.112537108, -0.342129506E-1
308+0.112537108, +0.323154479, -0.734827220E-1
309-0.342129506E-1, -0.734827220E-1, +0.292690665
310cov(:,:,0) ! reference
311+0.209242567, +0.112537101, -0.342129432E-1
312+0.112537101, +0.323154479, -0.734827146E-1
313-0.342129432E-1, -0.734827146E-1, +0.292690605
314
315
316dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
317do isam = 2, nsam
318 lb(isam) = ub(isam - 1) + 1
319 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
320end do
321lb
322+1, +6
323ub
324+5, +12
325ndim = getUnifRand(1, minval(ub - lb + 1, 1))
326call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
327call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
328call setResized(covMerged, [ndim, ndim])
329sample = getUnifRand(-1., +1., ndim, ub(nsam))
330sample
331+0.424404979, +0.785670638, +0.388367772, +0.858890414, -0.148493886, +0.726894140E-1, +0.813536286, +0.248022437, +0.544670820E-1, -0.638126850, -0.220623732, -0.635957003
332+0.773164868, +0.796957731, -0.723076344, +0.990809798, +0.232962012, -0.180916667, -0.681890249E-1, +0.666097045, -0.925797224, -0.814512849, +0.454158306, -0.361469984
333-0.754204154, -0.475651622, +0.171577454, +0.533966899, -0.457488298, +0.907611251, +0.941787362, -0.582931757, +0.145285845, +0.744918346, -0.427311778, -0.724592209
334-0.320654511, +0.454595089, +0.458431005, +0.430775881, -0.268006086, -0.505381823E-1, +0.928588629, +0.728483081, -0.914470553, +0.148860455, -0.463771820, +0.725812316
335+0.641360521, +0.543218255, +0.381977201, +0.208697319E-1, -0.302205801, +0.199525356E-1, -0.134611130E-2, +0.403347015, +0.905563593, +0.311652541, +0.488184690, +0.285637736
336cov(:,:,0) = getCov(sample, dim)
337cov(:,:,0) ! reference
338+0.247134715, +0.170436263, +0.558982007E-1, +0.772630274E-1, -0.380213070E-2
339+0.170436263, +0.422619432, -0.162958264, +0.583852939E-1, -0.303879976E-1
340+0.558982007E-1, -0.162958264, +0.387754440, +0.423029289E-1, -0.670315623E-1
341+0.772630274E-1, +0.583852939E-1, +0.423029289E-1, +0.290428221, -0.646240339E-1
342-0.380213070E-2, -0.303879976E-1, -0.670315623E-1, -0.646240339E-1, +0.100378618
343do isam = 1, nsam
344 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
345 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
346end do
347covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
348covMerged
349+0.247134715, +0.170436263, +0.558982380E-1, +0.772630274E-1, -0.380212814E-2
350+0.170436263, +0.422619313, -0.162958220, +0.583852828E-1, -0.303879790E-1
351+0.558982380E-1, -0.162958220, +0.387754291, +0.423028767E-1, -0.670315847E-1
352+0.772630274E-1, +0.583852828E-1, +0.423028767E-1, +0.290428281, -0.646240488E-1
353-0.380212814E-2, -0.303879790E-1, -0.670315847E-1, -0.646240488E-1, +0.100378662
354covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
355covMerged
356+0.247134715, +0.170436263, +0.558982380E-1, +0.772630274E-1, -0.380212814E-2
357+0.170436263, +0.422619313, -0.162958220, +0.583852828E-1, -0.303879790E-1
358+0.558982380E-1, -0.162958220, +0.387754291, +0.423028767E-1, -0.670315847E-1
359+0.772630274E-1, +0.583852828E-1, +0.423028767E-1, +0.290428281, -0.646240488E-1
360-0.380212814E-2, -0.303879790E-1, -0.670315847E-1, -0.646240488E-1, +0.100378662
361cov(:,:,0) ! reference
362+0.247134715, +0.170436263, +0.558982007E-1, +0.772630274E-1, -0.380213070E-2
363+0.170436263, +0.422619432, -0.162958264, +0.583852939E-1, -0.303879976E-1
364+0.558982007E-1, -0.162958264, +0.387754440, +0.423029289E-1, -0.670315623E-1
365+0.772630274E-1, +0.583852939E-1, +0.423029289E-1, +0.290428221, -0.646240339E-1
366-0.380213070E-2, -0.303879976E-1, -0.670315623E-1, -0.646240339E-1, +0.100378618
367
368
369dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
370do isam = 2, nsam
371 lb(isam) = ub(isam - 1) + 1
372 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
373end do
374lb
375+1, +8
376ub
377+7, +12
378ndim = getUnifRand(1, minval(ub - lb + 1, 1))
379call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
380call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
381call setResized(covMerged, [ndim, ndim])
382sample = getUnifRand(-1., +1., ndim, ub(nsam))
383sample
384+0.515513420, -0.795791507, -0.320049405, -0.189167023, -0.302109838, +0.883353472, -0.627524376, +0.487047076, -0.615162849E-1, -0.470565796, +0.543937206, -0.271256089
385cov(:,:,0) = getCov(sample, dim)
386cov(:,:,0) ! reference
387+0.258640409
388do isam = 1, nsam
389 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
390 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
391end do
392covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
393covMerged
394+0.258640379
395covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
396covMerged
397+0.258640379
398cov(:,:,0) ! reference
399+0.258640409
400
401
402!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
403!Compute the biased merged covariance of a frequency weighted multivariate sample.
404!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
405
406
407dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
408do isam = 2, nsam
409 lb(isam) = ub(isam - 1) + 1
410 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
411end do
412lb
413+1, +3
414ub
415+2, +9
416ndim = getUnifRand(1, minval(ub - lb + 1, 1))
417call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
418call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
419call setResized(covMerged, [ndim, ndim])
420sample = getUnifRand(-1., +1., ndim, ub(nsam))
421sample
422-0.197373867, -0.153590918, +0.845330715, -0.190570354, -0.973837495, -0.570324659, -0.456250310, -0.760878444, -0.542709589
423-0.406556606, -0.383972764, -0.432080865, +0.657816529, +0.954630733, +0.608223319, +0.843742132, +0.764674664, -0.775207281
424iweight = getUnifRand(1, 10, size(sample, dim, IK))
425iweight
426+3, +2, +9, +9, +4, +1, +3, +1, +8
427cov(:,:,0) = getCov(sample, 2_IK, iweight)
428cov(:,:,0) ! reference
429+0.342936337, -0.156519756
430-0.156519756, +0.446186632
431do isam = 1, nsam
432 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
433 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
434end do
435covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
436covMerged
437+0.342936277, -0.156519666
438-0.156519666, +0.446186662
439covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
440covMerged
441+0.342936277, -0.156519666
442-0.156519666, +0.446186662
443cov(:,:,0) ! reference
444+0.342936337, -0.156519756
445-0.156519756, +0.446186632
446
447
448dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
449do isam = 2, nsam
450 lb(isam) = ub(isam - 1) + 1
451 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
452end do
453lb
454+1, +7
455ub
456+6, +11
457ndim = getUnifRand(1, minval(ub - lb + 1, 1))
458call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
459call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
460call setResized(covMerged, [ndim, ndim])
461sample = getUnifRand(-1., +1., ndim, ub(nsam))
462sample
463-0.384662628, +0.264180303, +0.100095510, +0.913428068, -0.277535796, -0.534496546, -0.880666971, -0.863998413, -0.291821718, -0.999720454, +0.670798779
464-0.105460286, -0.751714826, -0.794672489, +0.556562185, -0.973960280, -0.960669875, +0.726837754, +0.622811913, -0.120126009, +0.690144539, +0.343933940
465+0.705355644, +0.634185076, -0.231496096, -0.968549728, +0.924779296, +0.926171899, +0.108165264, +0.832095504, +0.675756454, -0.378453255, +0.681734085E-2
466-0.474578500, +0.600169659, -0.998362780, -0.747842431, -0.254931927, +0.345475554, -0.141309261, +0.793461800, +0.535066962, +0.179133773, +0.934324384
467+0.664455295, -0.411200047, +0.939453840, -0.361445189, +0.378231645, -0.636002302, -0.525096059, +0.697192550, +0.723150253, -0.696919084, +0.528118610E-1
468iweight = getUnifRand(1, 10, size(sample, dim, IK))
469iweight
470+3, +4, +6, +10, +4, +5, +5, +2, +8, +9, +2
471cov(:,:,0) = getCov(sample, 2_IK, iweight)
472cov(:,:,0) ! reference
473+0.430911988, -0.385164954E-1, -0.200423896, -0.168991342, +0.507045947E-1
474-0.385164954E-1, +0.442107826, -0.275711030, -0.496802677E-3, -0.170983419
475-0.200423896, -0.275711030, +0.452619851, +0.235795990, +0.142566517
476-0.168991342, -0.496802677E-3, +0.235795990, +0.345864385, -0.490205027E-1
477+0.507045947E-1, -0.170983419, +0.142566517, -0.490205027E-1, +0.380937964
478do isam = 1, nsam
479 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
480 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
481end do
482covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
483covMerged
484+0.430911988, -0.385165215E-1, -0.200423926, -0.168991357, +0.507046133E-1
485-0.385165215E-1, +0.442107826, -0.275711060, -0.496804714E-3, -0.170983404
486-0.200423926, -0.275711060, +0.452619910, +0.235795975, +0.142566472
487-0.168991357, -0.496804714E-3, +0.235795975, +0.345864415, -0.490205102E-1
488+0.507046133E-1, -0.170983404, +0.142566472, -0.490205102E-1, +0.380937964
489covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
490covMerged
491+0.430911988, -0.385165215E-1, -0.200423926, -0.168991357, +0.507046133E-1
492-0.385165215E-1, +0.442107826, -0.275711060, -0.496804714E-3, -0.170983404
493-0.200423926, -0.275711060, +0.452619910, +0.235795975, +0.142566472
494-0.168991357, -0.496804714E-3, +0.235795975, +0.345864415, -0.490205102E-1
495+0.507046133E-1, -0.170983404, +0.142566472, -0.490205102E-1, +0.380937964
496cov(:,:,0) ! reference
497+0.430911988, -0.385164954E-1, -0.200423896, -0.168991342, +0.507045947E-1
498-0.385164954E-1, +0.442107826, -0.275711030, -0.496802677E-3, -0.170983419
499-0.200423896, -0.275711030, +0.452619851, +0.235795990, +0.142566517
500-0.168991342, -0.496802677E-3, +0.235795990, +0.345864385, -0.490205027E-1
501+0.507045947E-1, -0.170983419, +0.142566517, -0.490205027E-1, +0.380937964
502
503
504dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
505do isam = 2, nsam
506 lb(isam) = ub(isam - 1) + 1
507 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
508end do
509lb
510+1, +5
511ub
512+4, +6
513ndim = getUnifRand(1, minval(ub - lb + 1, 1))
514call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
515call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
516call setResized(covMerged, [ndim, ndim])
517sample = getUnifRand(-1., +1., ndim, ub(nsam))
518sample
519-0.296853900, -0.379853964, +0.870966554, +0.126925588, +0.780221224E-1, -0.622567534
520+0.928081036, +0.133993626E-1, -0.363834620, +0.561187863, +0.687178612, +0.110262394
521iweight = getUnifRand(1, 10, size(sample, dim, IK))
522iweight
523+2, +5, +5, +6, +3, +9
524cov(:,:,0) = getCov(sample, 2_IK, iweight)
525cov(:,:,0) ! reference
526+0.268085241, -0.531103946E-1
527-0.531103946E-1, +0.146063551
528do isam = 1, nsam
529 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
530 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
531end do
532covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
533covMerged
534+0.268085212, -0.531104133E-1
535-0.531104133E-1, +0.146063656
536covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
537covMerged
538+0.268085212, -0.531104133E-1
539-0.531104133E-1, +0.146063656
540cov(:,:,0) ! reference
541+0.268085241, -0.531103946E-1
542-0.531103946E-1, +0.146063551
543
544
545dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
546do isam = 2, nsam
547 lb(isam) = ub(isam - 1) + 1
548 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
549end do
550lb
551+1, +6
552ub
553+5, +10
554ndim = getUnifRand(1, minval(ub - lb + 1, 1))
555call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
556call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
557call setResized(covMerged, [ndim, ndim])
558sample = getUnifRand(-1., +1., ndim, ub(nsam))
559sample
560-0.529403329, +0.820819020, +0.507654667, -0.804889202E-2, +0.704899311, -0.602318883, +0.720745087, +0.362958908, -0.800908685, -0.688358665
561iweight = getUnifRand(1, 10, size(sample, dim, IK))
562iweight
563+4, +5, +10, +9, +10, +10, +2, +10, +2, +4
564cov(:,:,0) = getCov(sample, 2_IK, iweight)
565cov(:,:,0) ! reference
566+0.303689182
567do isam = 1, nsam
568 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
569 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
570end do
571covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
572covMerged
573+0.303689182
574covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
575covMerged
576+0.303689182
577cov(:,:,0) ! reference
578+0.303689182
579
580
581dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
582do isam = 2, nsam
583 lb(isam) = ub(isam - 1) + 1
584 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
585end do
586lb
587+1, +8
588ub
589+7, +11
590ndim = getUnifRand(1, minval(ub - lb + 1, 1))
591call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
592call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
593call setResized(covMerged, [ndim, ndim])
594sample = getUnifRand(-1., +1., ndim, ub(nsam))
595sample
596-0.452725649, -0.384719014, -0.788704991, -0.223403573, +0.546823025, +0.925979495, +0.454782724, +0.745723605, -0.829160333, -0.710417032E-1, +0.296776175
597+0.507106304, -0.965466380, +0.688716888, -0.790937424, -0.313876271, -0.975387692, +0.271956563, -0.691972375, +0.256676555, +0.690219283, +0.616319060
598-0.337959409, +0.128120303, -0.649802446, +0.649259925, +0.413934350, +0.543892026, -0.140561342, +0.119246483, +0.930256128, -0.431856155, +0.112541199
599iweight = getUnifRand(1, 10, size(sample, dim, IK))
600iweight
601+1, +8, +5, +9, +3, +3, +2, +4, +10, +9, +10
602cov(:,:,0) = getCov(sample, 2_IK, iweight)
603cov(:,:,0) ! reference
604+0.282207668, -0.686423779E-1, -0.348747969E-1
605-0.686423779E-1, +0.462637752, -0.149972469
606-0.348747969E-1, -0.149972469, +0.242351234
607do isam = 1, nsam
608 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
609 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
610end do
611covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
612covMerged
613+0.282207549, -0.686423257E-1, -0.348748006E-1
614-0.686423257E-1, +0.462637722, -0.149972484
615-0.348748006E-1, -0.149972484, +0.242351264
616covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
617covMerged
618+0.282207549, -0.686423257E-1, -0.348748006E-1
619-0.686423257E-1, +0.462637722, -0.149972484
620-0.348748006E-1, -0.149972484, +0.242351264
621cov(:,:,0) ! reference
622+0.282207668, -0.686423779E-1, -0.348747969E-1
623-0.686423779E-1, +0.462637752, -0.149972469
624-0.348747969E-1, -0.149972469, +0.242351234
625
626
627dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
628do isam = 2, nsam
629 lb(isam) = ub(isam - 1) + 1
630 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
631end do
632lb
633+1, +6
634ub
635+5, +8
636ndim = getUnifRand(1, minval(ub - lb + 1, 1))
637call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
638call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
639call setResized(covMerged, [ndim, ndim])
640sample = getUnifRand(-1., +1., ndim, ub(nsam))
641sample
642+0.380292654, -0.982146263, -0.219104171, -0.135291338, -0.215328932, +0.342729926, +0.449106336, +0.941773057
643+0.977139354, -0.985900640, -0.570864797, -0.101829410, +0.989561081E-1, -0.368391275E-1, +0.221996188, +0.205919862
644+0.177469492, +0.279110074, +0.181578159, -0.536322594E-3, +0.705205321, +0.276971459, +0.277076006, +0.868615270
645iweight = getUnifRand(1, 10, size(sample, dim, IK))
646iweight
647+10, +3, +5, +5, +10, +3, +9, +3
648cov(:,:,0) = getCov(sample, 2_IK, iweight)
649cov(:,:,0) ! reference
650+0.197466493, +0.163436100, +0.698185479E-2
651+0.163436100, +0.287774801, -0.498529291E-2
652+0.698185479E-2, -0.498529291E-2, +0.666568279E-1
653do isam = 1, nsam
654 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
655 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
656end do
657covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
658covMerged
659+0.197466537, +0.163436085, +0.698185898E-2
660+0.163436085, +0.287774682, -0.498528825E-2
661+0.698185898E-2, -0.498528825E-2, +0.666568205E-1
662covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
663covMerged
664+0.197466537, +0.163436085, +0.698185898E-2
665+0.163436085, +0.287774682, -0.498528825E-2
666+0.698185898E-2, -0.498528825E-2, +0.666568205E-1
667cov(:,:,0) ! reference
668+0.197466493, +0.163436100, +0.698185479E-2
669+0.163436100, +0.287774801, -0.498529291E-2
670+0.698185479E-2, -0.498529291E-2, +0.666568279E-1
671
672
673dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
674do isam = 2, nsam
675 lb(isam) = ub(isam - 1) + 1
676 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
677end do
678lb
679+1, +8
680ub
681+7, +11
682ndim = getUnifRand(1, minval(ub - lb + 1, 1))
683call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
684call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
685call setResized(covMerged, [ndim, ndim])
686sample = getUnifRand(-1., +1., ndim, ub(nsam))
687sample
688+0.682350397E-1, -0.602595210, +0.156207919, -0.538625360, +0.998635054, -0.239477992, -0.199894071, +0.371229649E-1, -0.600934029E-3, -0.694355965, -0.770249844
689iweight = getUnifRand(1, 10, size(sample, dim, IK))
690iweight
691+5, +5, +4, +5, +4, +2, +9, +8, +10, +2, +8
692cov(:,:,0) = getCov(sample, 2_IK, iweight)
693cov(:,:,0) ! reference
694+0.191394597
695do isam = 1, nsam
696 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
697 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
698end do
699covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
700covMerged
701+0.191394612
702covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
703covMerged
704+0.191394612
705cov(:,:,0) ! reference
706+0.191394597
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, +9
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, 1_IK], [ndim, nsam])
721call setResized(covMerged, [ndim, ndim])
722sample = getUnifRand(-1., +1., ndim, ub(nsam))
723sample
724+0.368094802, +0.337949157, +0.402952194, -0.881861567, -0.992952585E-1, +0.905221820, +0.160231233, -0.220838785, -0.728072286
725-0.115045190, -0.815880299E-1, +0.759442091, -0.148627639, +0.154563546, +0.899271965, +0.382173538, +0.759997129, +0.426724195
726iweight = getUnifRand(1, 10, size(sample, dim, IK))
727iweight
728+8, +8, +4, +9, +2, +9, +6, +6, +4
729cov(:,:,0) = getCov(sample, 2_IK, iweight)
730cov(:,:,0) ! reference
731+0.345047832, +0.107825622
732+0.107825622, +0.175821573
733do isam = 1, nsam
734 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
735 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
736end do
737covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
738covMerged
739+0.345047832, +0.107825622
740+0.107825622, +0.175821558
741covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
742covMerged
743+0.345047832, +0.107825622
744+0.107825622, +0.175821558
745cov(:,:,0) ! reference
746+0.345047832, +0.107825622
747+0.107825622, +0.175821573
748
749
750dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
751do isam = 2, nsam
752 lb(isam) = ub(isam - 1) + 1
753 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
754end do
755lb
756+1, +4
757ub
758+3, +5
759ndim = getUnifRand(1, minval(ub - lb + 1, 1))
760call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
761call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
762call setResized(covMerged, [ndim, ndim])
763sample = getUnifRand(-1., +1., ndim, ub(nsam))
764sample
765-0.818233490E-1, -0.633889079, -0.253235579, +0.598838449, +0.257411838
766iweight = getUnifRand(1, 10, size(sample, dim, IK))
767iweight
768+9, +10, +6, +6, +4
769cov(:,:,0) = getCov(sample, 2_IK, iweight)
770cov(:,:,0) ! reference
771+0.183688387
772do isam = 1, nsam
773 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
774 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
775end do
776covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
777covMerged
778+0.183688372
779covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
780covMerged
781+0.183688372
782cov(:,:,0) ! reference
783+0.183688387
784
785
786dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
787do isam = 2, nsam
788 lb(isam) = ub(isam - 1) + 1
789 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
790end do
791lb
792+1, +6
793ub
794+5, +7
795ndim = getUnifRand(1, minval(ub - lb + 1, 1))
796call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
797call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
798call setResized(covMerged, [ndim, ndim])
799sample = getUnifRand(-1., +1., ndim, ub(nsam))
800sample
801-0.170882106, -0.252037168, -0.446684361E-1, -0.131878853E-1, -0.694365621, -0.913623571, -0.168187737
802+0.512237549, +0.184028625, +0.647021651, -0.366358876, +0.116049528, +0.941858411, -0.915260077
803iweight = getUnifRand(1, 10, size(sample, dim, IK))
804iweight
805+4, +1, +8, +4, +3, +10, +3
806cov(:,:,0) = getCov(sample, 2_IK, iweight)
807cov(:,:,0) ! reference
808+0.148460373, -0.116931848
809-0.116931848, +0.342437923
810do isam = 1, nsam
811 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
812 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
813end do
814covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
815covMerged
816+0.148460373, -0.116931841
817-0.116931841, +0.342437953
818covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
819covMerged
820+0.148460373, -0.116931841
821-0.116931841, +0.342437953
822cov(:,:,0) ! reference
823+0.148460373, -0.116931848
824-0.116931848, +0.342437923
825
826
827!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
828!Compute the biased merged covariance of a reliability weighted multivariate sample.
829!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
830
831
832dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
833do isam = 2, nsam
834 lb(isam) = ub(isam - 1) + 1
835 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
836end do
837lb
838+1, +4
839ub
840+3, +7
841ndim = getUnifRand(1, minval(ub - lb + 1, 1))
842call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
843call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
844call setResized(covMerged, [ndim, ndim])
845sample = getUnifRand(-1., +1., ndim, ub(nsam))
846sample
847+0.360957503, -0.739465952, -0.761714697, +0.958295822, -0.159062266, +0.927077293, -0.633233786E-1
848-0.396288633, -0.423802495, +0.672270775, +0.399061918, -0.297021270, -0.704549670, +0.610934496E-1
849-0.169243693, +0.266524911, +0.288313627, +0.390744209E-1, +0.202130079, -0.134053469, +0.866860628
850rweight = getUnifRand(1., 2., size(sample, dim, IK))
851rweight
852+1.91824138, +1.46134067, +1.41583574, +1.18216491, +1.66033697, +1.68307734, +1.14657569
853cov(:,:,0) = getCov(sample, 2_IK, rweight)
854cov(:,:,0) ! reference
855+0.417825907, -0.937820226E-1, -0.108462065
856-0.937820226E-1, +0.204837471, +0.591445044E-1
857-0.108462065, +0.591445044E-1, +0.942178518E-1
858do isam = 1, nsam
859 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
860 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
861end do
862covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
863covMerged
864+0.417825997, -0.937819853E-1, -0.108462051
865-0.937819853E-1, +0.204837486, +0.591444857E-1
866-0.108462051, +0.591444857E-1, +0.942178518E-1
867covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
868covMerged
869+0.417825997, -0.937819853E-1, -0.108462051
870-0.937819853E-1, +0.204837486, +0.591444857E-1
871-0.108462051, +0.591444857E-1, +0.942178518E-1
872cov(:,:,0) ! reference
873+0.417825907, -0.937820226E-1, -0.108462065
874-0.937820226E-1, +0.204837471, +0.591445044E-1
875-0.108462065, +0.591445044E-1, +0.942178518E-1
876
877
878dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
879do isam = 2, nsam
880 lb(isam) = ub(isam - 1) + 1
881 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
882end do
883lb
884+1, +3
885ub
886+2, +6
887ndim = getUnifRand(1, minval(ub - lb + 1, 1))
888call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
889call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
890call setResized(covMerged, [ndim, ndim])
891sample = getUnifRand(-1., +1., ndim, ub(nsam))
892sample
893+0.241536617, +0.966992378E-1, +0.677903891, -0.175760627, +0.161564469, +0.111931086
894rweight = getUnifRand(1., 2., size(sample, dim, IK))
895rweight
896+1.39979434, +1.51533961, +1.57947898, +1.67973089, +1.95610476, +1.14286280
897cov(:,:,0) = getCov(sample, 2_IK, rweight)
898cov(:,:,0) ! reference
899+0.674846843E-1
900do isam = 1, nsam
901 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
902 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
903end do
904covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
905covMerged
906+0.674847141E-1
907covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
908covMerged
909+0.674847141E-1
910cov(:,:,0) ! reference
911+0.674846843E-1
912
913
914dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
915do isam = 2, nsam
916 lb(isam) = ub(isam - 1) + 1
917 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
918end do
919lb
920+1, +7
921ub
922+6, +12
923ndim = getUnifRand(1, minval(ub - lb + 1, 1))
924call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
925call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
926call setResized(covMerged, [ndim, ndim])
927sample = getUnifRand(-1., +1., ndim, ub(nsam))
928sample
929-0.275091529, +0.294095993, +0.250872612, +0.567560077, +0.501770258, -0.346876025, +0.428892970, +0.861753225, -0.974786043, +0.809074640, -0.530629635, -0.335462451
930+0.423863530, +0.972639322E-1, +0.408923745, +0.893060088, +0.618352056, -0.463502526, +0.986799121, -0.983544111, -0.857935071, -0.385099649, +0.371596694, -0.472127795
931+0.308703542, -0.321539640E-1, +0.142372847E-1, -0.566674709, +0.925955296, -0.825324059E-1, +0.103193045, -0.779335976, -0.735169053, +0.551013947, +0.461679220, -0.670419097
932-0.492211699, -0.188394785E-1, +0.138161540, +0.250766397, -0.181661248, +0.338420391, +0.475397587, -0.192470551E-1, +0.847903252, +0.280212522, +0.498305559, +0.599375725
933-0.931526661, +0.703163385, +0.376219392, -0.298035264, -0.919851780, +0.448298454E-2, -0.282403111, -0.406238437, +0.398800850, -0.980658293, +0.758873940, +0.936976552
934rweight = getUnifRand(1., 2., size(sample, dim, IK))
935rweight
936+1.31860042, +1.82277846, +1.62192857, +1.01879179, +1.42741191, +1.81362391, +1.51937342, +1.38301361, +1.89903402, +1.97993922, +1.17469597, +1.48918772
937cov(:,:,0) = getCov(sample, 2_IK, rweight)
938cov(:,:,0) ! reference
939+0.325481683, +0.962510332E-1, +0.952842236E-1, -0.993375927E-1, -0.206139103
940+0.962510332E-1, +0.393903434, +0.173604637, -0.770341381E-1, -0.726224557E-1
941+0.952842236E-1, +0.173604637, +0.274354756, -0.849287510E-1, -0.175725743
942-0.993375927E-1, -0.770341381E-1, -0.849287510E-1, +0.122914165, +0.120091721
943-0.206139103, -0.726224557E-1, -0.175725743, +0.120091721, +0.437241524
944do isam = 1, nsam
945 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
946 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
947end do
948covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
949covMerged
950+0.325481683, +0.962509960E-1, +0.952842012E-1, -0.993376151E-1, -0.206139058
951+0.962509960E-1, +0.393903196, +0.173604608, -0.770341828E-1, -0.726224408E-1
952+0.952842012E-1, +0.173604608, +0.274354726, -0.849287659E-1, -0.175725788
953-0.993376151E-1, -0.770341828E-1, -0.849287659E-1, +0.122914158, +0.120091811
954-0.206139058, -0.726224408E-1, -0.175725788, +0.120091811, +0.437241614
955covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
956covMerged
957+0.325481683, +0.962509960E-1, +0.952842012E-1, -0.993376151E-1, -0.206139058
958+0.962509960E-1, +0.393903196, +0.173604608, -0.770341828E-1, -0.726224408E-1
959+0.952842012E-1, +0.173604608, +0.274354726, -0.849287659E-1, -0.175725788
960-0.993376151E-1, -0.770341828E-1, -0.849287659E-1, +0.122914158, +0.120091811
961-0.206139058, -0.726224408E-1, -0.175725788, +0.120091811, +0.437241614
962cov(:,:,0) ! reference
963+0.325481683, +0.962510332E-1, +0.952842236E-1, -0.993375927E-1, -0.206139103
964+0.962510332E-1, +0.393903434, +0.173604637, -0.770341381E-1, -0.726224557E-1
965+0.952842236E-1, +0.173604637, +0.274354756, -0.849287510E-1, -0.175725743
966-0.993375927E-1, -0.770341381E-1, -0.849287510E-1, +0.122914165, +0.120091721
967-0.206139103, -0.726224557E-1, -0.175725743, +0.120091721, +0.437241524
968
969
970dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
971do isam = 2, nsam
972 lb(isam) = ub(isam - 1) + 1
973 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
974end do
975lb
976+1, +8
977ub
978+7, +10
979ndim = getUnifRand(1, minval(ub - lb + 1, 1))
980call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
981call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
982call setResized(covMerged, [ndim, ndim])
983sample = getUnifRand(-1., +1., ndim, ub(nsam))
984sample
985-0.501985431, -0.985388756, -0.310525894E-1, +0.490321159, +0.100234747, -0.250560045E-1, +0.955755830, +0.430842042, +0.938860416, +0.954124570
986+0.543662786, -0.551708102, +0.823263526, -0.388222694, +0.811121941, -0.486875772E-1, -0.180379510, -0.840799212, -0.377599359, +0.914110184
987+0.168731928, +0.126706004, -0.110031009, +0.958979726, -0.949530721, +0.806047559, +0.114392042E-1, +0.262134910, -0.936820865, -0.743309379
988rweight = getUnifRand(1., 2., size(sample, dim, IK))
989rweight
990+1.04637778, +1.20557380, +1.99812746, +1.88331008, +1.80594468, +1.35627460, +1.56584227, +1.77880526, +1.84208536, +1.50244689
991cov(:,:,0) = getCov(sample, 2_IK, rweight)
992cov(:,:,0) ! reference
993+0.329413861, -0.298964009E-1, -0.106314972
994-0.298964009E-1, +0.391267359, -0.187977403
995-0.106314972, -0.187977403, +0.426224440
996do isam = 1, nsam
997 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
998 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
999end do
1000covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1001covMerged
1002+0.329413712, -0.298963618E-1, -0.106314927
1003-0.298963618E-1, +0.391267389, -0.187977389
1004-0.106314927, -0.187977389, +0.426224411
1005covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1006covMerged
1007+0.329413712, -0.298963618E-1, -0.106314927
1008-0.298963618E-1, +0.391267389, -0.187977389
1009-0.106314927, -0.187977389, +0.426224411
1010cov(:,:,0) ! reference
1011+0.329413861, -0.298964009E-1, -0.106314972
1012-0.298964009E-1, +0.391267359, -0.187977403
1013-0.106314972, -0.187977403, +0.426224440
1014
1015
1016dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1017do isam = 2, nsam
1018 lb(isam) = ub(isam - 1) + 1
1019 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1020end do
1021lb
1022+1, +6
1023ub
1024+5, +10
1025ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1026call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
1027call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
1028call setResized(covMerged, [ndim, ndim])
1029sample = getUnifRand(-1., +1., ndim, ub(nsam))
1030sample
1031+0.979285717, -0.128044128, +0.301945210, +0.528178811, -0.708107352, +0.364736080, -0.414368153, -0.852784991, +0.862962365, -0.163995028E-1
1032-0.637146592, +0.662392378E-1, +0.865000248, +0.953804970, +0.839768767, +0.282483578, +0.898770571, +0.206402183, -0.852016926, -0.859671116
1033+0.935975909, -0.462703466, -0.945620418, +0.438893676, +0.751902223, +0.797420502, +0.574779272, +0.449635267, +0.169126511, +0.612174273
1034+0.505215049, -0.478659153, -0.633904934E-1, +0.417311192E-1, -0.539137363, +0.555067658, +0.886781216, +0.982346058, -0.460291386, +0.332939386
1035rweight = getUnifRand(1., 2., size(sample, dim, IK))
1036rweight
1037+1.63534