24 type(display_type) :: disp
25 integer(IK) :: itry, ntry
= 10
26 character(:),
allocatable :: format
27 real(RK),
allocatable :: rweight(:), rho(:,:), frank(:,:), frankt(:,:)
31 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
32 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
33 call disp%show(
"!Compute the Spearman correlation matrix for a pair of time series.")
34 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
35 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
40 integer(IK) :: ndim, nsam
41 real(RKG),
allocatable :: sample(:,:)
42 format = getFormat(mold
= [
0._RKG], ed
= SK_
"es", signed
= .true._LK)
43 call disp%show(
"ndim = 2; nsam = 10")
45 call disp%show(
"sample = reshape(getUnifRand(1, 20, ndim * nsam), shape = [ndim, nsam], order = [2, 1])")
46 sample
= reshape(
getUnifRand(
1,
20, ndim
* nsam), shape
= [ndim, nsam], order
= [
2,
1])
48 call disp%show( sample ,
format = format )
49 call disp%show(
"call setResized(frank, shape(sample, IK))")
51 call disp%show(
"call setResized(frankt, getReversed(shape(sample, IK)))")
53 call disp%show(
"rho = getFilled(0., ndim, ndim)")
55 call disp%show(
"call setRho(rho, uppDia, frank, sample, dim = 2_IK)")
56 call setRho(rho, uppDia, frank, sample,
dim = 2_IK)
58 call disp%show( rho ,
format = format )
60 call disp%show(
"rho = getFilled(0., ndim, ndim)")
62 call disp%show(
"call setRho(rho, lowDia, frank, sample, dim = 2_IK)")
63 call setRho(rho, lowDia, frank, sample,
dim = 2_IK)
65 call disp%show( rho ,
format = format )
67 call disp%show( frank ,
format = format )
69 call disp%show(
"Compute the sample correlation along the first dimension.", deliml
= SK_
'''')
71 call disp%show(
"rho = getFilled(0., ndim, ndim)")
73 call disp%show(
"call setRho(rho, uppDia, frankt, transpose(sample), dim = 1_IK)")
74 call setRho(rho, uppDia, frankt,
transpose(sample),
dim = 1_IK)
76 call disp%show( rho ,
format = format )
78 call disp%show( frankt ,
format = format )
80 call disp%show(
"rho = getFilled(0., ndim, ndim)")
82 call disp%show(
"call setRho(rho, lowDia, frankt, transpose(sample), dim = 1_IK)")
83 call setRho(rho, lowDia, frankt,
transpose(sample),
dim = 1_IK)
85 call disp%show( rho ,
format = format )
87 call disp%show( frankt ,
format = format )
89 call disp%show(
"Compute the full sample correlation for a pair of time series.", deliml
= SK_
'''')
91 call disp%show(
"call setRho(rho(1,1), frank(1,:), frank(2,:), sample(1,:), sample(2,:))")
92 call setRho(rho(
1,
1), frank(
1,:), frank(
2,:), sample(
1,:), sample(
2,:))
94 call disp%show( rho(
1,
1) ,
format = format )
96 call disp%show( frank ,
format = format )
101 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
102 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
103 call disp%show(
"!Compute the Spearman correlation matrix for a weighted pair of time series.")
104 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
105 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
111 integer(IK) :: ndim, nsam
112 integer(IK),
allocatable :: iweight(:)
113 real(RKG),
allocatable :: sample(:,:)
114 format = getFormat(mold
= [
0._RKG], ed
= SK_
"es", signed
= .true._LK)
115 call disp%show(
"ndim = 2; nsam = 10")
117 call disp%show(
"sample = reshape(getUnifRand(1, 20, ndim * nsam), shape = [ndim, nsam], order = [2, 1])")
118 sample
= reshape(
getUnifRand(
1,
20, ndim
* nsam), shape
= [ndim, nsam], order
= [
2,
1])
120 call disp%show( sample ,
format = format )
121 call disp%show(
"call setResized(frank, shape(sample, IK))")
123 call disp%show(
"call setResized(frankt, getReversed(shape(sample, IK)))")
125 call disp%show(
"iweight = getUnifRand(1, 10, nsam) ! integer-valued weights.")
129 call disp%show(
"rweight = iweight ! or real-valued weights.")
135 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
136 call disp%show(
"!Compute the correlation matrix with integer weights.")
137 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
140 call disp%show(
"rho = getFilled(0., ndim, ndim)")
142 call disp%show(
"call setRho(rho, uppDia, frank, sample, 2_IK, iweight)")
143 call setRho(rho, uppDia, frank, sample,
2_IK, iweight)
145 call disp%show( rho ,
format = format )
147 call disp%show( frank ,
format = format )
149 call disp%show(
"rho = getFilled(0., ndim, ndim)")
151 call disp%show(
"call setRho(rho, lowDia, frank, sample, 2_IK, iweight)")
152 call setRho(rho, lowDia, frank, sample,
2_IK, iweight)
154 call disp%show( rho ,
format = format )
156 call disp%show( frank ,
format = format )
158 call disp%show(
"Compute the sample correlation along the first dimension.", deliml
= SK_
'''')
160 call disp%show(
"rho = getFilled(0., ndim, ndim)")
162 call disp%show(
"call setRho(rho, uppDia, frankt, transpose(sample), 1_IK, iweight)")
163 call setRho(rho, uppDia, frankt,
transpose(sample),
1_IK, iweight)
165 call disp%show( rho ,
format = format )
167 call disp%show(
"rho = getFilled(0., ndim, ndim)")
169 call disp%show(
"call setRho(rho, lowDia, frankt, transpose(sample), 1_IK, iweight)")
170 call setRho(rho, lowDia, frankt,
transpose(sample),
1_IK, iweight)
172 call disp%show( rho ,
format = format )
174 call disp%show( frankt ,
format = format )
176 call disp%show(
"Compute the full sample correlation for a pair of time series.", deliml
= SK_
'''')
178 call disp%show(
"call setRho(rho(1,1), frank(1,:), frank(2,:), sample(1,:), sample(2,:), iweight)")
179 call setRho(rho(
1,
1), frank(
1,:), frank(
2,:), sample(
1,:), sample(
2,:), iweight)
181 call disp%show( rho(
1,
1) ,
format = format )
183 call disp%show( frank ,
format = format )
187 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
188 call disp%show(
"!Compute the correlation matrix with real weights.")
189 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
192 call disp%show(
"rho = getFilled(0., ndim, ndim)")
194 call disp%show(
"call setRho(rho, uppDia, frank, sample, 2_IK, rweight)")
195 call setRho(rho, uppDia, frank, sample,
2_IK, rweight)
197 call disp%show( rho ,
format = format )
199 call disp%show( frank ,
format = format )
201 call disp%show(
"rho = getFilled(0., ndim, ndim)")
203 call disp%show(
"call setRho(rho, lowDia, frank, sample, 2_IK, rweight)")
204 call setRho(rho, lowDia, frank, sample,
2_IK, rweight)
206 call disp%show( rho ,
format = format )
208 call disp%show( frank ,
format = format )
210 call disp%show(
"Compute the sample correlation along the first dimension.", deliml
= SK_
'''')
212 call disp%show(
"rho = getFilled(0., ndim, ndim)")
214 call disp%show(
"call setRho(rho, uppDia, frankt, transpose(sample), 1_IK, rweight)")
215 call setRho(rho, uppDia, frankt,
transpose(sample),
1_IK, rweight)
217 call disp%show( rho ,
format = format )
219 call disp%show( frankt ,
format = format )
221 call disp%show(
"rho = getFilled(0., ndim, ndim)")
223 call disp%show(
"call setRho(rho, lowDia, frankt, transpose(sample), 1_IK, rweight)")
224 call setRho(rho, lowDia, frankt,
transpose(sample),
1_IK, rweight)
226 call disp%show( rho ,
format = format )
228 call disp%show( frankt ,
format = format )
230 call disp%show(
"Compute the full sample correlation for a pair of time series.", deliml
= SK_
'''')
232 call disp%show(
"call setRho(rho(1,1), frank(1,:), frank(2,:), sample(1,:), sample(2,:), rweight)")
233 call setRho(rho(
1,
1), frank(
1,:), frank(
2,:), sample(
1,:), sample(
2,:), rweight)
235 call disp%show( rho(
1,
1) ,
format = format )
237 call disp%show( frank ,
format = format )
Generate and return an array of the specified rank and shape of arbitrary intrinsic type and kind wit...
Generate minimally-spaced character, integer, real sequences or sequences at fixed intervals of size ...
Allocate or resize (shrink or expand) an input allocatable scalar string or array of rank 1....
Generate and return an output array whose elements are the reversed-order elements of the input array...
Generate count evenly spaced points over the interval [x1, x2] if x1 < x2, or [x2,...
Generate an equally-weighted (verbose or flattened) array of the input weighted array of rank 1 or 2.
Generate and return a random positive-definite (correlation or covariance) matrix using the Gram meth...
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.
This is a generic method of the derived type display_type with pass attribute.
Generate and return the (weighted) mean of an input sample of nsam observations with ndim = 1 or 2 at...
Return the (weighted) mean of a pair of time series or of an input sample of nsam observations with n...
Generate a sample of shape (nsam), or (ndim, nsam) or (nsam, ndim) that is shifted by the specified i...
This module contains procedures and generic interfaces for convenient allocation and filling of array...
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 reversing the order of elements in arrays ...
This module contains procedures and generic interfaces for generating arrays with linear or logarithm...
This module contains procedures and generic interfaces for flattening (duplicating the elements of) a...
This module contains classes and procedures for generating random matrices distributed on the space o...
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...
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
integer, parameter RK
The default real kind in the ParaMonte library: real64 in Fortran, c_double in C-Fortran Interoperati...
integer, parameter LK
The default logical kind in the ParaMonte library: kind(.true.) in Fortran, kind(....
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
integer, parameter RKS
The single-precision real kind in Fortran mode. On most platforms, this is an 32-bit real kind.
This module contains classes and procedures for computing the first moment (i.e., the statistical mea...
This module contains classes and procedures for shifting univariate or multivariate samples by arbitr...
Generate and return an object of type display_type.
9sample
= reshape(
getUnifRand(
1,
20, ndim
* nsam), shape
= [ndim, nsam], order
= [
2,
1])
11+1.400000E+01,
+1.400000E+01,
+4.000000E+00,
+9.000000E+00,
+1.400000E+01,
+1.600000E+01,
+2.000000E+01,
+8.000000E+00,
+8.000000E+00,
+1.100000E+01
12+3.000000E+00,
+1.800000E+01,
+7.000000E+00,
+1.300000E+01,
+9.000000E+00,
+1.300000E+01,
+4.000000E+00,
+1.400000E+01,
+1.400000E+01,
+1.600000E+01
16call setRho(rho, uppDia, frank, sample,
dim = 2_IK)
18+1.000000E+00,
-2.538809E-01
19+0.000000E+00,
+1.000000E+00
22call setRho(rho, lowDia, frank, sample,
dim = 2_IK)
24+1.000000E+00,
+0.000000E+00
25-2.538809E-01,
+1.000000E+00
27+7.000000E+00,
+7.000000E+00,
+1.000000E+00,
+4.000000E+00,
+7.000000E+00,
+9.000000E+00,
+1.000000E+01,
+2.500000E+00,
+2.500000E+00,
+5.000000E+00
28+1.000000E+00,
+1.000000E+01,
+3.000000E+00,
+5.500000E+00,
+4.000000E+00,
+5.500000E+00,
+2.000000E+00,
+7.500000E+00,
+7.500000E+00,
+9.000000E+00
30'Compute the sample correlation along the first dimension.'
33call setRho(rho, uppDia, frankt,
transpose(sample),
dim = 1_IK)
35+1.000000E+00,
-2.538809E-01
36+0.000000E+00,
+1.000000E+00
38+7.000000E+00,
+1.000000E+00
39+7.000000E+00,
+1.000000E+01
40+1.000000E+00,
+3.000000E+00
41+4.000000E+00,
+5.500000E+00
42+7.000000E+00,
+4.000000E+00
43+9.000000E+00,
+5.500000E+00
44+1.000000E+01,
+2.000000E+00
45+2.500000E+00,
+7.500000E+00
46+2.500000E+00,
+7.500000E+00
47+5.000000E+00,
+9.000000E+00
50call setRho(rho, lowDia, frankt,
transpose(sample),
dim = 1_IK)
52+1.000000E+00,
+0.000000E+00
53-2.538809E-01,
+1.000000E+00
55+7.000000E+00,
+1.000000E+00
56+7.000000E+00,
+1.000000E+01
57+1.000000E+00,
+3.000000E+00
58+4.000000E+00,
+5.500000E+00
59+7.000000E+00,
+4.000000E+00
60+9.000000E+00,
+5.500000E+00
61+1.000000E+01,
+2.000000E+00
62+2.500000E+00,
+7.500000E+00
63+2.500000E+00,
+7.500000E+00
64+5.000000E+00,
+9.000000E+00
66'Compute the full sample correlation for a pair of time series.'
68call setRho(rho(
1,
1), frank(
1,:), frank(
2,:), sample(
1,:), sample(
2,:))
72+7.000000E+00,
+7.000000E+00,
+1.000000E+00,
+4.000000E+00,
+7.000000E+00,
+9.000000E+00,
+1.000000E+01,
+2.500000E+00,
+2.500000E+00,
+5.000000E+00
73+1.000000E+00,
+1.000000E+01,
+3.000000E+00,
+5.500000E+00,
+4.000000E+00,
+5.500000E+00,
+2.000000E+00,
+7.500000E+00,
+7.500000E+00,
+9.000000E+00
83sample
= reshape(
getUnifRand(
1,
20, ndim
* nsam), shape
= [ndim, nsam], order
= [
2,
1])
85+1.300000E+01,
+7.000000E+00,
+2.000000E+01,
+1.000000E+01,
+4.000000E+00,
+1.000000E+01,
+1.000000E+01,
+3.000000E+00,
+7.000000E+00,
+3.000000E+00
86+7.000000E+00,
+1.900000E+01,
+6.000000E+00,
+1.700000E+01,
+1.000000E+00,
+1.900000E+01,
+1.400000E+01,
+4.000000E+00,
+1.800000E+01,
+1.500000E+01
91+4,
+1,
+2,
+6,
+4,
+1,
+1,
+2,
+10,
+7
94+4,
+1,
+2,
+6,
+4,
+1,
+1,
+2,
+10,
+7
101call setRho(rho, uppDia, frank, sample,
2_IK, iweight)
103+1.000000E+00,
+4.117769E-02
104+0.000000E+00,
+1.000000E+00
106+9.000000E+00,
+4.500000E+00,
+1.000000E+01,
+7.000000E+00,
+3.000000E+00,
+7.000000E+00,
+7.000000E+00,
+1.500000E+00,
+4.500000E+00,
+1.500000E+00
107+4.000000E+00,
+9.500000E+00,
+3.000000E+00,
+7.000000E+00,
+1.000000E+00,
+9.500000E+00,
+5.000000E+00,
+2.000000E+00,
+8.000000E+00,
+6.000000E+00
110call setRho(rho, lowDia, frank, sample,
2_IK, iweight)
112+1.000000E+00,
+0.000000E+00
113+4.117769E-02,
+1.000000E+00
115+9.000000E+00,
+4.500000E+00,
+1.000000E+01,
+7.000000E+00,
+3.000000E+00,
+7.000000E+00,
+7.000000E+00,
+1.500000E+00,
+4.500000E+00,
+1.500000E+00
116+4.000000E+00,
+9.500000E+00,
+3.000000E+00,
+7.000000E+00,
+1.000000E+00,
+9.500000E+00,
+5.000000E+00,
+2.000000E+00,
+8.000000E+00,
+6.000000E+00
118'Compute the sample correlation along the first dimension.'
121call setRho(rho, uppDia, frankt,
transpose(sample),
1_IK, iweight)
123+1.000000E+00,
+4.117769E-02
124+0.000000E+00,
+1.000000E+00
127call setRho(rho, lowDia, frankt,
transpose(sample),
1_IK, iweight)
129+1.000000E+00,
+0.000000E+00
130+4.117769E-02,
+1.000000E+00
132+9.000000E+00,
+4.000000E+00
133+4.500000E+00,
+9.500000E+00
134+1.000000E+01,
+3.000000E+00
135+7.000000E+00,
+7.000000E+00
136+3.000000E+00,
+1.000000E+00
137+7.000000E+00,
+9.500000E+00
138+7.000000E+00,
+5.000000E+00
139+1.500000E+00,
+2.000000E+00
140+4.500000E+00,
+8.000000E+00
141+1.500000E+00,
+6.000000E+00
143'Compute the full sample correlation for a pair of time series.'
145call setRho(rho(
1,
1), frank(
1,:), frank(
2,:), sample(
1,:), sample(
2,:), iweight)
149+9.000000E+00,
+4.500000E+00,
+1.000000E+01,
+7.000000E+00,
+3.000000E+00,
+7.000000E+00,
+7.000000E+00,
+1.500000E+00,
+4.500000E+00,
+1.500000E+00
150+4.000000E+00,
+9.500000E+00,
+3.000000E+00,
+7.000000E+00,
+1.000000E+00,
+9.500000E+00,
+5.000000E+00,
+2.000000E+00,
+8.000000E+00,
+6.000000E+00
158call setRho(rho, uppDia, frank, sample,
2_IK, rweight)
160+1.000000E+00,
+4.117769E-02
161+0.000000E+00,
+1.000000E+00
163+9.000000E+00,
+4.500000E+00,
+1.000000E+01,
+7.000000E+00,
+3.000000E+00,
+7.000000E+00,
+7.000000E+00,
+1.500000E+00,
+4.500000E+00,
+1.500000E+00
164+4.000000E+00,
+9.500000E+00,
+3.000000E+00,
+7.000000E+00,
+1.000000E+00,
+9.500000E+00,
+5.000000E+00,
+2.000000E+00,
+8.000000E+00,
+6.000000E+00
167call setRho(rho, lowDia, frank, sample,
2_IK, rweight)
169+1.000000E+00,
+0.000000E+00
170+4.117769E-02,
+1.000000E+00
172+9.000000E+00,
+4.500000E+00,
+1.000000E+01,
+7.000000E+00,
+3.000000E+00,
+7.000000E+00,
+7.000000E+00,
+1.500000E+00,
+4.500000E+00,
+1.500000E+00
173+4.000000E+00,
+9.500000E+00,
+3.000000E+00,
+7.000000E+00,
+1.000000E+00,
+9.500000E+00,
+5.000000E+00,
+2.000000E+00,
+8.000000E+00,
+6.000000E+00
175'Compute the sample correlation along the first dimension.'
178call setRho(rho, uppDia, frankt,
transpose(sample),
1_IK, rweight)
180+1.000000E+00,
+4.117769E-02
181+0.000000E+00,
+1.000000E+00
183+9.000000E+00,
+4.000000E+00
184+4.500000E+00,
+9.500000E+00
185+1.000000E+01,
+3.000000E+00
186+7.000000E+00,
+7.000000E+00
187+3.000000E+00,
+1.000000E+00
188+7.000000E+00,
+9.500000E+00
189+7.000000E+00,
+5.000000E+00
190+1.500000E+00,
+2.000000E+00
191+4.500000E+00,
+8.000000E+00
192+1.500000E+00,
+6.000000E+00
195call setRho(rho, lowDia, frankt,
transpose(sample),
1_IK, rweight)
197+1.000000E+00,
+0.000000E+00
198+4.117769E-02,
+1.000000E+00
200+9.000000E+00,
+4.000000E+00
201+4.500000E+00,
+9.500000E+00
202+1.000000E+01,
+3.000000E+00
203+7.000000E+00,
+7.000000E+00
204+3.000000E+00,
+1.000000E+00
205+7.000000E+00,
+9.500000E+00
206+7.000000E+00,
+5.000000E+00
207+1.500000E+00,
+2.000000E+00
208+4.500000E+00,
+8.000000E+00
209+1.500000E+00,
+6.000000E+00
211'Compute the full sample correlation for a pair of time series.'
213call setRho(rho(
1,
1), frank(
1,:), frank(
2,:), sample(
1,:), sample(
2,:), rweight)
217+9.000000E+00,
+4.500000E+00,
+1.000000E+01,
+7.000000E+00,
+3.000000E+00,
+7.000000E+00,
+7.000000E+00,
+1.500000E+00,
+4.500000E+00,
+1.500000E+00
218+4.000000E+00,
+9.500000E+00,
+3.000000E+00,
+7.000000E+00,
+1.000000E+00,
+9.500000E+00,
+5.000000E+00,
+2.000000E+00,
+8.000000E+00,
+6.000000E+00