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, +5
14ub
15+4, +8
16ndim = getUnifRand(1, minval(ub - lb + 1, 1))
17call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
18call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
19call setResized(covMerged, [ndim, ndim])
20sample = getUnifRand(-1., +1., ndim, ub(nsam))
21sample
22+0.450637341E-1, -0.610611081, -0.491617560, -0.628936291E-2, +0.953146338, +0.872737527, +0.445302367, -0.515410781
23+0.675175548, +0.860852599, +0.465351939, -0.107527971, +0.441815019, -0.356558919, +0.731018782E-1, -0.855446577
24cov(:,:,0) = getCov(sample, dim)
25cov(:,:,0) ! reference
26+0.336348981, -0.304370429E-1
27-0.304370429E-1, +0.288185179
28do isam = 1, nsam
29 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
30 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
31end do
32covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
33covMerged
34+0.336348981, -0.304370522E-1
35-0.304370522E-1, +0.288185120
36covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
37covMerged
38+0.336348981, -0.304370522E-1
39-0.304370522E-1, +0.288185120
40cov(:,:,0) ! reference
41+0.336348981, -0.304370429E-1
42-0.304370429E-1, +0.288185179
43
44
45dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
46do isam = 2, nsam
47 lb(isam) = ub(isam - 1) + 1
48 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
49end do
50lb
51+1, +3
52ub
53+2, +8
54ndim = getUnifRand(1, minval(ub - lb + 1, 1))
55call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
56call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
57call setResized(covMerged, [ndim, ndim])
58sample = getUnifRand(-1., +1., ndim, ub(nsam))
59sample
60-0.301201582, -0.778019428E-2, +0.803737164, +0.290375471, -0.800509334, -0.387130976E-1, -0.581565142, +0.307525396E-1
61-0.819391131, +0.661956549, -0.412773013, +0.407414675, -0.290068746, +0.975401282, +0.743260503, -0.541463137
62cov(:,:,0) = getCov(sample, dim)
63cov(:,:,0) ! reference
64+0.219604164, -0.214375705E-1
65-0.214375705E-1, +0.407692492
66do isam = 1, nsam
67 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
68 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
69end do
70covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
71covMerged
72+0.219604105, -0.214375705E-1
73-0.214375705E-1, +0.407692403
74covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
75covMerged
76+0.219604105, -0.214375705E-1
77-0.214375705E-1, +0.407692403
78cov(:,:,0) ! reference
79+0.219604164, -0.214375705E-1
80-0.214375705E-1, +0.407692492
81
82
83dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
84do isam = 2, nsam
85 lb(isam) = ub(isam - 1) + 1
86 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
87end do
88lb
89+1, +4
90ub
91+3, +9
92ndim = getUnifRand(1, minval(ub - lb + 1, 1))
93call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
94call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
95call setResized(covMerged, [ndim, ndim])
96sample = getUnifRand(-1., +1., ndim, ub(nsam))
97sample
98+0.841224790, +0.645623803, +0.367563605, +0.295297146, +0.113376379, +0.761953950, -0.913920760, +0.581540108, +0.464791536
99cov(:,:,0) = getCov(sample, dim)
100cov(:,:,0) ! reference
101+0.246885598
102do isam = 1, nsam
103 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
104 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
105end do
106covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
107covMerged
108+0.246885583
109covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
110covMerged
111+0.246885583
112cov(:,:,0) ! reference
113+0.246885598
114
115
116dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
117do isam = 2, nsam
118 lb(isam) = ub(isam - 1) + 1
119 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
120end do
121lb
122+1, +3
123ub
124+2, +9
125ndim = getUnifRand(1, minval(ub - lb + 1, 1))
126call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
127call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
128call setResized(covMerged, [ndim, ndim])
129sample = getUnifRand(-1., +1., ndim, ub(nsam))
130sample
131-0.335389376, +0.981045008, +0.351724029, +0.673404813, +0.126100183, +0.424951553, +0.673906803, -0.405617952E-1, -0.468123555
132-0.456481099, +0.511905313, +0.313720345, -0.306247234, -0.457380414, -0.771933913, -0.356824756, +0.491256118, -0.151334405
133cov(:,:,0) = getCov(sample, dim)
134cov(:,:,0) ! reference
135+0.210046962, +0.331117585E-1
136+0.331117585E-1, +0.189298287
137do isam = 1, nsam
138 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
139 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
140end do
141covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
142covMerged
143+0.210047081, +0.331117846E-1
144+0.331117846E-1, +0.189298227
145covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
146covMerged
147+0.210047081, +0.331117846E-1
148+0.331117846E-1, +0.189298227
149cov(:,:,0) ! reference
150+0.210046962, +0.331117585E-1
151+0.331117585E-1, +0.189298287
152
153
154dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
155do isam = 2, nsam
156 lb(isam) = ub(isam - 1) + 1
157 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
158end do
159lb
160+1, +3
161ub
162+2, +8
163ndim = getUnifRand(1, minval(ub - lb + 1, 1))
164call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
165call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
166call setResized(covMerged, [ndim, ndim])
167sample = getUnifRand(-1., +1., ndim, ub(nsam))
168sample
169+0.600907922, +0.458190203, +0.785186410, -0.965387344, +0.836360812, +0.147287965, -0.778874993, +0.225036144
170+0.324555635E-1, -0.125413060, +0.788404822, -0.282290339, -0.253738165, +0.299222708, -0.120128989, -0.484546423
171cov(:,:,0) = getCov(sample, dim)
172cov(:,:,0) ! reference
173+0.410488844, +0.867342204E-1
174+0.867342204E-1, +0.139814958
175do isam = 1, nsam
176 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
177 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
178end do
179covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
180covMerged
181+0.410488784, +0.867341682E-1
182+0.867341682E-1, +0.139814898
183covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
184covMerged
185+0.410488784, +0.867341682E-1
186+0.867341682E-1, +0.139814898
187cov(:,:,0) ! reference
188+0.410488844, +0.867342204E-1
189+0.867342204E-1, +0.139814958
190
191
192dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
193do isam = 2, nsam
194 lb(isam) = ub(isam - 1) + 1
195 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
196end do
197lb
198+1, +7
199ub
200+6, +10
201ndim = getUnifRand(1, minval(ub - lb + 1, 1))
202call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
203call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
204call setResized(covMerged, [ndim, ndim])
205sample = getUnifRand(-1., +1., ndim, ub(nsam))
206sample
207+0.795622587, -0.833768845, -0.375502110E-1, +0.658658266, -0.983849406, +0.699225783, +0.486072183, +0.463241339E-1, +0.482689857, -0.630543709
208-0.765086174, +0.738909245, +0.222170949, +0.456683397, +0.281706572, +0.757912040, -0.200455666, +0.648760080, +0.911051869, +0.943559885
209+0.590635300, -0.592049718, -0.270102024E-1, +0.837349772, -0.354030490, +0.927955747, -0.762915373, +0.296726942, +0.873600125, -0.146466970
210-0.788743854, -0.774896145E-1, -0.698962331, -0.150138617, +0.855952263, +0.642811060, +0.137753248, -0.404669166, -0.517717600, -0.795998454
211cov(:,:,0) = getCov(sample, dim)
212cov(:,:,0) ! reference
213+0.404265612, -0.117495537, +0.255795360, -0.605280884E-1
214-0.117495537, +0.262827396, +0.437020324E-1, +0.255801212E-1
215+0.255795360, +0.437020324E-1, +0.357220620, -0.498792417E-1
216-0.605280884E-1, +0.255801212E-1, -0.498792417E-1, +0.304645687
217do isam = 1, nsam
218 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
219 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
220end do
221covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
222covMerged
223+0.404265672, -0.117495649, +0.255795419, -0.605280809E-1
224-0.117495649, +0.262827218, +0.437020510E-1, +0.255799759E-1
225+0.255795419, +0.437020510E-1, +0.357220650, -0.498791784E-1
226-0.605280809E-1, +0.255799759E-1, -0.498791784E-1, +0.304645598
227covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
228covMerged
229+0.404265672, -0.117495649, +0.255795419, -0.605280809E-1
230-0.117495649, +0.262827218, +0.437020510E-1, +0.255799759E-1
231+0.255795419, +0.437020510E-1, +0.357220650, -0.498791784E-1
232-0.605280809E-1, +0.255799759E-1, -0.498791784E-1, +0.304645598
233cov(:,:,0) ! reference
234+0.404265612, -0.117495537, +0.255795360, -0.605280884E-1
235-0.117495537, +0.262827396, +0.437020324E-1, +0.255801212E-1
236+0.255795360, +0.437020324E-1, +0.357220620, -0.498792417E-1
237-0.605280884E-1, +0.255801212E-1, -0.498792417E-1, +0.304645687
238
239
240dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
241do isam = 2, nsam
242 lb(isam) = ub(isam - 1) + 1
243 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
244end do
245lb
246+1, +3
247ub
248+2, +8
249ndim = getUnifRand(1, minval(ub - lb + 1, 1))
250call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
251call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
252call setResized(covMerged, [ndim, ndim])
253sample = getUnifRand(-1., +1., ndim, ub(nsam))
254sample
255-0.416302681E-2, +0.163148999, +0.296568871, +0.469714880, -0.964169741, +0.619914055, +0.300279975, -0.200547338
256+0.994880199E-1, -0.107620478, +0.155203342E-1, -0.598744273, -0.629655600, +0.894396186, -0.344861388, -0.922043085
257cov(:,:,0) = getCov(sample, dim)
258cov(:,:,0) ! reference
259+0.215199664, +0.135486424
260+0.135486424, +0.278538227
261do isam = 1, nsam
262 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
263 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
264end do
265covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
266covMerged
267+0.215199649, +0.135486409
268+0.135486409, +0.278538227
269covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
270covMerged
271+0.215199649, +0.135486409
272+0.135486409, +0.278538227
273cov(:,:,0) ! reference
274+0.215199664, +0.135486424
275+0.135486424, +0.278538227
276
277
278dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
279do isam = 2, nsam
280 lb(isam) = ub(isam - 1) + 1
281 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
282end do
283lb
284+1, +3
285ub
286+2, +7
287ndim = getUnifRand(1, minval(ub - lb + 1, 1))
288call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
289call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
290call setResized(covMerged, [ndim, ndim])
291sample = getUnifRand(-1., +1., ndim, ub(nsam))
292sample
293+0.627670765, -0.952230573, -0.286328912, -0.134507298, -0.160314322, -0.529143572, +0.267469287
294+0.797800183, -0.445395112, +0.243161082, +0.911533833, +0.589144826, -0.198876858E-2, -0.346111298
295cov(:,:,0) = getCov(sample, dim)
296cov(:,:,0) ! reference
297+0.226191252, +0.119744167
298+0.119744167, +0.250742733
299do isam = 1, nsam
300 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
301 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
302end do
303covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
304covMerged
305+0.226191387, +0.119744189
306+0.119744189, +0.250742704
307covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
308covMerged
309+0.226191387, +0.119744189
310+0.119744189, +0.250742704
311cov(:,:,0) ! reference
312+0.226191252, +0.119744167
313+0.119744167, +0.250742733
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, +10
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.859307766, +0.456455946E-1, -0.788327217, -0.261896849E-1, +0.175618052, +0.330812097, -0.156358719, -0.615751028, +0.239437222, -0.625873446
332cov(:,:,0) = getCov(sample, dim)
333cov(:,:,0) ! reference
334+0.232401282
335do isam = 1, nsam
336 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
337 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
338end do
339covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
340covMerged
341+0.232401431
342covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
343covMerged
344+0.232401431
345cov(:,:,0) ! reference
346+0.232401282
347
348
349dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
350do isam = 2, nsam
351 lb(isam) = ub(isam - 1) + 1
352 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
353end do
354lb
355+1, +8
356ub
357+7, +14
358ndim = getUnifRand(1, minval(ub - lb + 1, 1))
359call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
360call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
361call setResized(covMerged, [ndim, ndim])
362sample = getUnifRand(-1., +1., ndim, ub(nsam))
363sample
364-0.473278046, -0.425458431, -0.838589549, +0.351130486, +0.172026992, -0.779786348, -0.621291518, -0.932459354, -0.771084666, +0.551692486, -0.958312035, +0.264825583, -0.966746569, +0.758785248
365+0.306807518, -0.113936782, +0.551424980, +0.329100370, +0.799896598, -0.635525346, +0.255969763, +0.252819419, +0.540169954, -0.996176839, +0.881794691E-1, -0.774004221, +0.937409878, +0.445365667
366+0.785850167, -0.902239561, +0.427274108, -0.886052251, -0.435478687, +0.382800817, -0.951796532, -0.787885070, -0.443001270, -0.295328736, -0.264702201, +0.708008289, -0.144065142, -0.474295020
367+0.281754613, +0.129782557, +0.342811108, -0.611981392, +0.531323552, +0.237221241, -0.684559464, -0.579460979, +0.747812510, +0.737679005E-1, +0.171307683, -0.723671317, -0.751341581E-1, -0.227031112
368-0.873981476, -0.377622843E-1, -0.199038386, -0.725902557, -0.112041593, -0.783107281, -0.402870893, -0.533177495, +0.374304533, -0.505883098, -0.762345076, +0.462946892, +0.358415127, -0.285741448
369+0.419178963, -0.473522305, +0.859965086E-1, -0.761778235, +0.237414360, +0.761792541, -0.815062761, -0.598733902, +0.889350891, +0.966055751, -0.790243268, -0.576622725, +0.851277828, +0.503519654
370cov(:,:,0) = getCov(sample, dim)
371cov(:,:,0) ! reference
372+0.354689419, -0.975931138E-1, -0.285539217E-1, -0.670704097E-1, +0.429381663E-2, +0.299162138E-1
373-0.975931138E-1, +0.312756985, -0.816770196E-1, +0.571971685E-1, +0.441813916E-1, +0.101981377E-1
374-0.285539217E-1, -0.816770196E-1, +0.328124523, +0.627024174E-1, +0.796045642E-2, +0.130571365
375-0.670704097E-1, +0.571971685E-1, +0.627024174E-1, +0.206821367, +0.120139811E-1, +0.187379763
376+0.429381663E-2, +0.441813916E-1, +0.796045642E-2, +0.120139811E-1, +0.189140394, +0.538310520E-1
377+0.299162138E-1, +0.101981377E-1, +0.130571365, +0.187379763, +0.538310520E-1, +0.447976440
378do isam = 1, nsam
379 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), dim)
380 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), dim)
381end do
382covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
383covMerged
384+0.354689449, -0.975930989E-1, -0.285539236E-1, -0.670704320E-1, +0.429380685E-2, +0.299161710E-1
385-0.975930989E-1, +0.312757015, -0.816770345E-1, +0.571971796E-1, +0.441813953E-1, +0.101981563E-1
386-0.285539236E-1, -0.816770345E-1, +0.328124553, +0.627024695E-1, +0.796051603E-2, +0.130571306
387-0.670704320E-1, +0.571971796E-1, +0.627024695E-1, +0.206821382, +0.120139550E-1, +0.187379748
388+0.429380685E-2, +0.441813953E-1, +0.796051603E-2, +0.120139550E-1, +0.189140424, +0.538310185E-1
389+0.299161710E-1, +0.101981563E-1, +0.130571306, +0.187379748, +0.538310185E-1, +0.447976351
390covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(ub(1), TKG) / real(ub(2), TKG))
391covMerged
392+0.354689449, -0.975930989E-1, -0.285539236E-1, -0.670704320E-1, +0.429380685E-2, +0.299161710E-1
393-0.975930989E-1, +0.312757015, -0.816770345E-1, +0.571971796E-1, +0.441813953E-1, +0.101981563E-1
394-0.285539236E-1, -0.816770345E-1, +0.328124553, +0.627024695E-1, +0.796051603E-2, +0.130571306
395-0.670704320E-1, +0.571971796E-1, +0.627024695E-1, +0.206821382, +0.120139550E-1, +0.187379748
396+0.429380685E-2, +0.441813953E-1, +0.796051603E-2, +0.120139550E-1, +0.189140424, +0.538310185E-1
397+0.299161710E-1, +0.101981563E-1, +0.130571306, +0.187379748, +0.538310185E-1, +0.447976351
398cov(:,:,0) ! reference
399+0.354689419, -0.975931138E-1, -0.285539217E-1, -0.670704097E-1, +0.429381663E-2, +0.299162138E-1
400-0.975931138E-1, +0.312756985, -0.816770196E-1, +0.571971685E-1, +0.441813916E-1, +0.101981377E-1
401-0.285539217E-1, -0.816770196E-1, +0.328124523, +0.627024174E-1, +0.796045642E-2, +0.130571365
402-0.670704097E-1, +0.571971685E-1, +0.627024174E-1, +0.206821367, +0.120139811E-1, +0.187379763
403+0.429381663E-2, +0.441813916E-1, +0.796045642E-2, +0.120139811E-1, +0.189140394, +0.538310520E-1
404+0.299162138E-1, +0.101981377E-1, +0.130571365, +0.187379763, +0.538310520E-1, +0.447976440
405
406
407!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
408!Compute the biased merged covariance of a frequency weighted multivariate sample.
409!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
410
411
412dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
413do isam = 2, nsam
414 lb(isam) = ub(isam - 1) + 1
415 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
416end do
417lb
418+1, +8
419ub
420+7, +13
421ndim = getUnifRand(1, minval(ub - lb + 1, 1))
422call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
423call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
424call setResized(covMerged, [ndim, ndim])
425sample = getUnifRand(-1., +1., ndim, ub(nsam))
426sample
427+0.485530615, -0.836108923, -0.333593249, -0.234532356E-2, -0.740219474, +0.662170887, +0.655629277, -0.790938377, +0.758816361, -0.366364121, -0.209202170, -0.579937100, -0.868696332
428iweight = getUnifRand(1, 10, size(sample, dim, IK))
429iweight
430+10, +10, +9, +7, +2, +6, +1, +3, +7, +3, +1, +8, +4
431cov(:,:,0) = getCov(sample, 2_IK, iweight)
432cov(:,:,0) ! reference
433+0.354929030
434do isam = 1, nsam
435 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
436 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
437end do
438covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
439covMerged
440+0.354929000
441covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
442covMerged
443+0.354929000
444cov(:,:,0) ! reference
445+0.354929030
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, +4
455ub
456+3, +8
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.992897749, +0.234078407, +0.137307882, +0.583486557, +0.274462819, +0.993723869E-1, -0.680791378, -0.727854848
464iweight = getUnifRand(1, 10, size(sample, dim, IK))
465iweight
466+5, +4, +8, +7, +3, +3, +2, +8
467cov(:,:,0) = getCov(sample, 2_IK, iweight)
468cov(:,:,0) ! reference
469+0.311824411
470do isam = 1, nsam
471 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
472 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
473end do
474covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
475covMerged
476+0.311824292
477covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
478covMerged
479+0.311824292
480cov(:,:,0) ! reference
481+0.311824411
482
483
484dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
485do isam = 2, nsam
486 lb(isam) = ub(isam - 1) + 1
487 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
488end do
489lb
490+1, +8
491ub
492+7, +11
493ndim = getUnifRand(1, minval(ub - lb + 1, 1))
494call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
495call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
496call setResized(covMerged, [ndim, ndim])
497sample = getUnifRand(-1., +1., ndim, ub(nsam))
498sample
499-0.594367385, +0.846748948, +0.544234276, +0.267605424, +0.414498687, -0.829780102E-1, -0.811914563, +0.222028971, -0.395002365E-1, -0.436278939, +0.624799490
500-0.546035767, -0.196465611, -0.999711871, -0.945975184, -0.560674667E-1, +0.373754740, +0.210128665, +0.753638268, -0.418094516, +0.520012856, -0.750653386
501+0.932031631, +0.955694199, -0.225677371, +0.619679093, -0.640587807, -0.905031443, -0.637217879, -0.829972267, -0.385119200, +0.924493074E-1, +0.445107222
502+0.866494179E-1, +0.161151409, -0.377987146, -0.471991539, -0.323296785E-1, -0.815775990, -0.223456025, -0.182708621, +0.962467194E-1, +0.816870570, +0.257756591
503iweight = getUnifRand(1, 10, size(sample, dim, IK))
504iweight
505+10, +7, +1, +3, +5, +5, +3, +7, +4, +10, +2
506cov(:,:,0) = getCov(sample, 2_IK, iweight)
507cov(:,:,0) ! reference
508+0.262199908, -0.350623205E-1, +0.129448739E-2, -0.492407903E-1
509-0.350623205E-1, +0.285354614, -0.240736276, +0.379753374E-1
510+0.129448739E-2, -0.240736276, +0.516466916, +0.124215543
511-0.492407903E-1, +0.379753374E-1, +0.124215543, +0.201061592
512do isam = 1, nsam
513 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
514 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
515end do
516covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
517covMerged
518+0.262199998, -0.350622907E-1, +0.129437260E-2, -0.492407903E-1
519-0.350622907E-1, +0.285354614, -0.240736306, +0.379753485E-1
520+0.129437260E-2, -0.240736306, +0.516466916, +0.124215551
521-0.492407903E-1, +0.379753485E-1, +0.124215551, +0.201061547
522covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
523covMerged
524+0.262199998, -0.350622907E-1, +0.129437260E-2, -0.492407903E-1
525-0.350622907E-1, +0.285354614, -0.240736306, +0.379753485E-1
526+0.129437260E-2, -0.240736306, +0.516466916, +0.124215551
527-0.492407903E-1, +0.379753485E-1, +0.124215551, +0.201061547
528cov(:,:,0) ! reference
529+0.262199908, -0.350623205E-1, +0.129448739E-2, -0.492407903E-1
530-0.350623205E-1, +0.285354614, -0.240736276, +0.379753374E-1
531+0.129448739E-2, -0.240736276, +0.516466916, +0.124215543
532-0.492407903E-1, +0.379753374E-1, +0.124215543, +0.201061592
533
534
535dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
536do isam = 2, nsam
537 lb(isam) = ub(isam - 1) + 1
538 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
539end do
540lb
541+1, +4
542ub
543+3, +6
544ndim = getUnifRand(1, minval(ub - lb + 1, 1))
545call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
546call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
547call setResized(covMerged, [ndim, ndim])
548sample = getUnifRand(-1., +1., ndim, ub(nsam))
549sample
550-0.727234125, +0.759930968, +0.624172926, -0.800369740, +0.779593229, +0.550853491
551+0.170731544E-1, -0.882091999, -0.426503062, +0.675342917, -0.826540351, -0.325265408
552-0.471806288, +0.729540825, -0.301244855, -0.575915217, -0.459464550, -0.969387531
553iweight = getUnifRand(1, 10, size(sample, dim, IK))
554iweight
555+5, +1, +1, +2, +10, +10
556cov(:,:,0) = getCov(sample, 2_IK, iweight)
557cov(:,:,0) ! reference
558+0.376696080, -0.227677211, -0.884331483E-2
559-0.227677211, +0.182389528, -0.415675491E-1
560-0.884331483E-2, -0.415675491E-1, +0.120765738
561do isam = 1, nsam
562 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
563 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
564end do
565covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
566covMerged
567+0.376696050, -0.227677271, -0.884332508E-2
568-0.227677271, +0.182389468, -0.415675566E-1
569-0.884332508E-2, -0.415675566E-1, +0.120765761
570covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
571covMerged
572+0.376696050, -0.227677271, -0.884332508E-2
573-0.227677271, +0.182389468, -0.415675566E-1
574-0.884332508E-2, -0.415675566E-1, +0.120765761
575cov(:,:,0) ! reference
576+0.376696080, -0.227677211, -0.884331483E-2
577-0.227677211, +0.182389528, -0.415675491E-1
578-0.884331483E-2, -0.415675491E-1, +0.120765738
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, +6
588ub
589+5, +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.345789909, -0.880195856, +0.222712159, +0.893422365E-1, -0.182767510, -0.607509732, +0.124463797, +0.170520902, +0.710230589, +0.790119886, -0.835779548
597iweight = getUnifRand(1, 10, size(sample, dim, IK))
598iweight
599+9, +6, +4, +9, +2, +10, +10, +1, +5, +2, +2
600cov(:,:,0) = getCov(sample, 2_IK, iweight)
601cov(:,:,0) ! reference
602+0.250579238
603do isam = 1, nsam
604 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
605 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
606end do
607covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
608covMerged
609+0.250579149
610covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
611covMerged
612+0.250579149
613cov(:,:,0) ! reference
614+0.250579238
615
616
617dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
618do isam = 2, nsam
619 lb(isam) = ub(isam - 1) + 1
620 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
621end do
622lb
623+1, +3
624ub
625+2, +5
626ndim = getUnifRand(1, minval(ub - lb + 1, 1))
627call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
628call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
629call setResized(covMerged, [ndim, ndim])
630sample = getUnifRand(-1., +1., ndim, ub(nsam))
631sample
632-0.727934837E-1, -0.139677525E-1, +0.369589567, +0.930323839, -0.842398167
633iweight = getUnifRand(1, 10, size(sample, dim, IK))
634iweight
635+3, +1, +8, +10, +3
636cov(:,:,0) = getCov(sample, 2_IK, iweight)
637cov(:,:,0) ! reference
638+0.331299126
639do isam = 1, nsam
640 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
641 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
642end do
643covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
644covMerged
645+0.331299126
646covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
647covMerged
648+0.331299126
649cov(:,:,0) ! reference
650+0.331299126
651
652
653dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
654do isam = 2, nsam
655 lb(isam) = ub(isam - 1) + 1
656 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
657end do
658lb
659+1, +7
660ub
661+6, +12
662ndim = getUnifRand(1, minval(ub - lb + 1, 1))
663call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
664call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
665call setResized(covMerged, [ndim, ndim])
666sample = getUnifRand(-1., +1., ndim, ub(nsam))
667sample
668-0.566879272, -0.840666890, +0.196399331, +0.854647636, +0.178807259, -0.604836106, +0.266598344, +0.814395547, +0.913155079, -0.923775196, +0.616974354, -0.276423216
669+0.376751184, +0.495039821, +0.643194556, +0.669702768, -0.361947894, -0.300359368, -0.855350494E-1, +0.527261496E-1, +0.380760550, -0.451204062, -0.422867775, +0.758551598
670+0.754365325, +0.643553734, -0.935808301, -0.584621549, +0.705856442, -0.809113622, +0.536543250, -0.852715969, +0.687514424, +0.691726565, +0.806361437E-1, -0.239752650
671-0.628793478, +0.140112281, +0.214942694, +0.968291759, +0.159548044, +0.755764604, +0.419800997, -0.934744835, +0.391976833E-1, +0.147850156, +0.537798762, -0.683847666E-1
672-0.667899847E-1, -0.662176490, -0.632045150, -0.393239737, +0.761238337E-1, +0.170501709, +0.465320349E-1, +0.895204544E-1, -0.437189698, +0.793820620, +0.250972986, +0.456062675
673iweight = getUnifRand(1, 10, size(sample, dim, IK))
674iweight
675+10, +8, +9, +7, +3, +8, +7, +3, +2, +9, +2, +1
676cov(:,:,0) = getCov(sample, 2_IK, iweight)
677cov(:,:,0) ! reference
678+0.413402289, +0.902379751E-1, -0.205867246, +0.740270242E-1, -0.102413885
679+0.902379751E-1, +0.184840187, -0.767779499E-1, -0.215646364E-1, -0.166919276
680-0.205867246, -0.767779499E-1, +0.510577798, -0.146876290, +0.959907100E-1
681+0.740270242E-1, -0.215646364E-1, -0.146876290, +0.261810243, -0.157029387E-1
682-0.102413885, -0.166919276, +0.959907100E-1, -0.157029387E-1, +0.210809439
683do isam = 1, nsam
684 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
685 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
686end do
687covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
688covMerged
689+0.413402170, +0.902379602E-1, -0.205867246, +0.740269721E-1, -0.102413855
690+0.902379602E-1, +0.184840187, -0.767779648E-1, -0.215646420E-1, -0.166919261
691-0.205867246, -0.767779648E-1, +0.510577798, -0.146876231, +0.959907174E-1
692+0.740269721E-1, -0.215646420E-1, -0.146876231, +0.261810184, -0.157029182E-1
693-0.102413855, -0.166919261, +0.959907174E-1, -0.157029182E-1, +0.210809454
694covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
695covMerged
696+0.413402170, +0.902379602E-1, -0.205867246, +0.740269721E-1, -0.102413855
697+0.902379602E-1, +0.184840187, -0.767779648E-1, -0.215646420E-1, -0.166919261
698-0.205867246, -0.767779648E-1, +0.510577798, -0.146876231, +0.959907174E-1
699+0.740269721E-1, -0.215646420E-1, -0.146876231, +0.261810184, -0.157029182E-1
700-0.102413855, -0.166919261, +0.959907174E-1, -0.157029182E-1, +0.210809454
701cov(:,:,0) ! reference
702+0.413402289, +0.902379751E-1, -0.205867246, +0.740270242E-1, -0.102413885
703+0.902379751E-1, +0.184840187, -0.767779499E-1, -0.215646364E-1, -0.166919276
704-0.205867246, -0.767779499E-1, +0.510577798, -0.146876290, +0.959907100E-1
705+0.740270242E-1, -0.215646364E-1, -0.146876290, +0.261810243, -0.157029387E-1
706-0.102413885, -0.166919276, +0.959907100E-1, -0.157029387E-1, +0.210809439
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, +4
716ub
717+3, +8
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.325459242, +0.557563782, +0.479745626, +0.484445930, -0.854597688, +0.674734116, -0.325369120, -0.180127621E-1
725-0.285283923, -0.247466207, +0.825519800, -0.369039893, +0.757085919, +0.843588114, +0.529208302, -0.247227430
726+0.610408545, -0.481162071, +0.736664534, +0.540201783, -0.675921440E-1, +0.909105420, -0.159729958, +0.486132264
727iweight = getUnifRand(1, 10, size(sample, dim, IK))
728iweight
729+1, +5, +10, +1, +5, +10, +4, +8
730cov(:,:,0) = getCov(sample, 2_IK, iweight)
731cov(:,:,0) ! reference
732+0.245648414, +0.180094354E-1, +0.121226512
733+0.180094354E-1, +0.249143690, +0.107005589
734+0.121226512, +0.107005589, +0.228891104
735do isam = 1, nsam
736 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
737 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
738end do
739covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
740covMerged
741+0.245648369, +0.180094596E-1, +0.121226497
742+0.180094596E-1, +0.249143675, +0.107005581
743+0.121226497, +0.107005581, +0.228891090
744covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
745covMerged
746+0.245648369, +0.180094596E-1, +0.121226497
747+0.180094596E-1, +0.249143675, +0.107005581
748+0.121226497, +0.107005581, +0.228891090
749cov(:,:,0) ! reference
750+0.245648414, +0.180094354E-1, +0.121226512
751+0.180094354E-1, +0.249143690, +0.107005589
752+0.121226512, +0.107005589, +0.228891104
753
754
755dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
756do isam = 2, nsam
757 lb(isam) = ub(isam - 1) + 1
758 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
759end do
760lb
761+1, +3
762ub
763+2, +8
764ndim = getUnifRand(1, minval(ub - lb + 1, 1))
765call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
766call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
767call setResized(covMerged, [ndim, ndim])
768sample = getUnifRand(-1., +1., ndim, ub(nsam))
769sample
770-0.764661193, +0.443174481, -0.610464811, +0.860621810, +0.818337679, -0.993729591, +0.912547708, -0.453503609
771iweight = getUnifRand(1, 10, size(sample, dim, IK))
772iweight
773+8, +5, +1, +1, +4, +5, +4, +9
774cov(:,:,0) = getCov(sample, 2_IK, iweight)
775cov(:,:,0) ! reference
776+0.504564762
777do isam = 1, nsam
778 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
779 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
780end do
781covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
782covMerged
783+0.504564822
784covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
785covMerged
786+0.504564822
787cov(:,:,0) ! reference
788+0.504564762
789
790
791dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
792do isam = 2, nsam
793 lb(isam) = ub(isam - 1) + 1
794 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
795end do
796lb
797+1, +4
798ub
799+3, +10
800ndim = getUnifRand(1, minval(ub - lb + 1, 1))
801call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
802call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
803call setResized(covMerged, [ndim, ndim])
804sample = getUnifRand(-1., +1., ndim, ub(nsam))
805sample
806-0.922209740, -0.864210129, +0.168142557, -0.372069240, -0.951295853, +0.673761725, -0.372545123, +0.487072825, +0.125424504, -0.724686623
807iweight = getUnifRand(1, 10, size(sample, dim, IK))
808iweight
809+6, +6, +1, +3, +2, +4, +9, +2, +6, +5
810cov(:,:,0) = getCov(sample, 2_IK, iweight)
811cov(:,:,0) ! reference
812+0.277013302
813do isam = 1, nsam
814 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
815 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, iweight(lb(isam):ub(isam)))
816end do
817covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
818covMerged
819+0.277013361
820covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(iweight(:ub(1))), TKG) / real(sum(iweight), TKG))
821covMerged
822+0.277013361
823cov(:,:,0) ! reference
824+0.277013302
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, +5
839ub
840+4, +10
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.664399743, +0.793645859, -0.299189448, +0.257013321, -0.484828949E-1, -0.529766917, -0.500200748, -0.238822937, +0.100814104E-1, -0.288721681
848+0.349694490, +0.884613395, -0.465876818, +0.568436503, -0.473667026, +0.795489550, -0.514368653, -0.534054160, +0.566586971, +0.144920230
849+0.101297379, +0.252091765, -0.892170668E-1, +0.487662673, +0.292716265, -0.969355226, +0.354323745, -0.452345610, +0.578903198, -0.288142681
850rweight = getUnifRand(1., 2., size(sample, dim, IK))
851rweight
852+1.36497819, +1.78765559, +1.52774620, +1.83343601, +1.44286644, +1.04737508, +1.79912138, +1.75001931, +1.84365964, +1.06099725
853cov(:,:,0) = getCov(sample, 2_IK, rweight)
854cov(:,:,0) ! reference
855+0.189001337, +0.147736907, +0.774411112E-1
856+0.147736907, +0.312956363, +0.324119069E-1
857+0.774411112E-1, +0.324119069E-1, +0.184606656
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.189001352, +0.147736922, +0.774411038E-1
865+0.147736922, +0.312956333, +0.324119143E-1
866+0.774411038E-1, +0.324119143E-1, +0.184606671
867covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
868covMerged
869+0.189001352, +0.147736922, +0.774411038E-1
870+0.147736922, +0.312956333, +0.324119143E-1
871+0.774411038E-1, +0.324119143E-1, +0.184606671
872cov(:,:,0) ! reference
873+0.189001337, +0.147736907, +0.774411112E-1
874+0.147736907, +0.312956363, +0.324119069E-1
875+0.774411112E-1, +0.324119069E-1, +0.184606656
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, +4
885ub
886+3, +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.964403868, +0.811382532, +0.732514977, -0.109727025, +0.194648266, -0.317300320
894+0.432123542, -0.476015091, -0.336025357, +0.515875340, -0.509981275, -0.533400536
895rweight = getUnifRand(1., 2., size(sample, dim, IK))
896rweight
897+1.07448173, +1.42792702, +1.00339568, +1.83776891, +1.10136676, +1.57132030
898cov(:,:,0) = getCov(sample, 2_IK, rweight)
899cov(:,:,0) ! reference
900+0.334650844, -0.143101335
901-0.143101335, +0.216341659
902do isam = 1, nsam
903 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
904 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
905end do
906covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
907covMerged
908+0.334651113, -0.143101379
909-0.143101379, +0.216341689
910covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
911covMerged
912+0.334651113, -0.143101379
913-0.143101379, +0.216341689
914cov(:,:,0) ! reference
915+0.334650844, -0.143101335
916-0.143101335, +0.216341659
917
918
919dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
920do isam = 2, nsam
921 lb(isam) = ub(isam - 1) + 1
922 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
923end do
924lb
925+1, +5
926ub
927+4, +7
928ndim = getUnifRand(1, minval(ub - lb + 1, 1))
929call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
930call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
931call setResized(covMerged, [ndim, ndim])
932sample = getUnifRand(-1., +1., ndim, ub(nsam))
933sample
934+0.794116735, -0.773250222, -0.827755213, -0.767177820, -0.863015532, +0.221502304, +0.902598023
935rweight = getUnifRand(1., 2., size(sample, dim, IK))
936rweight
937+1.97484660, +1.46972895, +1.85090685, +1.41693151, +1.17853618, +1.93924868, +1.57271433
938cov(:,:,0) = getCov(sample, 2_IK, rweight)
939cov(:,:,0) ! reference
940+0.554190755
941do isam = 1, nsam
942 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
943 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
944end do
945covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
946covMerged
947+0.554190755
948covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
949covMerged
950+0.554190755
951cov(:,:,0) ! reference
952+0.554190755
953
954
955dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
956do isam = 2, nsam
957 lb(isam) = ub(isam - 1) + 1
958 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
959end do
960lb
961+1, +8
962ub
963+7, +14
964ndim = getUnifRand(1, minval(ub - lb + 1, 1))
965call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
966call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
967call setResized(covMerged, [ndim, ndim])
968sample = getUnifRand(-1., +1., ndim, ub(nsam))
969sample
970+0.492414594, +0.401903272, +0.295918703, -0.439376593, -0.894213319, +0.827624679, -0.717493653, -0.100875139, +0.469563484, -0.659060836, +0.134400606, +0.627169371, -0.964275956, +0.311541796
971+0.658070683, -0.741124511, -0.390968442, +0.887038589, +0.882375002, +0.587566495, +0.915843010, +0.887546301, +0.392227769, +0.632854700, -0.501803041, -0.728688121, +0.143267989, +0.370819569
972-0.961943865, -0.406564236, -0.564285159, +0.522020102, -0.170520306, +0.576290965, -0.338193178, +0.588348746, +0.677360415, -0.864385962, +0.676315069, -0.536039114, -0.798686743, -0.286054611E-2
973+0.588020682, -0.460215211, -0.108306050, +0.945406079, +0.548144698, -0.178898692, -0.865051746E-1, -0.312401056, +0.115181088, +0.433438778, -0.247461796, +0.779411793, +0.759148598E-1, -0.740001202
974-0.534878731, -0.413912058, +0.607234001, -0.815426946, -0.162027121, +0.857482553, -0.448668003E-2, +0.346284866, +0.781533241, -0.365505815, +0.386111259, -0.162540436, -0.815439224E-1, +0.248442769
975+0.464222193, -0.809666038, -0.410230160, +0.270185351, -0.879440069, -0.561437607E-1, +0.913323402, -0.993308067, -0.534876466, +0.438599825, +0.672818422, -0.573700905, +0.344465971E-1, -0.544989109E-1
976-0.739632130, -0.996512771, +0.717235327, -0.492026091, -0.854772329, +0.344501376, -0.189905167E-1, -0.201128721E-1, -0.776847601E-1, +0.679214120, -0.798837423, +0.435686111E-2, -0.556337953, -0.314619064
977rweight = getUnifRand(1., 2., size(sample, dim, IK))
978rweight
979+1.63326550, +1.43529582, +1.55850649, +1.47218037, +1.80499268, +1.19364524, +1.87234890, +1.44652724, +1.38575780, +1.91275656, +1.54904389, +1.90180409, +1.46985674, +1.51642060
980cov(:,:,0) = getCov(sample, 2_IK, rweight)
981cov(:,:,0) ! reference
982+0.345889837, -0.184697166, +0.721470490E-1, -0.573454127E-1, +0.104384921, -0.809327736E-1, +0.256565921E-1
983-0.184697166, +0.370576292, +0.503841490E-1, +0.508381389E-1, -0.398700945E-1, +0.848712176E-1, +0.216475893E-1
984+0.721470490E-1, +0.503841490E-1, +0.338747472, -0.742214844E-1, +0.132267877, -0.531899743E-1, -0.412747264E-1
985-0.573454127E-1, +0.508381389E-1, -0.742214844E-1, +0.228461415, -0.130270362, +0.159936026E-1, -0.702198478E-3
986+0.104384921, -0.398700945E-1, +0.132267877, -0.130270362, +0.218637988, -0.557172149E-1, +0.949465260E-1
987-0.809327736E-1, +0.848712176E-1, -0.531899743E-1, +0.159936026E-1, -0.557172149E-1, +0.359643787, +0.283492561E-1
988+0.256565921E-1, +0.216475893E-1, -0.412747264E-1, -0.702198478E-3, +0.949465260E-1, +0.283492561E-1, +0.288652599
989do isam = 1, nsam
990 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
991 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
992end do
993covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
994covMerged
995+0.345889896, -0.184697106, +0.721469298E-1, -0.573453903E-1, +0.104384892, -0.809327438E-1, +0.256565865E-1
996-0.184697106, +0.370576233, +0.503840744E-1, +0.508381315E-1, -0.398700982E-1, +0.848712921E-1, +0.216475725E-1
997+0.721469298E-1, +0.503840744E-1, +0.338747650, -0.742214993E-1, +0.132267952, -0.531899147E-1, -0.412746407E-1
998-0.573453903E-1, +0.508381315E-1, -0.742214993E-1, +0.228461370, -0.130270332, +0.159935877E-1, -0.702199526E-3
999+0.104384892, -0.398700982E-1, +0.132267952, -0.130270332, +0.218638003, -0.557171926E-1, +0.949465334E-1
1000-0.809327438E-1, +0.848712921E-1, -0.531899147E-1, +0.159935877E-1, -0.557171926E-1, +0.359643728, +0.283492059E-1
1001+0.256565865E-1, +0.216475725E-1, -0.412746407E-1, -0.702199526E-3, +0.949465334E-1, +0.283492059E-1, +0.288652599
1002covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1003covMerged
1004+0.345889896, -0.184697106, +0.721469298E-1, -0.573453903E-1, +0.104384892, -0.809327438E-1, +0.256565865E-1
1005-0.184697106, +0.370576233, +0.503840744E-1, +0.508381315E-1, -0.398700982E-1, +0.848712921E-1, +0.216475725E-1
1006+0.721469298E-1, +0.503840744E-1, +0.338747650, -0.742214993E-1, +0.132267952, -0.531899147E-1, -0.412746407E-1
1007-0.573453903E-1, +0.508381315E-1, -0.742214993E-1, +0.228461370, -0.130270332, +0.159935877E-1, -0.702199526E-3
1008+0.104384892, -0.398700982E-1, +0.132267952, -0.130270332, +0.218638003, -0.557171926E-1, +0.949465334E-1
1009-0.809327438E-1, +0.848712921E-1, -0.531899147E-1, +0.159935877E-1, -0.557171926E-1, +0.359643728, +0.283492059E-1
1010+0.256565865E-1, +0.216475725E-1, -0.412746407E-1, -0.702199526E-3, +0.949465334E-1, +0.283492059E-1, +0.288652599
1011cov(:,:,0) ! reference
1012+0.345889837, -0.184697166, +0.721470490E-1, -0.573454127E-1, +0.104384921, -0.809327736E-1, +0.256565921E-1
1013-0.184697166, +0.370576292, +0.503841490E-1, +0.508381389E-1, -0.398700945E-1, +0.848712176E-1, +0.216475893E-1
1014+0.721470490E-1, +0.503841490E-1, +0.338747472, -0.742214844E-1, +0.132267877, -0.531899743E-1, -0.412747264E-1
1015-0.573454127E-1, +0.508381389E-1, -0.742214844E-1, +0.228461415, -0.130270362, +0.159936026E-1, -0.702198478E-3
1016+0.104384921, -0.398700945E-1, +0.132267877, -0.130270362, +0.218637988, -0.557172149E-1, +0.949465260E-1
1017-0.809327736E-1, +0.848712176E-1, -0.531899743E-1, +0.159936026E-1, -0.557172149E-1, +0.359643787, +0.283492561E-1
1018+0.256565921E-1, +0.216475893E-1, -0.412747264E-1, -0.702198478E-3, +0.949465260E-1, +0.283492561E-1, +0.288652599
1019
1020
1021dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1022do isam = 2, nsam
1023 lb(isam) = ub(isam - 1) + 1
1024 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1025end do
1026lb
1027+1, +7
1028ub
1029+6, +11
1030ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1031call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
1032call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
1033call setResized(covMerged, [ndim, ndim])
1034sample = getUnifRand(-1., +1., ndim, ub(nsam))
1035sample
1036-0.271334052, -0.770991564, -0.600334644, -0.498256326, +0.529149652, -0.914956093, +0.581290364, +0.256696343, -0.695100427, -0.106347680, +0.988508701
1037+0.613719344, -0.391871691, -0.963513851, -0.287151814, -0.621394634, +0.621295333, -0.683635831, +0.267583251, +0.759294629, +0.129406333, -0.585303426
1038+0.298762202, -0.417472959, -0.238876820, -0.389590502, -0.430854082, +0.836771369, -0.198570490E-1, +0.234525919, +0.563509226, +0.452273369, -0.414700031
1039-0.947352648E-1, -0.233281732, -0.953933239, -0.994526744, -0.696037889, -0.186096072, -0.114507675E-1, -0.414655685, +0.446369767, -0.268045545, -0.202656627
1040-0.533147454, -0.550976396, -0.763686419, +0.577699900, -0.892520189, -0.157009602, -0.500318408, -0.460268617, -0.492617130, +0.171365619, -0.303243995
1041rweight = getUnifRand(1., 2., size(sample, dim, IK))
1042rweight
1043+1.00459790, +1.10573971, +1.28931761, +1.01075268, +1.95879793, +1.30139971, +1.57557487, +1.16690135, +1.32113791, +1.30735469, +1.33329833
1044cov(:,:,0) = getCov(sample, 2_IK, rweight)
1045cov(:,:,0) ! reference
1046+0.387391537, -0.175275847, -0.127419636, -0.115334149E-1, -0.567195788E-1
1047-0.175275847, +0.336110741, +0.215395749, +0.136062771, +0.681004450E-1
1048-0.127419636, +0.215395749, +0.191565126, +0.101289637, +0.442685038E-1
1049-0.115334149E-1, +0.136062771, +0.101289637, +0.159638777, -0.625401875E-2
1050-0.567195788E-1, +0.681004450E-1, +0.442685038E-1, -0.625401875E-2, +0.153169811
1051do isam = 1, nsam
1052 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1053 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1054end do
1055covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1056covMerged
1057+0.387391508, -0.175275877, -0.127419651, -0.115334019E-1, -0.567195863E-1
1058-0.175275877, +0.336110741, +0.215395719, +0.136062786, +0.681004599E-1
1059-0.127419651, +0.215395719, +0.191565141, +0.101289630, +0.442685112E-1
1060-0.115334019E-1, +0.136062786, +0.101289630, +0.159638792, -0.625401922E-2
1061-0.567195863E-1, +0.681004599E-1, +0.442685112E-1, -0.625401922E-2, +0.153169841
1062covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1063covMerged
1064+0.387391508, -0.175275877, -0.127419651, -0.115334019E-1, -0.567195863E-1
1065-0.175275877, +0.336110741, +0.215395719, +0.136062786, +0.681004599E-1
1066-0.127419651, +0.215395719, +0.191565141, +0.101289630, +0.442685112E-1
1067-0.115334019E-1, +0.136062786, +0.101289630, +0.159638792, -0.625401922E-2
1068-0.567195863E-1, +0.681004599E-1, +0.442685112E-1, -0.625401922E-2, +0.153169841
1069cov(:,:,0) ! reference
1070+0.387391537, -0.175275847, -0.127419636, -0.115334149E-1, -0.567195788E-1
1071-0.175275847, +0.336110741, +0.215395749, +0.136062771, +0.681004450E-1
1072-0.127419636, +0.215395749, +0.191565126, +0.101289637, +0.442685038E-1
1073-0.115334149E-1, +0.136062771, +0.101289637, +0.159638777, -0.625401875E-2
1074-0.567195788E-1, +0.681004450E-1, +0.442685038E-1, -0.625401875E-2, +0.153169811
1075
1076
1077dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1078do isam = 2, nsam
1079 lb(isam) = ub(isam - 1) + 1
1080 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1081end do
1082lb
1083+1, +3
1084ub
1085+2, +5
1086ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1087call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
1088call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
1089call setResized(covMerged, [ndim, ndim])
1090sample = getUnifRand(-1., +1., ndim, ub(nsam))
1091sample
1092+0.699290514, -0.213555694, +0.927346706, -0.814628601E-1, +0.626744986
1093-0.395019054E-1, -0.865532994, +0.327257037, +0.688591361, +0.218280435
1094rweight = getUnifRand(1., 2., size(sample, dim, IK))
1095rweight
1096+1.89483666, +1.70991445, +1.32137537, +1.82364678, +1.64557540
1097cov(:,:,0) = getCov(sample, 2_IK, rweight)
1098cov(:,:,0) ! reference
1099+0.199897483, +0.723689348E-1
1100+0.723689348E-1, +0.278684855
1101do isam = 1, nsam
1102 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1103 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1104end do
1105covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1106covMerged
1107+0.199897468, +0.723689497E-1
1108+0.723689497E-1, +0.278684855
1109covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1110covMerged
1111+0.199897468, +0.723689497E-1
1112+0.723689497E-1, +0.278684855
1113cov(:,:,0) ! reference
1114+0.199897483, +0.723689348E-1
1115+0.723689348E-1, +0.278684855
1116
1117
1118dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1119do isam = 2, nsam
1120 lb(isam) = ub(isam - 1) + 1
1121 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1122end do
1123lb
1124+1, +6
1125ub
1126+5, +11
1127ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1128call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
1129call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
1130call setResized(covMerged, [ndim, ndim])
1131sample = getUnifRand(-1., +1., ndim, ub(nsam))
1132sample
1133+0.988690734, +0.974773049, -0.188033342, +0.516591311, -0.238816977, +0.856635094, +0.389124870, -0.354428887, -0.994930863, -0.811917901, -0.812552571
1134rweight = getUnifRand(1., 2., size(sample, dim, IK))
1135rweight
1136+1.46026278, +1.47322536, +1.72318816, +1.50498104, +1.13804269, +1.54268622, +1.58662772, +1.90531921, +1.59848571, +1.16734314, +1.09414673
1137cov(:,:,0) = getCov(sample, 2_IK, rweight)
1138cov(:,:,0) ! reference
1139+0.493434548
1140do isam = 1, nsam
1141 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1142 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1143end do
1144covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1145covMerged
1146+0.493434608
1147covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1148covMerged
1149+0.493434608
1150cov(:,:,0) ! reference
1151+0.493434548
1152
1153
1154dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1155do isam = 2, nsam
1156 lb(isam) = ub(isam - 1) + 1
1157 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1158end do
1159lb
1160+1, +4
1161ub
1162+3, +5
1163ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1164call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
1165call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
1166call setResized(covMerged, [ndim, ndim])
1167sample = getUnifRand(-1., +1., ndim, ub(nsam))
1168sample
1169-0.994890928E-1, +0.991824150, +0.489787817, +0.808136463E-1, -0.693702936
1170-0.475593448, -0.280267358, +0.923428774, -0.592214108, -0.675466061
1171rweight = getUnifRand(1., 2., size(sample, dim, IK))
1172rweight
1173+1.23865497, +1.31993866, +1.73222053, +1.55056810, +1.70762253
1174cov(:,:,0) = getCov(sample, 2_IK, rweight)
1175cov(:,:,0) ! reference
1176+0.322185874, +0.183592960
1177+0.183592960, +0.385819197
1178do isam = 1, nsam
1179 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1180 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1181end do
1182covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1183covMerged
1184+0.322185814, +0.183592945
1185+0.183592945, +0.385819167
1186covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1187covMerged
1188+0.322185814, +0.183592945
1189+0.183592945, +0.385819167
1190cov(:,:,0) ! reference
1191+0.322185874, +0.183592960
1192+0.183592960, +0.385819197
1193
1194
1195dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1196do isam = 2, nsam
1197 lb(isam) = ub(isam - 1) + 1
1198 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1199end do
1200lb
1201+1, +6
1202ub
1203+5, +9
1204ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1205call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
1206call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
1207call setResized(covMerged, [ndim, ndim])
1208sample = getUnifRand(-1., +1., ndim, ub(nsam))
1209sample
1210+0.448428273, -0.563997149, +0.350064039, +0.287453055, -0.262377858, +0.392762065, +0.950666904, -0.683437347, -0.664391756
1211rweight = getUnifRand(1., 2., size(sample, dim, IK))
1212rweight
1213+1.13729370, +1.68950868, +1.45996618, +1.09001088, +1.85419977, +1.28637052, +1.81915700, +1.60087729, +1.40098190
1214cov(:,:,0) = getCov(sample, 2_IK, rweight)
1215cov(:,:,0) ! reference
1216+0.327672571
1217do isam = 1, nsam
1218 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1219 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1220end do
1221covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1222covMerged
1223+0.327672541
1224covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1225covMerged
1226+0.327672541
1227cov(:,:,0) ! reference
1228+0.327672571
1229
1230
1231dim = 2; lb(1) = 1; ub(1) = getUnifRand(2, 7)
1232do isam = 2, nsam
1233 lb(isam) = ub(isam - 1) + 1
1234 ub(isam) = ub(isam - 1) + getUnifRand(2, 7)
1235end do
1236lb
1237+1, +6
1238ub
1239+5, +10
1240ndim = getUnifRand(1, minval(ub - lb + 1, 1))
1241call setRebound(cov, [1_IK, 1_IK, 0_IK], [ndim, ndim, nsam])
1242call setRebound(mean, [1_IK, 1_IK], [ndim, nsam])
1243call setResized(covMerged, [ndim, ndim])
1244sample = getUnifRand(-1., +1., ndim, ub(nsam))
1245sample
1246+0.593420863, +0.571805477, -0.130877614, +0.721005797, -0.104359508, +0.199754596, -0.980913877, +0.138333917, +0.813546538, +0.878706455
1247rweight = getUnifRand(1., 2., size(sample, dim, IK))
1248rweight
1249+1.91502357, +1.40808034, +1.17569327, +1.08157265, +1.76660848, +1.13385355, +1.32060432, +1.90727067, +1.87738228, +1.97201419
1250cov(:,:,0) = getCov(sample, 2_IK, rweight)
1251cov(:,:,0) ! reference
1252+0.279559821
1253do isam = 1, nsam
1254 cov(:,:,isam) = getCov(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1255 mean(:,isam) = getMean(sample(:,lb(isam):ub(isam)), 2_IK, rweight(lb(isam):ub(isam)))
1256end do
1257covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1258covMerged
1259+0.279559761
1260covMerged = getCovMerged(cov(:,:,2), cov(:,:,1), mean(:,1) - mean(:,2), real(sum(rweight(:ub(1))), TKG) / real(sum(rweight), TKG))
1261covMerged
1262+0.279559761
1263cov(:,:,0) ! reference
1264+0.279559821
1265
1266
Test:
test_pm_sampleCov


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Amir Shahmoradi, April 21, 2017, 1:54 AM, Institute for Computational Engineering and Sciences (ICES), The University of Texas Austin

Definition at line 6975 of file pm_sampleCov.F90.


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