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

Copy an input scalar string or vector of arbitrary intrinsic type, kind, and size to another scalar string or vector of the same type, kind, and compatible size.
More...

Detailed Description

Copy an input scalar string or vector of arbitrary intrinsic type, kind, and size to another scalar string or vector of the same type, kind, and compatible size.

The functionality of this interface is readily available from the standard Fortran array syntax for all Fortran intrinsic type arrays.
However, it is impossible to perform elemental copy action for scalar strings.
This interface provides a universal generic approach to performing copy all vectors of intrinsic type and and kind as well as scalar strings, allowing seamless generic programming.

Parameters
[in]From: The input
  • scalar of type character of kind any supported by the processor (e.g., SK, SKA, SKD , or SKU) of arbitrary length type parameter,
or contiguous array of rank 1 of either,
  • type character of kind any supported by the processor (e.g., SK, SKA, SKD , or SKU) of arbitrary length type parameter or,
  • type integer of kind any supported by the processor (e.g., IK, IK8, IK16, IK32, or IK64) or,
  • type logical of kind any supported by the processor (e.g., LK) or,
  • type complex of kind any supported by the processor (e.g., CK, CK32, CK64, or CK128) or,
  • type real of kind any supported by the processor (e.g., RK, RK32, RK64, or RK128),
whose specified elements will be copied to the array to.
[in,out]To: The input/output scalar or contiguous array of the same type, kind, rank, and compatible size as the input From.
On output, the specific requested elements of To will be replaced by the requested corresponding values from From.
The remaining elements of To are returned as is.
[in]indexF: The input array of rank 1 of type integer of default kind IK, of the same size as indexT, containing the indices of the elements of the input vector From for which copy action must be performed.
By definition, the condition all(1_IK <= indexF) .and. all(indexF <= size(From)) must hold.
[in]indexT: The input array of rank 1 of type integer of default kind IK, of the same size as indexF, containing the indices of the elements of the input/output vector To for which copy action must be performed.
By definition, the condition all(1_IK <= indexT) .and. all(indexT <= size(To)) must hold.


Possible calling interfaces

call setCopyIndexed(From, To, indexF, indexT)
Copy an input scalar string or vector of arbitrary intrinsic type, kind, and size to another scalar s...
This module contains procedures and generic interfaces for copying strided or indexed elements of one...
Warning
The condition len(From) == len(To) must hold for the corresponding scalar arguments.
The condition size(From) == size(To) must hold for the corresponding vector arguments.
The conditions all(1_IK <= indexT) .and. all(indexT <= size(To)) must hold for the corresponding input arguments.
The conditions all(1_IK <= indexF) .and. all(indexF <= size(From)) 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
pm_matrixCopy
pm_matrixInit
pm_arrayCopy
pm_arrayCopy


Example usage

1#define SET_COPY \
2call disp%show("indexF"); \
3call disp%show( indexF ); \
4call disp%show("indexT"); \
5call disp%show( indexT ); \
6call disp%show("From"); \
7call disp%show( From ); \
8call disp%show("To"); \
9call disp%show( To ); \
10call disp%show("call setCopyIndexed(From, To, indexF, indexT)"); \
11 call setCopyIndexed(From, To, indexF, indexT); \
12call disp%show("From"); \
13call disp%show( From ); \
14call disp%show("To"); \
15call disp%show( To );
16
17program example
18
19 use pm_kind, only: SK, IK, LK
20 use pm_io, only: display_type
22 use pm_distUnif, only: getUnifRand
24 use pm_arrayRange, only: getRange
25
26 implicit none
27
28 integer(IK), allocatable :: i, indexF(:), indexT(:)
29
30 type(display_type) :: disp
31 disp = display_type(file = "main.out.F90")
32
33 call disp%skip()
34 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
35 call disp%show("!Copy a string of characters of arbitrary kind in arbitrary orders.")
36 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
37 call disp%skip()
38
39 block
40
41 use pm_strASCII, only: ALPHA_STR_SK
44
45 character(:, SK), allocatable :: From, To
46
47 call disp%skip()
48 call disp%show("From = ALPHA_UPPER_STR_SK")
50 call disp%show("To = ALPHA_LOWER_STR_SK")
52 call disp%show("indexF = getRange(1, len(From)); indexT = getRange(len(To), 1, -1)")
53 indexF = getRange(1, len(From)); indexT = getRange(len(To), 1, -1)
54 SET_COPY ! fpp
55 call disp%skip()
56
57 call disp%skip()
58 call disp%show("From = ALPHA_UPPER_STR_SK")
60 call disp%show("To = ALPHA_LOWER_STR_SK")
62 call disp%show("indexF = getRange(1, len(From), 2); indexT = getRange(len(To), 1, -2)")
63 indexF = getRange(1, len(From), 2); indexT = getRange(len(To), 1, -2)
64 SET_COPY ! fpp
65 call disp%skip()
66
67 call disp%skip()
68 call disp%show("From = ALPHA_UPPER_STR_SK")
70 call disp%show("To = ALPHA_LOWER_STR_SK")
72 call disp%show("indexF = getRange(1, len(From), 2); indexT = getRange(len(To), 1, -2)")
73 indexF = getRange(1, len(From), 2); indexT = getRange(len(To), 1, -2)
74 SET_COPY ! fpp
75 call disp%skip()
76
77 call disp%skip()
78 call disp%show("From = ALPHA_STR_SK")
79 From = ALPHA_STR_SK
80 call disp%show("To = ALPHA_LOWER_STR_SK")
82 call disp%show("indexF = getRange(1, len(From), 4); indexT = getRange(1, len(To), 2)")
83 indexF = getRange(1, len(From), 4); indexT = getRange(1, len(To), 2)
84 SET_COPY ! fpp
85 call disp%skip()
86
87 end block
88
89 call disp%skip()
90 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
91 call disp%show("!Copy array of strings of the same length of arbitrary kind in arbitrary order.")
92 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
93 call disp%skip()
94
95 block
96
97 use pm_strASCII, only: ALPHA_VEC_SK
100
101 character(1, SK), allocatable :: From(:), To(:)
102
103 call disp%skip()
104 call disp%show("From = ALPHA_UPPER_VEC_SK")
105 From = ALPHA_UPPER_VEC_SK
106 call disp%show("To = ALPHA_LOWER_VEC_SK")
108 call disp%show("indexF = getRange(1, size(From), 2); indexT = getRange(size(To), 1, -2)")
109 indexF = getRange(1, size(From), 2); indexT = getRange(size(To), 1, -2)
110 SET_COPY ! fpp
111 call disp%skip()
112
113 call disp%skip()
114 call disp%show("From = ALPHA_LOWER_VEC_SK")
115 From = ALPHA_LOWER_VEC_SK
116 call disp%show("To = ALPHA_LOWER_VEC_SK")
118 call disp%show("indexF = getRange(1, size(From), 2); indexT = getRange(size(To), 1, -2)")
119 indexF = getRange(1, size(From), 2); indexT = getRange(size(To), 1, -2)
120 SET_COPY ! fpp
121 call disp%skip()
122
123 call disp%skip()
124 call disp%show("From = ALPHA_VEC_SK")
125 From = ALPHA_VEC_SK
126 call disp%show("To = ALPHA_LOWER_VEC_SK")
128 call disp%show("indexF = getRange(1, size(From), 4); indexT = getRange(1, size(To), 2)")
129 indexF = getRange(1, size(From), 4); indexT = getRange(1, size(To), 2)
130 SET_COPY ! fpp
131 call disp%skip()
132
133 end block
134
135 call disp%skip()
136 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
137 call disp%show("!Copy array of integer values of arbitrary kind in arbitrary orders.")
138 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
139 call disp%skip()
140
141 block
142
143 integer, allocatable :: From(:), To(:)
144
145 call disp%skip()
146 call disp%show("From = [1, 2, 3, 4, 5]")
147 From = [1, 2, 3, 4, 5]
148 call disp%show("To = [(huge(0), i = 1, 9)]")
149 To = [(huge(0), i = 1, 9)]
150 call disp%show("indexF = getRange(1, size(From)); indexT = getRange(1, size(To), 2)")
151 indexF = getRange(1, size(From)); indexT = getRange(1, size(To), 2)
152 SET_COPY ! fpp
153 call disp%skip()
154
155 call disp%skip()
156 call disp%show("From = [1, 2, 3, 4, 5]")
157 From = [1, 2, 3, 4, 5]
158 call disp%show("To = [(huge(0), i = 1, 9)]")
159 To = [(huge(0), i = 1, 9)]
160 call disp%show("indexF = getRange(1, size(From)); indexT = getRange(size(To), 1, -2)")
161 indexF = getRange(1, size(From)); indexT = getRange(size(To), 1, -2)
162 SET_COPY ! fpp
163 call disp%skip()
164
165 end block
166
167 call disp%skip()
168 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
169 call disp%show("!Copy array of logical values of arbitrary kind in arbitrary orders.")
170 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
171 call disp%skip()
172
173 block
174
175 logical, allocatable :: From(:), To(:)
176
177 call disp%skip()
178 call disp%show("From = [.true., .true., .true., .true., .true.]")
179 From = [.true., .true., .true., .true., .true.]
180 call disp%show("To = [(.false., i = 1, 9)]")
181 To = [(.false., i = 1, 9)]
182 call disp%show("indexF = getRange(1, size(From)); indexT = getRange(1, size(To), 2)")
183 indexF = getRange(1, size(From)); indexT = getRange(1, size(To), 2)
184 SET_COPY ! fpp
185 call disp%skip()
186
187 end block
188
189 call disp%skip()
190 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
191 call disp%show("!Copy array of complex values of arbitrary kind in arbitrary orders.")
192 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
193 call disp%skip()
194
195 block
196
197 real, allocatable :: From(:), To(:)
198
199 call disp%skip()
200 call disp%show("From = cmplx([1, 2, 3, 4, 5], -[1, 2, 3, 4, 5])")
201 From = cmplx([1, 2, 3, 4, 5], -[1, 2, 3, 4, 5])
202 call disp%show("To = cmplx([(huge(0), i = 1, 9)], -[(huge(0), i = 1, 9)])")
203 To = cmplx([(huge(0), i = 1, 9)], -[(huge(0), i = 1, 9)])
204 call disp%show("indexF = getRange(1, size(From)); indexT = getRange(1, size(To), 2)")
205 indexF = getRange(1, size(From)); indexT = getRange(1, size(To), 2)
206 SET_COPY ! fpp
207 call disp%skip()
208
209 call disp%skip()
210 call disp%show("From = cmplx([1, 2, 3, 4, 5], -[1, 2, 3, 4, 5])")
211 From = cmplx([1, 2, 3, 4, 5], -[1, 2, 3, 4, 5])
212 call disp%show("To = cmplx([(huge(0), i = 1, 9)], -[(huge(0), i = 1, 9)])")
213 To = cmplx([(huge(0), i = 1, 9)], -[(huge(0), i = 1, 9)])
214 call disp%show("indexF = getRange(1, size(From)); indexT = getRange(size(To), 1, -2)")
215 indexF = getRange(1, size(From)); indexT = getRange(size(To), 1, -2)
216 SET_COPY ! fpp
217 call disp%skip()
218
219 end block
220
221 call disp%skip()
222 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
223 call disp%show("!Copy array of real values of arbitrary kind in arbitrary orders.")
224 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
225 call disp%skip()
226
227 block
228
229 real, allocatable :: From(:), To(:)
230
231 call disp%skip()
232 call disp%show("From = [1, 2, 3, 4, 5]")
233 From = [1, 2, 3, 4, 5]
234 call disp%show("To = [(huge(0), i = 1, 9)]")
235 To = [(huge(0), i = 1, 9)]
236 call disp%show("indexF = getRange(1, size(From)); indexT = getRange(1, size(To), 2)")
237 indexF = getRange(1, size(From)); indexT = getRange(1, size(To), 2)
238 SET_COPY ! fpp
239 call disp%skip()
240
241 call disp%skip()
242 call disp%show("From = [1, 2, 3, 4, 5]")
243 From = [1, 2, 3, 4, 5]
244 call disp%show("To = [(huge(0), i = 1, 9)]")
245 To = [(huge(0), i = 1, 9)]
246 call disp%show("indexF = getRange(1, size(From)); indexT = getRange(size(To), 1, -2)")
247 indexF = getRange(1, size(From)); indexT = getRange(size(To), 1, -2)
248 SET_COPY ! fpp
249 call disp%skip()
250
251 end block
252
253end program example
Generate minimally-spaced character, integer, real sequences or sequences at fixed intervals of size ...
Generate and return an output array whose elements are the reversed-order elements of the input array...
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
This module contains procedures and generic interfaces for generating ranges of discrete character,...
This module contains procedures and generic interfaces for reversing the order of elements in arrays ...
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 LK
The default logical kind in the ParaMonte library: kind(.true.) in Fortran, kind(....
Definition: pm_kind.F90:541
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 uncommon and hardly representable ASCII characters as well as procedures for...
Definition: pm_strASCII.F90:61
character(*, SK), parameter ALPHA_UPPER_STR_SK
The constant scalar of type character of default kind SK containing the ASCII uppercase English lette...
character(*, SK), parameter ALPHA_STR_SK
The constant scalar of type character of default kind SK containing the ASCII uppercase and lowercase...
character(1, SK), dimension(*), parameter ALPHA_UPPER_VEC_SK
The constant array of type character of default kind SK containing the uppercase English letters.
character(1, SK), dimension(*), parameter ALPHA_LOWER_VEC_SK
The constant array of type character of default kind SK containing the lowercase English letters.
character(*, SK), parameter ALPHA_LOWER_STR_SK
The constant scalar of type character of default kind SK containing the ASCII lowercase English lette...
character(1, SK), dimension(*), parameter ALPHA_VEC_SK
The constant array of type character of default kind SK containing the ASCII uppercase and lowercase ...
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!Copy a string of characters of arbitrary kind in arbitrary orders.
4!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5
6
9indexF = getRange(1, len(From)); indexT = getRange(len(To), 1, -1)
10indexF
11+1, +2, +3, +4, +5, +6, +7, +8, +9, +10, +11, +12, +13, +14, +15, +16, +17, +18, +19, +20, +21, +22, +23, +24, +25, +26
12indexT
13+26, +25, +24, +23, +22, +21, +20, +19, +18, +17, +16, +15, +14, +13, +12, +11, +10, +9, +8, +7, +6, +5, +4, +3, +2, +1
14From
15ABCDEFGHIJKLMNOPQRSTUVWXYZ
16To
17abcdefghijklmnopqrstuvwxyz
18call setCopyIndexed(From, To, indexF, indexT)
19From
20ABCDEFGHIJKLMNOPQRSTUVWXYZ
21To
22ZYXWVUTSRQPONMLKJIHGFEDCBA
23
24
27indexF = getRange(1, len(From), 2); indexT = getRange(len(To), 1, -2)
28indexF
29+1, +3, +5, +7, +9, +11, +13, +15, +17, +19, +21, +23, +25
30indexT
31+26, +24, +22, +20, +18, +16, +14, +12, +10, +8, +6, +4, +2
32From
33ABCDEFGHIJKLMNOPQRSTUVWXYZ
34To
35abcdefghijklmnopqrstuvwxyz
36call setCopyIndexed(From, To, indexF, indexT)
37From
38ABCDEFGHIJKLMNOPQRSTUVWXYZ
39To
40aYcWeUgSiQkOmMoKqIsGuEwCyA
41
42
45indexF = getRange(1, len(From), 2); indexT = getRange(len(To), 1, -2)
46indexF
47+1, +3, +5, +7, +9, +11, +13, +15, +17, +19, +21, +23, +25
48indexT
49+26, +24, +22, +20, +18, +16, +14, +12, +10, +8, +6, +4, +2
50From
51ABCDEFGHIJKLMNOPQRSTUVWXYZ
52To
53abcdefghijklmnopqrstuvwxyz
54call setCopyIndexed(From, To, indexF, indexT)
55From
56ABCDEFGHIJKLMNOPQRSTUVWXYZ
57To
58aYcWeUgSiQkOmMoKqIsGuEwCyA
59
60
61From = ALPHA_STR_SK
63indexF = getRange(1, len(From), 4); indexT = getRange(1, len(To), 2)
64indexF
65+1, +5, +9, +13, +17, +21, +25, +29, +33, +37, +41, +45, +49
66indexT
67+1, +3, +5, +7, +9, +11, +13, +15, +17, +19, +21, +23, +25
68From
69ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
70To
71abcdefghijklmnopqrstuvwxyz
72call setCopyIndexed(From, To, indexF, indexT)
73From
74ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
75To
76AbEdIfMhQjUlYncpgrktovsxwz
77
78
79!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
80!Copy array of strings of the same length of arbitrary kind in arbitrary order.
81!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
82
83
86indexF = getRange(1, size(From), 2); indexT = getRange(size(To), 1, -2)
87indexF
88+1, +3, +5, +7, +9, +11, +13, +15, +17, +19, +21, +23, +25
89indexT
90+26, +24, +22, +20, +18, +16, +14, +12, +10, +8, +6, +4, +2
91From
92A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z
93To
94a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z
95call setCopyIndexed(From, To, indexF, indexT)
96From
97A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z
98To
99a, Y, c, W, e, U, g, S, i, Q, k, O, m, M, o, K, q, I, s, G, u, E, w, C, y, A
100
101
104indexF = getRange(1, size(From), 2); indexT = getRange(size(To), 1, -2)
105indexF
106+1, +3, +5, +7, +9, +11, +13, +15, +17, +19, +21, +23, +25
107indexT
108+26, +24, +22, +20, +18, +16, +14, +12, +10, +8, +6, +4, +2
109From
110a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z
111To
112a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z
113call setCopyIndexed(From, To, indexF, indexT)
114From
115a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z
116To
117a, y, c, w, e, u, g, s, i, q, k, o, m, m, o, k, q, i, s, g, u, e, w, c, y, a
118
119
120From = ALPHA_VEC_SK
122indexF = getRange(1, size(From), 4); indexT = getRange(1, size(To), 2)
123indexF
124+1, +5, +9, +13, +17, +21, +25, +29, +33, +37, +41, +45, +49
125indexT
126+1, +3, +5, +7, +9, +11, +13, +15, +17, +19, +21, +23, +25
127From
128A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z
129To
130a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z
131call setCopyIndexed(From, To, indexF, indexT)
132From
133A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z
134To
135A, b, E, d, I, f, M, h, Q, j, U, l, Y, n, c, p, g, r, k, t, o, v, s, x, w, z
136
137
138!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
139!Copy array of integer values of arbitrary kind in arbitrary orders.
140!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
141
142
143From = [1, 2, 3, 4, 5]
144To = [(huge(0), i = 1, 9)]
145indexF = getRange(1, size(From)); indexT = getRange(1, size(To), 2)
146indexF
147+1, +2, +3, +4, +5
148indexT
149+1, +3, +5, +7, +9
150From
151+1, +2, +3, +4, +5
152To
153+2147483647, +2147483647, +2147483647, +2147483647, +2147483647, +2147483647, +2147483647, +2147483647, +2147483647
154call setCopyIndexed(From, To, indexF, indexT)
155From
156+1, +2, +3, +4, +5
157To
158+1, +2147483647, +2, +2147483647, +3, +2147483647, +4, +2147483647, +5
159
160
161From = [1, 2, 3, 4, 5]
162To = [(huge(0), i = 1, 9)]
163indexF = getRange(1, size(From)); indexT = getRange(size(To), 1, -2)
164indexF
165+1, +2, +3, +4, +5
166indexT
167+9, +7, +5, +3, +1
168From
169+1, +2, +3, +4, +5
170To
171+2147483647, +2147483647, +2147483647, +2147483647, +2147483647, +2147483647, +2147483647, +2147483647, +2147483647
172call setCopyIndexed(From, To, indexF, indexT)
173From
174+1, +2, +3, +4, +5
175To
176+5, +2147483647, +4, +2147483647, +3, +2147483647, +2, +2147483647, +1
177
178
179!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
180!Copy array of logical values of arbitrary kind in arbitrary orders.
181!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
182
183
184From = [.true., .true., .true., .true., .true.]
185To = [(.false., i = 1, 9)]
186indexF = getRange(1, size(From)); indexT = getRange(1, size(To), 2)
187indexF
188+1, +2, +3, +4, +5
189indexT
190+1, +3, +5, +7, +9
191From
192T, T, T, T, T
193To
194F, F, F, F, F, F, F, F, F
195call setCopyIndexed(From, To, indexF, indexT)
196From
197T, T, T, T, T
198To
199T, F, T, F, T, F, T, F, T
200
201
202!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
203!Copy array of complex values of arbitrary kind in arbitrary orders.
204!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
205
206
207From = cmplx([1, 2, 3, 4, 5], -[1, 2, 3, 4, 5])
208To = cmplx([(huge(0), i = 1, 9)], -[(huge(0), i = 1, 9)])
209indexF = getRange(1, size(From)); indexT = getRange(1, size(To), 2)
210indexF
211+1, +2, +3, +4, +5
212indexT
213+1, +3, +5, +7, +9
214From
215+1.00000000, +2.00000000, +3.00000000, +4.00000000, +5.00000000
216To
217+0.214748365E+10, +0.214748365E+10, +0.214748365E+10, +0.214748365E+10, +0.214748365E+10, +0.214748365E+10, +0.214748365E+10, +0.214748365E+10, +0.214748365E+10
218call setCopyIndexed(From, To, indexF, indexT)
219From
220+1.00000000, +2.00000000, +3.00000000, +4.00000000, +5.00000000
221To
222+1.00000000, +0.214748365E+10, +2.00000000, +0.214748365E+10, +3.00000000, +0.214748365E+10, +4.00000000, +0.214748365E+10, +5.00000000
223
224
225From = cmplx([1, 2, 3, 4, 5], -[1, 2, 3, 4, 5])
226To = cmplx([(huge(0), i = 1, 9)], -[(huge(0), i = 1, 9)])
227indexF = getRange(1, size(From)); indexT = getRange(size(To), 1, -2)
228indexF
229+1, +2, +3, +4, +5
230indexT
231+9, +7, +5, +3, +1
232From
233+1.00000000, +2.00000000, +3.00000000, +4.00000000, +5.00000000
234To
235+0.214748365E+10, +0.214748365E+10, +0.214748365E+10, +0.214748365E+10, +0.214748365E+10, +0.214748365E+10, +0.214748365E+10, +0.214748365E+10, +0.214748365E+10
236call setCopyIndexed(From, To, indexF, indexT)
237From
238+1.00000000, +2.00000000, +3.00000000, +4.00000000, +5.00000000
239To
240+5.00000000, +0.214748365E+10, +4.00000000, +0.214748365E+10, +3.00000000, +0.214748365E+10, +2.00000000, +0.214748365E+10, +1.00000000
241
242
243!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
244!Copy array of real values of arbitrary kind in arbitrary orders.
245!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
246
247
248From = [1, 2, 3, 4, 5]
249To = [(huge(0), i = 1, 9)]
250indexF = getRange(1, size(From)); indexT = getRange(1, size(To), 2)
251indexF
252+1, +2, +3, +4, +5
253indexT
254+1, +3, +5, +7, +9
255From
256+1.00000000, +2.00000000, +3.00000000, +4.00000000, +5.00000000
257To
258+0.214748365E+10, +0.214748365E+10, +0.214748365E+10, +0.214748365E+10, +0.214748365E+10, +0.214748365E+10, +0.214748365E+10, +0.214748365E+10, +0.214748365E+10
259call setCopyIndexed(From, To, indexF, indexT)
260From
261+1.00000000, +2.00000000, +3.00000000, +4.00000000, +5.00000000
262To
263+1.00000000, +0.214748365E+10, +2.00000000, +0.214748365E+10, +3.00000000, +0.214748365E+10, +4.00000000, +0.214748365E+10, +5.00000000
264
265
266From = [1, 2, 3, 4, 5]
267To = [(huge(0), i = 1, 9)]
268indexF = getRange(1, size(From)); indexT = getRange(size(To), 1, -2)
269indexF
270+1, +2, +3, +4, +5
271indexT
272+9, +7, +5, +3, +1
273From
274+1.00000000, +2.00000000, +3.00000000, +4.00000000, +5.00000000
275To
276+0.214748365E+10, +0.214748365E+10, +0.214748365E+10, +0.214748365E+10, +0.214748365E+10, +0.214748365E+10, +0.214748365E+10, +0.214748365E+10, +0.214748365E+10
277call setCopyIndexed(From, To, indexF, indexT)
278From
279+1.00000000, +2.00000000, +3.00000000, +4.00000000, +5.00000000
280To
281+5.00000000, +0.214748365E+10, +4.00000000, +0.214748365E+10, +3.00000000, +0.214748365E+10, +2.00000000, +0.214748365E+10, +1.00000000
282
283
Test:
test_pm_arrayCopy


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 120 of file pm_arrayCopy.F90.


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