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

Generate and return the index of a specific element of a matrix of a specific storage in specific packing format from the corresponding index in an alternative packing format. More...

Detailed Description

Generate and return the index of a specific element of a matrix of a specific storage in specific packing format from the corresponding index in an alternative packing format.

Specifically, this generic interface allows the conversion of indices of upper and lower triangular matrices in

  1. Rectangular Default Package to Linear Packed Package and vice versa.
  2. Rectangular Default Package to Rectangular Full Package and vice versa.
Parameters
[in]dpack: The input scalar that can be,
  1. the constant lfpack only if the input argument spack is rdpack,
  2. the constant rfpack only if the input argument spack is rdpack,
  3. the constant rdpack only if the input argument spack is rfpack or lfpack,
representing the target packing format to which the input sindex must be converted.
[in]spack: The input scalar that can be,
  1. the constant lfpack only if the input argument dpack is rdpack,
  2. the constant rfpack only if the input argument dpack is rdpack,
representing the original packing format from which the input sindex must be converted.
[in]sindex: The input scalar or vector of size (2) of type integer of default kind IK, representing the index of an element of the source matrix in spack packing format to be converted to the target output index in dpack packing format.
It must be scalar if and only if the input argument spack is set to lfpack, otherwise it must be a vector.
[in]subset: The input scalar that can be,
  1. the constant uppDia indicating the upper-triangular storage of the original matrix in spack packing.
  2. the constant lowDia indicating the lower-triangular storage of the original matrix in spack packing.
[in]shape: The input vector of size 1 or 2 representing the shape of the original upper/lower triangular matrix in the default Rectangular Standard Packing format.
This value is readily returned by the Fortran intrinsic shape() if the original/target matrix already exists in the default Rectangular Standard Packing.
[in]doff: The input scalar of type integer of default kind IK, representing the offset of the diagonal of the upper/lower triangular matrix with respect to its top-left corner element.
By definition,
  1. the diagonal offset is non-positive for upper-triangular matrix storage.
  2. the diagonal offset is non-negative for lower-triangular matrix storage.
  3. the diagonal offset is always zero for matrices in Rectangular Full Packing (RFP) format.
  4. the diagonal offset is always zero for upper/lower square matrices.
(optional, default = 0. It can be present if and only if neither the original or the target packing is Rectangular Full Package.)
Returns
dindex : The output scalar or vector of size (2) of type integer of default kind IK, representing the converted index of the corresponding element of the source matrix in spack packing to the target dpack packing format.
It is a scalar if and only if the input argument dpack is set to lfpack, otherwise it is a vector of size 2.


Possible calling interfaces

integer(IK) :: dindex, sindex
dindex = getMatIndex(dpack, spack, sindex, subset, shape, doff = doff)
Generate and return the index of a specific element of a matrix of a specific storage in specific pac...
This module contains procedures and generic interfaces for converting the indices of matrix elements ...
This module contains abstract and concrete derived types that are required for compile-time resolutio...
type(rdpack_type), parameter rdpack
This is an object instance of class rdpack_type that is exclusively used to signify Rectangular Spars...
type(lfpack_type), parameter lfpack
This is an object instance of class lfpack_type that is exclusively used to signify Linear Full conti...
type(rfpack_type), parameter rfpack
This is an object instance of class rfpack_type that is exclusively used to signify Rectangular Full ...
This module contains abstract and concrete derived types that are required for compile-time resolutio...
type(lowDia_type), parameter lowDia
This is a scalar parameter object of type lowDia_type that is exclusively used to request lower-diago...
type(uppDia_type), parameter uppDia
This is a scalar parameter object of type uppDia_type that is exclusively used to request upper-diago...
Warning
The condition all(0 <= shape) must hold for the corresponding input arguments.
The condition all([0 < sindex]) must hold for the corresponding input arguments.
The condition 0 <= shape(1) + doff .and. doff <= 0 must hold for the corresponding input arguments when subset = uppDia.
The condition 0 <= shape(2) - doff .and. 0 <= doff must hold for the corresponding input arguments when subset = lowDia.
The condition all(sindex <= shape) must hold for the corresponding input arguments when spack = rdpack.
The condition sindex(1) <= sindex(2) - doff must hold for the corresponding input arguments when spack = rdpack, subset = uppDia.
The condition sindex(2) <= sindex(1) + doff must hold for the corresponding input arguments when spack = rdpack, subset = lowDia.
The specified input sindex must correspond to an element within the specified storage subset and packing spack of the original matrix.
The condition shape(1) == shape(2) must hold for the corresponding input arguments when spack = rfpack or dpack = rfpack.
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
pm_matrixCopy
pm_matrixPack
pm_matrixSubset


Example usage

1program example
2
3 use pm_kind, only: SK, IK
4 use pm_io, only: display_type
5 use pm_distUnif, only: setUnifRand
7 use pm_matrixIndex, only: lfpack
8 use pm_matrixIndex, only: rfpack
9 use pm_matrixIndex, only: rdpack
10 use pm_matrixIndex, only: uppDia
11 use pm_matrixIndex, only: lowDia
12 use pm_err, only: setAsserted
13 use pm_val2str, only: getStr
14
15 implicit none
16
17 integer(IK) :: doff, indexLFP, indexRFP(2), indexRDP(2), jndexRDP(2)
18 integer(IK), parameter :: nrow = 5, ncol = 5
19 character(2) :: matRDP(nrow, ncol)
20
21 type(display_type) :: disp
22 disp = display_type(file = "main.out.F90")
23
24 block
25 integer :: icol, irow
26 do icol = 1, ncol
27 do irow = 1, nrow
28 matRDP(irow, icol) = getStr(irow)//getStr(icol)
29 end do
30 end do
31 end block
32
33 call disp%skip()
34 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
35 call disp%show("! Upper triangle of an RDP matrix to LFP matrix.")
36 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
37 call disp%skip()
38
39 call disp%skip()
40 call disp%show("matRDP")
41 call disp%show( matRDP , deliml = """" )
42
43 call disp%skip()
44 call disp%show("indexRDP = [2, 3]")
45 indexRDP = [2, 3]
46 call disp%show("matRDP(indexRDP(1), indexRDP(2))")
47 call disp%show( matRDP(indexRDP(1), indexRDP(2)) , deliml = """" )
48 call disp%show("indexLFP = getMatIndex(lfpack, rdpack, indexRDP, uppDia, shape(matRDP, IK))")
49 indexLFP = getMatIndex(lfpack, rdpack, indexRDP, uppDia, shape(matRDP, IK))
50 call disp%show("indexLFP")
51 call disp%show( indexLFP )
52 call disp%show("call setAsserted(indexLFP == 5_IK)")
53 call setAsserted(indexLFP == 5_IK)
54 call disp%show("jndexRDP = getMatIndex(rdpack, lfpack, indexLFP, uppDia, shape(matRDP, IK)) ! revert")
55 jndexRDP = getMatIndex(rdpack, lfpack, indexLFP, uppDia, shape(matRDP, IK))
56 call disp%show("jndexRDP")
57 call disp%show( jndexRDP )
58 call disp%show("call setAsserted(all(jndexRDP == indexRDP))")
59 call setAsserted(all(jndexRDP == indexRDP))
60
61 call disp%skip()
62 call disp%show("indexRDP = [4, 2]; doff = -2")
63 indexRDP = [4, 2]; doff = -2
64 call disp%show("matRDP(indexRDP(1), indexRDP(2))")
65 call disp%show( matRDP(indexRDP(1), indexRDP(2)) , deliml = """" )
66 call disp%show("indexLFP = getMatIndex(lfpack, rdpack, indexRDP, uppDia, shape(matRDP, IK), doff)")
67 indexLFP = getMatIndex(lfpack, rdpack, indexRDP, uppDia, shape(matRDP, IK), doff)
68 call disp%show("indexLFP")
69 call disp%show( indexLFP )
70 call disp%show("call setAsserted(indexLFP == 7_IK)")
71 call setAsserted(indexLFP == 7_IK)
72 call disp%show("jndexRDP = getMatIndex(rdpack, lfpack, indexLFP, uppDia, shape(matRDP, IK), doff) ! revert")
73 jndexRDP = getMatIndex(rdpack, lfpack, indexLFP, uppDia, shape(matRDP, IK), doff)
74 call disp%show("jndexRDP")
75 call disp%show( jndexRDP )
76 call disp%show("call setAsserted(all(jndexRDP == indexRDP))")
77 call setAsserted(all(jndexRDP == indexRDP))
78
79 call disp%skip()
80 call disp%show("indexRDP = [5, 4]; doff = -2")
81 indexRDP = [5, 4]; doff = -2
82 call disp%show("matRDP(indexRDP(1), indexRDP(2))")
83 call disp%show( matRDP(indexRDP(1), indexRDP(2)) , deliml = """" )
84 call disp%show("indexLFP = getMatIndex(lfpack, rdpack, indexRDP, uppDia, shape(matRDP, IK), doff)")
85 indexLFP = getMatIndex(lfpack, rdpack, indexRDP, uppDia, shape(matRDP, IK), doff)
86 call disp%show("indexLFP")
87 call disp%show( indexLFP )
88 call disp%show("call setAsserted(indexLFP == 17_IK)")
89 call setAsserted(indexLFP == 17_IK)
90 call disp%show("jndexRDP = getMatIndex(rdpack, lfpack, indexLFP, uppDia, shape(matRDP, IK), doff) ! revert")
91 jndexRDP = getMatIndex(rdpack, lfpack, indexLFP, uppDia, shape(matRDP, IK), doff)
92 call disp%show("jndexRDP")
93 call disp%show( jndexRDP )
94 call disp%show("call setAsserted(all(jndexRDP == indexRDP))")
95 call setAsserted(all(jndexRDP == indexRDP))
96
97 call disp%skip()
98 call disp%show("indexRDP = [5, 5]; doff = -5")
99 indexRDP = [5, 5]; doff = -5
100 call disp%show("matRDP(indexRDP(1), indexRDP(2))")
101 call disp%show( matRDP(indexRDP(1), indexRDP(2)) , deliml = """" )
102 call disp%show("indexLFP = getMatIndex(lfpack, rdpack, indexRDP, uppDia, shape(matRDP, IK), doff)")
103 indexLFP = getMatIndex(lfpack, rdpack, indexRDP, uppDia, shape(matRDP, IK), doff)
104 call disp%show("indexLFP")
105 call disp%show( indexLFP )
106 call disp%show("call setAsserted(indexLFP == 25_IK)")
107 call setAsserted(indexLFP == 25_IK)
108 call disp%show("jndexRDP = getMatIndex(rdpack, lfpack, indexLFP, uppDia, shape(matRDP, IK), doff) ! revert")
109 jndexRDP = getMatIndex(rdpack, lfpack, indexLFP, uppDia, shape(matRDP, IK), doff)
110 call disp%show("jndexRDP")
111 call disp%show( jndexRDP )
112 call disp%show("call setAsserted(all(jndexRDP == indexRDP))")
113 call setAsserted(all(jndexRDP == indexRDP))
114
115 call disp%skip()
116 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
117 call disp%show("! Lower triangle of a RDP matrix to LFP matrix.")
118 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
119 call disp%skip()
120
121 call disp%skip()
122 call disp%show("matRDP")
123 call disp%show( matRDP , deliml = """" )
124
125 call disp%skip()
126 call disp%show("indexRDP = [3, 2]")
127 indexRDP = [3, 2]
128 call disp%show("matRDP(indexRDP(1), indexRDP(2))")
129 call disp%show( matRDP(indexRDP(1), indexRDP(2)) , deliml = """" )
130 call disp%show("indexLFP = getMatIndex(lfpack, rdpack, indexRDP, lowDia, shape(matRDP, IK))")
131 indexLFP = getMatIndex(lfpack, rdpack, indexRDP, lowDia, shape(matRDP, IK))
132 call disp%show("indexLFP")
133 call disp%show( indexLFP )
134 call disp%show("call setAsserted(indexLFP == 7_IK)")
135 call setAsserted(indexLFP == 7_IK)
136 call disp%show("jndexRDP = getMatIndex(rdpack, lfpack, indexLFP, lowDia, shape(matRDP, IK)) ! revert")
137 jndexRDP = getMatIndex(rdpack, lfpack, indexLFP, lowDia, shape(matRDP, IK))
138 call disp%show("jndexRDP")
139 call disp%show( jndexRDP )
140 call disp%show("call setAsserted(all(jndexRDP == indexRDP))")
141 call setAsserted(all(jndexRDP == indexRDP))
142
143 call disp%skip()
144 call disp%show("indexRDP = [2, 4]; doff = +2")
145 indexRDP = [2, 4]; doff = +2
146 call disp%show("matRDP(indexRDP(1), indexRDP(2))")
147 call disp%show( matRDP(indexRDP(1), indexRDP(2)) , deliml = """" )
148 call disp%show("indexLFP = getMatIndex(lfpack, rdpack, indexRDP, lowDia, shape(matRDP, IK), doff) ! 16")
149 indexLFP = getMatIndex(lfpack, rdpack, indexRDP, lowDia, shape(matRDP, IK), doff)
150 call disp%show("indexLFP")
151 call disp%show( indexLFP )
152 call disp%show("call setAsserted(indexLFP == 16_IK)")
153 call setAsserted(indexLFP == 16_IK)
154 call disp%show("jndexRDP = getMatIndex(rdpack, lfpack, indexLFP, lowDia, shape(matRDP, IK), doff) ! revert")
155 jndexRDP = getMatIndex(rdpack, lfpack, indexLFP, lowDia, shape(matRDP, IK), doff)
156 call disp%show("jndexRDP")
157 call disp%show( jndexRDP )
158 call disp%show("call setAsserted(all(jndexRDP == indexRDP))")
159 call setAsserted(all(jndexRDP == indexRDP))
160
161 call disp%skip()
162 call disp%show("indexRDP = [4, 5]; doff = +2")
163 indexRDP = [4, 5]; doff = +2
164 call disp%show("matRDP(indexRDP(1), indexRDP(2))")
165 call disp%show( matRDP(indexRDP(1), indexRDP(2)) , deliml = """" )
166 call disp%show("indexLFP = getMatIndex(lfpack, rdpack, indexRDP, lowDia, shape(matRDP, IK), doff) ! 21")
167 indexLFP = getMatIndex(lfpack, rdpack, indexRDP, lowDia, shape(matRDP, IK), doff)
168 call disp%show("indexLFP")
169 call disp%show( indexLFP )
170 call disp%show("call setAsserted(indexLFP == 21_IK)")
171 call setAsserted(indexLFP == 21_IK)
172 call disp%show("jndexRDP = getMatIndex(rdpack, lfpack, indexLFP, lowDia, shape(matRDP, IK), doff) ! revert")
173 jndexRDP = getMatIndex(rdpack, lfpack, indexLFP, lowDia, shape(matRDP, IK), doff)
174 call disp%show("jndexRDP")
175 call disp%show( jndexRDP )
176 call disp%show("call setAsserted(all(jndexRDP == indexRDP))")
177 call setAsserted(all(jndexRDP == indexRDP))
178
179 call disp%skip()
180 call disp%show("indexRDP = [5, 5]; doff = +5")
181 indexRDP = [5, 5]; doff = +5
182 call disp%show("matRDP(indexRDP(1), indexRDP(2))")
183 call disp%show( matRDP(indexRDP(1), indexRDP(2)) , deliml = """" )
184 call disp%show("indexLFP = getMatIndex(lfpack, rdpack, indexRDP, lowDia, shape(matRDP, IK), doff)")
185 indexLFP = getMatIndex(lfpack, rdpack, indexRDP, lowDia, shape(matRDP, IK), doff)
186 call disp%show("indexLFP")
187 call disp%show( indexLFP )
188 call disp%show("call setAsserted(indexLFP == 25_IK)")
189 call setAsserted(indexLFP == 25_IK)
190 call disp%show("jndexRDP = getMatIndex(rdpack, lfpack, indexLFP, lowDia, shape(matRDP, IK), doff) ! revert")
191 jndexRDP = getMatIndex(rdpack, lfpack, indexLFP, lowDia, shape(matRDP, IK), doff)
192 call disp%show("jndexRDP")
193 call disp%show( jndexRDP )
194 call disp%show("call setAsserted(all(jndexRDP == indexRDP))")
195 call setAsserted(all(jndexRDP == indexRDP))
196
197 call disp%skip()
198 call disp%show("indexRDP = [4, 2]")
199 indexRDP = [4, 2]
200 call disp%show("matRDP(indexRDP(1), indexRDP(2))")
201 call disp%show( matRDP(indexRDP(1), indexRDP(2)) , deliml = """" )
202 call disp%show("indexLFP = getMatIndex(lfpack, rdpack, indexRDP, lowDia, shape(matRDP, IK)) ! 8")
203 indexLFP = getMatIndex(lfpack, rdpack, indexRDP, lowDia, shape(matRDP, IK))
204 call disp%show("indexLFP")
205 call disp%show( indexLFP )
206 call disp%show("call setAsserted(indexLFP == 8_IK)")
207 call setAsserted(indexLFP == 8_IK)
208 call disp%show("jndexRDP = getMatIndex(rdpack, lfpack, indexLFP, lowDia, shape(matRDP, IK)) ! revert")
209 jndexRDP = getMatIndex(rdpack, lfpack, indexLFP, lowDia, shape(matRDP, IK))
210 call disp%show("jndexRDP")
211 call disp%show( jndexRDP )
212 call disp%show("call setAsserted(all(jndexRDP == indexRDP))")
213 call setAsserted(all(jndexRDP == indexRDP))
214
215 call disp%skip()
216 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
217 call disp%show("! Upper triangle of a RDP matrix to RFP matrix.")
218 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
219 call disp%skip()
220
221 call disp%skip()
222 call disp%show("matRDP")
223 call disp%show( matRDP , deliml = """" )
224
225 call disp%skip()
226 call disp%show("indexRDP = [2, 3];")
227 indexRDP = [2, 3];
228 call disp%show("matRDP(indexRDP(1), indexRDP(2))")
229 call disp%show( matRDP(indexRDP(1), indexRDP(2)) , deliml = """" )
230 call disp%show("indexRFP = getMatIndex(rfpack, rdpack, indexRDP, uppDia, shape(matRDP, IK))")
231 indexRFP = getMatIndex(rfpack, rdpack, indexRDP, uppDia, shape(matRDP, IK))
232 call disp%show("indexRFP")
233 call disp%show( indexRFP )
234 call disp%show("call setAsserted(all(indexRFP == [2, 1]))")
235 call setAsserted(all(indexRFP == [2, 1]))
236 call disp%show("jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, uppDia, shape(matRDP, IK)) ! revert")
237 jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, uppDia, shape(matRDP, IK))
238 call disp%show("jndexRDP")
239 call disp%show( jndexRDP )
240 call disp%show("call setAsserted(all(jndexRDP == indexRDP))")
241 call setAsserted(all(jndexRDP == indexRDP))
242
243 call disp%skip()
244 call disp%show("indexRDP = [1, 2]")
245 indexRDP = [1, 2]
246 call disp%show("matRDP(indexRDP(1), indexRDP(2))")
247 call disp%show( matRDP(indexRDP(1), indexRDP(2)) , deliml = """" )
248 call disp%show("indexRFP = getMatIndex(rfpack, rdpack, indexRDP, uppDia, shape(matRDP, IK))")
249 indexRFP = getMatIndex(rfpack, rdpack, indexRDP, uppDia, shape(matRDP, IK))
250 call disp%show("indexRFP")
251 call disp%show( indexRFP )
252 call disp%show("call setAsserted(all(indexRFP == [5, 1]))")
253 call setAsserted(all(indexRFP == [5, 1]))
254 call disp%show("jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, uppDia, shape(matRDP, IK)) ! revert")
255 jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, uppDia, shape(matRDP, IK))
256 call disp%show("jndexRDP")
257 call disp%show( jndexRDP )
258 call disp%show("call setAsserted(all(jndexRDP == indexRDP))")
259 call setAsserted(all(jndexRDP == indexRDP))
260
261 call disp%skip()
262 call disp%show("indexRDP = [4, 5]")
263 indexRDP = [4, 5]
264 call disp%show("matRDP(indexRDP(1), indexRDP(2))")
265 call disp%show( matRDP(indexRDP(1), indexRDP(2)) , deliml = """" )
266 call disp%show("indexRFP = getMatIndex(rfpack, rdpack, indexRDP, uppDia, shape(matRDP, IK))")
267 indexRFP = getMatIndex(rfpack, rdpack, indexRDP, uppDia, shape(matRDP, IK))
268 call disp%show("indexRFP")
269 call disp%show( indexRFP )
270 call disp%show("call setAsserted(all(indexRFP == [4, 3]))")
271 call setAsserted(all(indexRFP == [4, 3]))
272 call disp%show("jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, uppDia, shape(matRDP, IK)) ! revert")
273 jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, uppDia, shape(matRDP, IK))
274 call disp%show("jndexRDP")
275 call disp%show( jndexRDP )
276 call disp%show("call setAsserted(all(jndexRDP == indexRDP))")
277 call setAsserted(all(jndexRDP == indexRDP))
278
279 call disp%skip()
280 call disp%show("indexRDP = [5, 5]")
281 indexRDP = [5, 5]
282 call disp%show("matRDP(indexRDP(1), indexRDP(2))")
283 call disp%show( matRDP(indexRDP(1), indexRDP(2)) , deliml = """" )
284 call disp%show("indexRFP = getMatIndex(rfpack, rdpack, indexRDP, uppDia, shape(matRDP, IK))")
285 indexRFP = getMatIndex(rfpack, rdpack, indexRDP, uppDia, shape(matRDP, IK))
286 call disp%show("indexRFP")
287 call disp%show( indexRFP )
288 call disp%show("call setAsserted(all(indexRFP == [5, 3]))")
289 call setAsserted(all(indexRFP == [5, 3]))
290 call disp%show("jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, uppDia, shape(matRDP, IK)) ! revert")
291 jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, uppDia, shape(matRDP, IK))
292 call disp%show("jndexRDP")
293 call disp%show( jndexRDP )
294 call disp%show("call setAsserted(all(jndexRDP == indexRDP))")
295 call setAsserted(all(jndexRDP == indexRDP))
296 call disp%skip()
297
298 call disp%skip()
299 call disp%show("matRDP(1:4, 1:4)")
300 call disp%show( matRDP(1:4, 1:4) , deliml = """" )
301
302 call disp%skip()
303 call disp%show("indexRDP = [2, 3]")
304 indexRDP = [2, 3]
305 call disp%show("matRDP(indexRDP(1), indexRDP(2))")
306 call disp%show( matRDP(indexRDP(1), indexRDP(2)) , deliml = """" )
307 call disp%show("indexRFP = getMatIndex(rfpack, rdpack, indexRDP, uppDia, shape(matRDP, IK) - 1_IK)")
308 indexRFP = getMatIndex(rfpack, rdpack, indexRDP, uppDia, shape(matRDP, IK) - 1_IK)
309 call disp%show("indexRFP")
310 call disp%show( indexRFP )
311 call disp%show("call setAsserted(all(indexRFP == [2, 1]))")
312 call setAsserted(all(indexRFP == [2, 1]))
313 call disp%show("jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, uppDia, shape(matRDP, IK)) ! revert")
314 jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, uppDia, shape(matRDP, IK))
315 call disp%show("jndexRDP")
316 call disp%show( jndexRDP )
317 call disp%show("call setAsserted(all(jndexRDP == indexRDP))")
318 call setAsserted(all(jndexRDP == indexRDP))
319
320 call disp%skip()
321 call disp%show("indexRDP = [2, 2]")
322 indexRDP = [2, 2]
323 call disp%show("matRDP(indexRDP(1), indexRDP(2))")
324 call disp%show( matRDP(indexRDP(1), indexRDP(2)) , deliml = """" )
325 call disp%show("indexRFP = getMatIndex(rfpack, rdpack, indexRDP, uppDia, shape(matRDP, IK) - 1_IK)")
326 indexRFP = getMatIndex(rfpack, rdpack, indexRDP, uppDia, shape(matRDP, IK) - 1_IK)
327 call disp%show("indexRFP")
328 call disp%show( indexRFP )
329 call disp%show("call setAsserted(all(indexRFP == [5, 2]))")
330 call setAsserted(all(indexRFP == [5, 2]))
331 call disp%show("jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, uppDia, shape(matRDP, IK)) ! revert")
332 jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, uppDia, shape(matRDP, IK))
333 call disp%show("jndexRDP")
334 call disp%show( jndexRDP )
335 call disp%show("call setAsserted(all(jndexRDP == indexRDP))")
336 call setAsserted(all(jndexRDP == indexRDP))
337
338 call disp%skip()
339 call disp%show("indexRDP = [3, 4]")
340 indexRDP = [3, 4]
341 call disp%show("matRDP(indexRDP(1), indexRDP(2))")
342 call disp%show( matRDP(indexRDP(1), indexRDP(2)) , deliml = """" )
343 call disp%show("indexRFP = getMatIndex(rfpack, rdpack, indexRDP, uppDia, shape(matRDP, IK) - 1_IK)")
344 indexRFP = getMatIndex(rfpack, rdpack, indexRDP, uppDia, shape(matRDP, IK) - 1_IK)
345 call disp%show("indexRFP")
346 call disp%show( indexRFP )
347 call disp%show("call setAsserted(all(indexRFP == [3, 2]))")
348 call setAsserted(all(indexRFP == [3, 2]))
349 call disp%show("jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, uppDia, shape(matRDP, IK)) ! revert")
350 jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, uppDia, shape(matRDP, IK))
351 call disp%show("jndexRDP")
352 call disp%show( jndexRDP )
353 call disp%show("call setAsserted(all(jndexRDP == indexRDP))")
354 call setAsserted(all(jndexRDP == indexRDP))
355
356 call disp%skip()
357 call disp%show("indexRDP = [4, 4]")
358 indexRDP = [4, 4]
359 call disp%show("matRDP(indexRDP(1), indexRDP(2))")
360 call disp%show( matRDP(indexRDP(1), indexRDP(2)) , deliml = """" )
361 call disp%show("indexRFP = getMatIndex(rfpack, rdpack, indexRDP, uppDia, shape(matRDP, IK) - 1_IK)")
362 indexRFP = getMatIndex(rfpack, rdpack, indexRDP, uppDia, shape(matRDP, IK) - 1_IK)
363 call disp%show("indexRFP")
364 call disp%show( indexRFP )
365 call disp%show("call setAsserted(all(indexRFP == [4, 2]))")
366 call setAsserted(all(indexRFP == [4, 2]))
367 call disp%show("jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, uppDia, shape(matRDP, IK)) ! revert")
368 jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, uppDia, shape(matRDP, IK))
369 call disp%show("jndexRDP")
370 call disp%show( jndexRDP )
371 call disp%show("call setAsserted(all(jndexRDP == indexRDP))")
372 call setAsserted(all(jndexRDP == indexRDP))
373
374 call disp%skip()
375 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
376 call disp%show("! Lower triangle of a RDP matrix to RFP matrix.")
377 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
378 call disp%skip()
379
380 call disp%skip()
381 call disp%show("matRDP")
382 call disp%show( matRDP , deliml = """" )
383
384 call disp%skip()
385 call disp%show("indexRDP = [3, 2]")
386 indexRDP = [3, 2]
387 call disp%show("matRDP(indexRDP(1), indexRDP(2))")
388 call disp%show( matRDP(indexRDP(1), indexRDP(2)) , deliml = """" )
389 call disp%show("indexRFP = getMatIndex(rfpack, rdpack, indexRDP, lowDia, shape(matRDP, IK))")
390 indexRFP = getMatIndex(rfpack, rdpack, indexRDP, lowDia, shape(matRDP, IK))
391 call disp%show("indexRFP")
392 call disp%show( indexRFP )
393 call disp%show("call setAsserted(all(indexRFP == [3, 2]))")
394 call setAsserted(all(indexRFP == [3, 2]))
395 call disp%show("jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, lowDia, shape(matRDP, IK)) ! revert")
396 jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, lowDia, shape(matRDP, IK))
397 call disp%show("jndexRDP")
398 call disp%show( jndexRDP )
399 call disp%show("call setAsserted(all(jndexRDP == indexRDP))")
400 call setAsserted(all(jndexRDP == indexRDP))
401
402 call disp%skip()
403 call disp%show("indexRDP = [2, 1]")
404 indexRDP = [2, 1]
405 call disp%show("matRDP(indexRDP(1), indexRDP(2))")
406 call disp%show( matRDP(indexRDP(1), indexRDP(2)) , deliml = """" )
407 call disp%show("indexRFP = getMatIndex(rfpack, rdpack, indexRDP, lowDia, shape(matRDP, IK))")
408 indexRFP = getMatIndex(rfpack, rdpack, indexRDP, lowDia, shape(matRDP, IK))
409 call disp%show("indexRFP")
410 call disp%show( indexRFP )
411 call disp%show("call setAsserted(all(indexRFP == [2, 1]))")
412 call setAsserted(all(indexRFP == [2, 1]))
413 call disp%show("jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, lowDia, shape(matRDP, IK)) ! revert")
414 jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, lowDia, shape(matRDP, IK))
415 call disp%show("jndexRDP")
416 call disp%show( jndexRDP )
417 call disp%show("call setAsserted(all(jndexRDP == indexRDP))")
418 call setAsserted(all(jndexRDP == indexRDP))
419
420 call disp%skip()
421 call disp%show("indexRDP = [5, 4]")
422 indexRDP = [5, 4]
423 call disp%show("matRDP(indexRDP(1), indexRDP(2))")
424 call disp%show( matRDP(indexRDP(1), indexRDP(2)) , deliml = """" )
425 call disp%show("indexRFP = getMatIndex(rfpack, rdpack, indexRDP, lowDia, shape(matRDP, IK))")
426 indexRFP = getMatIndex(rfpack, rdpack, indexRDP, lowDia, shape(matRDP, IK))
427 call disp%show("indexRFP")
428 call disp%show( indexRFP )
429 call disp%show("call setAsserted(all(indexRFP == [1, 3]))")
430 call setAsserted(all(indexRFP == [1, 3]))
431 call disp%show("jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, lowDia, shape(matRDP, IK)) ! revert")
432 jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, lowDia, shape(matRDP, IK))
433 call disp%show("jndexRDP")
434 call disp%show( jndexRDP )
435 call disp%show("call setAsserted(all(jndexRDP == indexRDP))")
436 call setAsserted(all(jndexRDP == indexRDP))
437
438 call disp%skip()
439 call disp%show("indexRDP = [5, 5]")
440 indexRDP = [5, 5]
441 call disp%show("matRDP(indexRDP(1), indexRDP(2))")
442 call disp%show( matRDP(indexRDP(1), indexRDP(2)) , deliml = """" )
443 call disp%show("indexRFP = getMatIndex(rfpack, rdpack, indexRDP, lowDia, shape(matRDP, IK))")
444 indexRFP = getMatIndex(rfpack, rdpack, indexRDP, lowDia, shape(matRDP, IK))
445 call disp%show("indexRFP")
446 call disp%show( indexRFP )
447 call disp%show("call setAsserted(all(indexRFP == [2, 3]))")
448 call setAsserted(all(indexRFP == [2, 3]))
449 call disp%show("jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, lowDia, shape(matRDP, IK)) ! revert")
450 jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, lowDia, shape(matRDP, IK))
451 call disp%show("jndexRDP")
452 call disp%show( jndexRDP )
453 call disp%show("call setAsserted(all(jndexRDP == indexRDP))")
454 call setAsserted(all(jndexRDP == indexRDP))
455 call disp%skip()
456
457 call disp%skip()
458 call disp%show("matRDP(1:4, 1:4)")
459 call disp%show( matRDP(1:4, 1:4) , deliml = """" )
460
461 call disp%skip()
462 call disp%show("indexRDP = [3, 2]")
463 indexRDP = [3, 2]
464 call disp%show("matRDP(indexRDP(1), indexRDP(2))")
465 call disp%show( matRDP(indexRDP(1), indexRDP(2)) , deliml = """" )
466 call disp%show("indexRFP = getMatIndex(rfpack, rdpack, indexRDP, lowDia, shape(matRDP, IK) - 1_IK)")
467 indexRFP = getMatIndex(rfpack, rdpack, indexRDP, lowDia, shape(matRDP, IK) - 1_IK)
468 call disp%show("indexRFP")
469 call disp%show( indexRFP )
470 call disp%show("call setAsserted(all(indexRFP == [4, 2]))")
471 call setAsserted(all(indexRFP == [4, 2]))
472 call disp%show("jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, lowDia, shape(matRDP, IK) - 1_IK) ! revert")
473 jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, lowDia, shape(matRDP, IK) - 1_IK)
474 call disp%show("jndexRDP")
475 call disp%show( jndexRDP )
476 call disp%show("call setAsserted(all(jndexRDP == indexRDP))")
477 call setAsserted(all(jndexRDP == indexRDP))
478
479 call disp%skip()
480 call disp%show("indexRDP = [2, 2]")
481 indexRDP = [2, 2]
482 call disp%show("matRDP(indexRDP(1), indexRDP(2))")
483 call disp%show( matRDP(indexRDP(1), indexRDP(2)) , deliml = """" )
484 call disp%show("indexRFP = getMatIndex(rfpack, rdpack, indexRDP, lowDia, shape(matRDP, IK) - 1_IK)")
485 indexRFP = getMatIndex(rfpack, rdpack, indexRDP, lowDia, shape(matRDP, IK) - 1_IK)
486 call disp%show("indexRFP")
487 call disp%show( indexRFP )
488 call disp%show("call setAsserted(all(indexRFP == [3, 2]))")
489 call setAsserted(all(indexRFP == [3, 2]))
490 call disp%show("jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, lowDia, shape(matRDP, IK) - 1_IK) ! revert")
491 jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, lowDia, shape(matRDP, IK) - 1_IK)
492 call disp%show("jndexRDP")
493 call disp%show( jndexRDP )
494 call disp%show("call setAsserted(all(jndexRDP == indexRDP))")
495 call setAsserted(all(jndexRDP == indexRDP))
496
497 call disp%skip()
498 call disp%show("indexRDP = [4, 3]")
499 indexRDP = [4, 3]
500 call disp%show("matRDP(indexRDP(1), indexRDP(2))")
501 call disp%show( matRDP(indexRDP(1), indexRDP(2)) , deliml = """" )
502 call disp%show("indexRFP = getMatIndex(rfpack, rdpack, indexRDP, lowDia, shape(matRDP, IK) - 1_IK)")
503 indexRFP = getMatIndex(rfpack, rdpack, indexRDP, lowDia, shape(matRDP, IK) - 1_IK)
504 call disp%show("indexRFP")
505 call disp%show( indexRFP )
506 call disp%show("call setAsserted(all(indexRFP == [1, 2]))")
507 call setAsserted(all(indexRFP == [1, 2]))
508 call disp%show("jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, lowDia, shape(matRDP, IK) - 1_IK) ! revert")
509 jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, lowDia, shape(matRDP, IK) - 1_IK)
510 call disp%show("jndexRDP")
511 call disp%show( jndexRDP )
512 call disp%show("call setAsserted(all(jndexRDP == indexRDP))")
513 call setAsserted(all(jndexRDP == indexRDP))
514
515 call disp%skip()
516 call disp%show("indexRDP = [4, 4]")
517 indexRDP = [4, 4]
518 call disp%show("matRDP(indexRDP(1), indexRDP(2))")
519 call disp%show( matRDP(indexRDP(1), indexRDP(2)) , deliml = """" )
520 call disp%show("indexRFP = getMatIndex(rfpack, rdpack, indexRDP, lowDia, shape(matRDP, IK) - 1_IK)")
521 indexRFP = getMatIndex(rfpack, rdpack, indexRDP, lowDia, shape(matRDP, IK) - 1_IK)
522 call disp%show("indexRFP")
523 call disp%show( indexRFP )
524 call disp%show("call setAsserted(all(indexRFP == [2, 2]))")
525 call setAsserted(all(indexRFP == [2, 2]))
526 call disp%show("jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, lowDia, shape(matRDP, IK) - 1_IK) ! revert")
527 jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, lowDia, shape(matRDP, IK) - 1_IK)
528 call disp%show("jndexRDP")
529 call disp%show( jndexRDP )
530 call disp%show("call setAsserted(all(jndexRDP == indexRDP))")
531 call setAsserted(all(jndexRDP == indexRDP))
532
533end program example
Return a uniform random scalar or contiguous array of arbitrary rank of randomly uniformly distribute...
Verify the input assertion holds and if it does not, print the (optional) input message on stdout and...
Definition: pm_err.F90:735
Generate and return an object of type stop_type with the user-specified input attributes.
Definition: pm_err.F90:1618
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11508
Generate and return the conversion of the input value to an output Fortran string,...
Definition: pm_val2str.F90:167
This module contains classes and procedures for computing various statistical quantities related to t...
This module contains classes and procedures for reporting and handling errors.
Definition: pm_err.F90:52
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
This module contains the generic procedures for converting values of different types and kinds to For...
Definition: pm_val2str.F90:58
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! Upper triangle of an RDP matrix to LFP matrix.
4!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5
6
7matRDP
8"11", "12", "13", "14", "15"
9"21", "22", "23", "24", "25"
10"31", "32", "33", "34", "35"
11"41", "42", "43", "44", "45"
12"51", "52", "53", "54", "55"
13
14indexRDP = [2, 3]
15matRDP(indexRDP(1), indexRDP(2))
16"23"
17indexLFP = getMatIndex(lfpack, rdpack, indexRDP, uppDia, shape(matRDP, IK))
18indexLFP
19+5
20call setAsserted(indexLFP == 5_IK)
21jndexRDP = getMatIndex(rdpack, lfpack, indexLFP, uppDia, shape(matRDP, IK)) ! revert
22jndexRDP
23+2, +3
24call setAsserted(all(jndexRDP == indexRDP))
25
26indexRDP = [4, 2]; doff = -2
27matRDP(indexRDP(1), indexRDP(2))
28"42"
29indexLFP = getMatIndex(lfpack, rdpack, indexRDP, uppDia, shape(matRDP, IK), doff)
30indexLFP
31+7
32call setAsserted(indexLFP == 7_IK)
33jndexRDP = getMatIndex(rdpack, lfpack, indexLFP, uppDia, shape(matRDP, IK), doff) ! revert
34jndexRDP
35+4, +2
36call setAsserted(all(jndexRDP == indexRDP))
37
38indexRDP = [5, 4]; doff = -2
39matRDP(indexRDP(1), indexRDP(2))
40"54"
41indexLFP = getMatIndex(lfpack, rdpack, indexRDP, uppDia, shape(matRDP, IK), doff)
42indexLFP
43+17
44call setAsserted(indexLFP == 17_IK)
45jndexRDP = getMatIndex(rdpack, lfpack, indexLFP, uppDia, shape(matRDP, IK), doff) ! revert
46jndexRDP
47+5, +4
48call setAsserted(all(jndexRDP == indexRDP))
49
50indexRDP = [5, 5]; doff = -5
51matRDP(indexRDP(1), indexRDP(2))
52"55"
53indexLFP = getMatIndex(lfpack, rdpack, indexRDP, uppDia, shape(matRDP, IK), doff)
54indexLFP
55+25
56call setAsserted(indexLFP == 25_IK)
57jndexRDP = getMatIndex(rdpack, lfpack, indexLFP, uppDia, shape(matRDP, IK), doff) ! revert
58jndexRDP
59+5, +5
60call setAsserted(all(jndexRDP == indexRDP))
61
62!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
63! Lower triangle of a RDP matrix to LFP matrix.
64!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
65
66
67matRDP
68"11", "12", "13", "14", "15"
69"21", "22", "23", "24", "25"
70"31", "32", "33", "34", "35"
71"41", "42", "43", "44", "45"
72"51", "52", "53", "54", "55"
73
74indexRDP = [3, 2]
75matRDP(indexRDP(1), indexRDP(2))
76"32"
77indexLFP = getMatIndex(lfpack, rdpack, indexRDP, lowDia, shape(matRDP, IK))
78indexLFP
79+7
80call setAsserted(indexLFP == 7_IK)
81jndexRDP = getMatIndex(rdpack, lfpack, indexLFP, lowDia, shape(matRDP, IK)) ! revert
82jndexRDP
83+3, +2
84call setAsserted(all(jndexRDP == indexRDP))
85
86indexRDP = [2, 4]; doff = +2
87matRDP(indexRDP(1), indexRDP(2))
88"24"
89indexLFP = getMatIndex(lfpack, rdpack, indexRDP, lowDia, shape(matRDP, IK), doff) ! 16
90indexLFP
91+16
92call setAsserted(indexLFP == 16_IK)
93jndexRDP = getMatIndex(rdpack, lfpack, indexLFP, lowDia, shape(matRDP, IK), doff) ! revert
94jndexRDP
95+2, +4
96call setAsserted(all(jndexRDP == indexRDP))
97
98indexRDP = [4, 5]; doff = +2
99matRDP(indexRDP(1), indexRDP(2))
100"45"
101indexLFP = getMatIndex(lfpack, rdpack, indexRDP, lowDia, shape(matRDP, IK), doff) ! 21
102indexLFP
103+21
104call setAsserted(indexLFP == 21_IK)
105jndexRDP = getMatIndex(rdpack, lfpack, indexLFP, lowDia, shape(matRDP, IK), doff) ! revert
106jndexRDP
107+4, +5
108call setAsserted(all(jndexRDP == indexRDP))
109
110indexRDP = [5, 5]; doff = +5
111matRDP(indexRDP(1), indexRDP(2))
112"55"
113indexLFP = getMatIndex(lfpack, rdpack, indexRDP, lowDia, shape(matRDP, IK), doff)
114indexLFP
115+25
116call setAsserted(indexLFP == 25_IK)
117jndexRDP = getMatIndex(rdpack, lfpack, indexLFP, lowDia, shape(matRDP, IK), doff) ! revert
118jndexRDP
119+5, +5
120call setAsserted(all(jndexRDP == indexRDP))
121
122indexRDP = [4, 2]
123matRDP(indexRDP(1), indexRDP(2))
124"42"
125indexLFP = getMatIndex(lfpack, rdpack, indexRDP, lowDia, shape(matRDP, IK)) ! 8
126indexLFP
127+8
128call setAsserted(indexLFP == 8_IK)
129jndexRDP = getMatIndex(rdpack, lfpack, indexLFP, lowDia, shape(matRDP, IK)) ! revert
130jndexRDP
131+4, +2
132call setAsserted(all(jndexRDP == indexRDP))
133
134!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
135! Upper triangle of a RDP matrix to RFP matrix.
136!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
137
138
139matRDP
140"11", "12", "13", "14", "15"
141"21", "22", "23", "24", "25"
142"31", "32", "33", "34", "35"
143"41", "42", "43", "44", "45"
144"51", "52", "53", "54", "55"
145
146indexRDP = [2, 3];
147matRDP(indexRDP(1), indexRDP(2))
148"23"
149indexRFP = getMatIndex(rfpack, rdpack, indexRDP, uppDia, shape(matRDP, IK))
150indexRFP
151+2, +1
152call setAsserted(all(indexRFP == [2, 1]))
153jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, uppDia, shape(matRDP, IK)) ! revert
154jndexRDP
155+2, +3
156call setAsserted(all(jndexRDP == indexRDP))
157
158indexRDP = [1, 2]
159matRDP(indexRDP(1), indexRDP(2))
160"12"
161indexRFP = getMatIndex(rfpack, rdpack, indexRDP, uppDia, shape(matRDP, IK))
162indexRFP
163+5, +1
164call setAsserted(all(indexRFP == [5, 1]))
165jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, uppDia, shape(matRDP, IK)) ! revert
166jndexRDP
167+1, +2
168call setAsserted(all(jndexRDP == indexRDP))
169
170indexRDP = [4, 5]
171matRDP(indexRDP(1), indexRDP(2))
172"45"
173indexRFP = getMatIndex(rfpack, rdpack, indexRDP, uppDia, shape(matRDP, IK))
174indexRFP
175+4, +3
176call setAsserted(all(indexRFP == [4, 3]))
177jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, uppDia, shape(matRDP, IK)) ! revert
178jndexRDP
179+4, +5
180call setAsserted(all(jndexRDP == indexRDP))
181
182indexRDP = [5, 5]
183matRDP(indexRDP(1), indexRDP(2))
184"55"
185indexRFP = getMatIndex(rfpack, rdpack, indexRDP, uppDia, shape(matRDP, IK))
186indexRFP
187+5, +3
188call setAsserted(all(indexRFP == [5, 3]))
189jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, uppDia, shape(matRDP, IK)) ! revert
190jndexRDP
191+5, +5
192call setAsserted(all(jndexRDP == indexRDP))
193
194
195matRDP(1:4, 1:4)
196"11", "12", "13", "14"
197"21", "22", "23", "24"
198"31", "32", "33", "34"
199"41", "42", "43", "44"
200
201indexRDP = [2, 3]
202matRDP(indexRDP(1), indexRDP(2))
203"23"
204indexRFP = getMatIndex(rfpack, rdpack, indexRDP, uppDia, shape(matRDP, IK) - 1_IK)
205indexRFP
206+2, +1
207call setAsserted(all(indexRFP == [2, 1]))
208jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, uppDia, shape(matRDP, IK)) ! revert
209jndexRDP
210+2, +3
211call setAsserted(all(jndexRDP == indexRDP))
212
213indexRDP = [2, 2]
214matRDP(indexRDP(1), indexRDP(2))
215"22"
216indexRFP = getMatIndex(rfpack, rdpack, indexRDP, uppDia, shape(matRDP, IK) - 1_IK)
217indexRFP
218+5, +2
219call setAsserted(all(indexRFP == [5, 2]))
220jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, uppDia, shape(matRDP, IK)) ! revert
221jndexRDP
222+2, +2
223call setAsserted(all(jndexRDP == indexRDP))
224
225indexRDP = [3, 4]
226matRDP(indexRDP(1), indexRDP(2))
227"34"
228indexRFP = getMatIndex(rfpack, rdpack, indexRDP, uppDia, shape(matRDP, IK) - 1_IK)
229indexRFP
230+3, +2
231call setAsserted(all(indexRFP == [3, 2]))
232jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, uppDia, shape(matRDP, IK)) ! revert
233jndexRDP
234+3, +4
235call setAsserted(all(jndexRDP == indexRDP))
236
237indexRDP = [4, 4]
238matRDP(indexRDP(1), indexRDP(2))
239"44"
240indexRFP = getMatIndex(rfpack, rdpack, indexRDP, uppDia, shape(matRDP, IK) - 1_IK)
241indexRFP
242+4, +2
243call setAsserted(all(indexRFP == [4, 2]))
244jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, uppDia, shape(matRDP, IK)) ! revert
245jndexRDP
246+4, +4
247call setAsserted(all(jndexRDP == indexRDP))
248
249!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
250! Lower triangle of a RDP matrix to RFP matrix.
251!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
252
253
254matRDP
255"11", "12", "13", "14", "15"
256"21", "22", "23", "24", "25"
257"31", "32", "33", "34", "35"
258"41", "42", "43", "44", "45"
259"51", "52", "53", "54", "55"
260
261indexRDP = [3, 2]
262matRDP(indexRDP(1), indexRDP(2))
263"32"
264indexRFP = getMatIndex(rfpack, rdpack, indexRDP, lowDia, shape(matRDP, IK))
265indexRFP
266+3, +2
267call setAsserted(all(indexRFP == [3, 2]))
268jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, lowDia, shape(matRDP, IK)) ! revert
269jndexRDP
270+3, +2
271call setAsserted(all(jndexRDP == indexRDP))
272
273indexRDP = [2, 1]
274matRDP(indexRDP(1), indexRDP(2))
275"21"
276indexRFP = getMatIndex(rfpack, rdpack, indexRDP, lowDia, shape(matRDP, IK))
277indexRFP
278+2, +1
279call setAsserted(all(indexRFP == [2, 1]))
280jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, lowDia, shape(matRDP, IK)) ! revert
281jndexRDP
282+2, +1
283call setAsserted(all(jndexRDP == indexRDP))
284
285indexRDP = [5, 4]
286matRDP(indexRDP(1), indexRDP(2))
287"54"
288indexRFP = getMatIndex(rfpack, rdpack, indexRDP, lowDia, shape(matRDP, IK))
289indexRFP
290+1, +3
291call setAsserted(all(indexRFP == [1, 3]))
292jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, lowDia, shape(matRDP, IK)) ! revert
293jndexRDP
294+5, +4
295call setAsserted(all(jndexRDP == indexRDP))
296
297indexRDP = [5, 5]
298matRDP(indexRDP(1), indexRDP(2))
299"55"
300indexRFP = getMatIndex(rfpack, rdpack, indexRDP, lowDia, shape(matRDP, IK))
301indexRFP
302+2, +3
303call setAsserted(all(indexRFP == [2, 3]))
304jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, lowDia, shape(matRDP, IK)) ! revert
305jndexRDP
306+5, +5
307call setAsserted(all(jndexRDP == indexRDP))
308
309
310matRDP(1:4, 1:4)
311"11", "12", "13", "14"
312"21", "22", "23", "24"
313"31", "32", "33", "34"
314"41", "42", "43", "44"
315
316indexRDP = [3, 2]
317matRDP(indexRDP(1), indexRDP(2))
318"32"
319indexRFP = getMatIndex(rfpack, rdpack, indexRDP, lowDia, shape(matRDP, IK) - 1_IK)
320indexRFP
321+4, +2
322call setAsserted(all(indexRFP == [4, 2]))
323jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, lowDia, shape(matRDP, IK) - 1_IK) ! revert
324jndexRDP
325+3, +2
326call setAsserted(all(jndexRDP == indexRDP))
327
328indexRDP = [2, 2]
329matRDP(indexRDP(1), indexRDP(2))
330"22"
331indexRFP = getMatIndex(rfpack, rdpack, indexRDP, lowDia, shape(matRDP, IK) - 1_IK)
332indexRFP
333+3, +2
334call setAsserted(all(indexRFP == [3, 2]))
335jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, lowDia, shape(matRDP, IK) - 1_IK) ! revert
336jndexRDP
337+2, +2
338call setAsserted(all(jndexRDP == indexRDP))
339
340indexRDP = [4, 3]
341matRDP(indexRDP(1), indexRDP(2))
342"43"
343indexRFP = getMatIndex(rfpack, rdpack, indexRDP, lowDia, shape(matRDP, IK) - 1_IK)
344indexRFP
345+1, +2
346call setAsserted(all(indexRFP == [1, 2]))
347jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, lowDia, shape(matRDP, IK) - 1_IK) ! revert
348jndexRDP
349+4, +3
350call setAsserted(all(jndexRDP == indexRDP))
351
352indexRDP = [4, 4]
353matRDP(indexRDP(1), indexRDP(2))
354"44"
355indexRFP = getMatIndex(rfpack, rdpack, indexRDP, lowDia, shape(matRDP, IK) - 1_IK)
356indexRFP
357+2, +2
358call setAsserted(all(indexRFP == [2, 2]))
359jndexRDP = getMatIndex(rdpack, rfpack, indexRFP, lowDia, shape(matRDP, IK) - 1_IK) ! revert
360jndexRDP
361+4, +4
362call setAsserted(all(jndexRDP == indexRDP))
363
Test:
test_pm_matrixIndex
Todo:
High Priority: This generic interface should be extended to convert indices of matrices from Rectangular Standard Packing to Rectangular Band Packing and vice versa.
Todo:
Normal Priority: The implementation of the procedures for converting indices from LFP to RDP could be likely improved for better performance.


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 23, 2017, 1:36 AM, Institute for Computational Engineering and Sciences (ICES), University of Texas at Austin

Definition at line 171 of file pm_matrixIndex.F90.


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