178 – TRANSPOSE
TRANSPOSE (matrix) Class: Transformational function - Generic Transposes an array of rank two (can be any data type). The result is a rank-two array with the same type and kind type parameters as "matrix". Its shape is (n, m), where (m, n) is the shape of "matrix". For example, if the shape of "matrix" is (4,6), the shape of the result is (6,4). Element (i, j) of the result has the value matrix(j, i), where "i" is in the range 1 to n, and "j" is in the range 1 to m. Examples: Consider that B is the array: |2 3 4| |5 6 7|. |8 9 1| TRANSPOSE (B) has the value |2 5 8| |3 6 9|. |4 7 1|
179 – TRIM
TRIM (string)
Class: Transformational function - Generic
Returns the argument with trailing blanks removed.
The "string" is a scalar of type character. The result is of type
character with the same kind type parameter as "string". Its
length is the length of "string" minus the number of trailing
blanks in "string".
The value of the result is the same as "string", except any
trailing blanks are removed. If "string" contains only blank
characters, the result has zero length.
Examples:
TRIM (' NAME ') has the value ' NAME'.
TRIM (' C D ') has the value ' C D'.
180 – UBOUND
UBOUND (array [,dim] [,kind]) Class: Inquiry function - Generic Returns the upper bounds for all dimensions of an array, or the upper bound for a specified dimension. The "array" cannot be an allocatable array that is not allocated, or a disassociated pointer. The "dim" is a scalar integer with a value in the range 1 to n, where "n" is the rank of "array". The "kind" must be a scalar integer initialization expression. The result is of type integer. If "kind" is present, the kind parameter of the result is that specified by "kind"; otherwise, the kind parameter of the result is that of default integer. If the processor cannot represent the result value in the kind of the result, the result is undefined. If "dim" is present, the result is a scalar. Otherwise, the result is a rank-one array with one element for each dimension of "array". Each element in the result corresponds to a dimension of "array". If "array" is an array section or an array expression that is not a whole array or array structure component, UBOUND (array,dim) has a value equal to the number of elements in the given dimension. The setting of compiler options that specify integer size can affect the result of this function. Examples: Consider the following: REAL ARRAY_A (1:3, 5:8) REAL ARRAY_B (2:8, -3:20) UBOUND (ARRAY_A) is (3, 8). UBOUND (ARRAY_A, DIM=2) is 8. UBOUND (ARRAY_B) is (8, 20). UBOUND (ARRAY_B (5:8, :)) is (4,24) because the number of elements is significant for array section arguments.
181 – UNPACK
UNPACK (vector, mask, field)
Class: Transformational function - Generic
Takes elements from a rank-one array and unpacks them into another
(possibly larger) array under the control of a mask.
The "vector" must be a rank-one array of any type. Its size must
be at least t, where "t" is the number of true elements in "mask".
The "mask" must be of logical type; it determines where elements of
"vector" are placed when they are unpacked.
The "field" must be of the same type and type parameters as
"vector" and conformable with "mask". Elements in "field" are
inserted into the result array when the corresponding "mask"
element has the value false.
The result is an array with the same shape as "mask", and the same
type and type parameters as "vector".
Elements in the result array are filled in array element order. If
element i of the result is true, the corresponding element of the
result is filled by the next element in "vector".
Examples:
Consider that N is the array |0 0 1|, P is the array (2, 3, 4, 5),
|1 0 1|
|1 0 0|
and Q is the array |T F F|
|F T F|.
|T T F|
UNPACK (P, MASK=Q, FIELD=N) produces the result
|2 0 1|
|1 4 1|.
|3 5 0|
UNPACK (P, MASK=Q, FIELD=1) produces the result
|2 1 1|
|1 4 1|.
|3 5 1|
182 – VERIFY
VERIFY (string, set [,back] [,kind])
Class: Elemental function - Generic
Verifies that a set of characters contains all the characters in a
string by identifying the first character in the string that is not
in the set.
The "set" must be of type character with the same kind type
parameter as "string". The "back" must be of type logical. The
"kind" must be a scalar integer initialization expression.
The result is of type integer. If "kind" is present, the kind
parameter of the result is that specified by "kind"; otherwise, the
kind parameter of the result is that of default integer. If the
processor cannot represent the result value in the kind of the
result, the result is undefined.
If "back" is absent (or is present with the value false) and
"string" has at least one character that is not in "set", the value
of the result is the position of the leftmost character of "string"
that is not in "set".
If "back" is present with the value true and "string" has at least
one character that is not in "set", the value of the result is the
position of the rightmost character of "string" that is not in
"set".
If each character of "string" is in "set" or the length of "string"
is zero, the value of the result is zero.
Examples:
VERIFY ('CDDDC', 'C') has the value 2.
VERIFY ('CDDDC', 'C', BACK=.TRUE.) has the value 4.
VERIFY ('CDDDC', 'CD') has the value zero.
183 – ZEXT
ZEXT (integer [,kind]) Class: Elemental function - Generic Returns the value of the argument, zero extended. The "kind" must be a scalar integer initialization expression. The result is of type integer. If "kind" is present, the kind parameter of the result is that specified by "kind"; otherwise, the kind parameter of the result is that of default integer. If the processor cannot represent the result value in the kind of the result, the result is undefined. +------+----------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+----------+----------+------------+-------------+ | 1 | ZEXT | IZEXT | LOGICAL*1 | INTEGER*2 | | | | -- | LOGICAL*2 | INTEGER*2 | | | | -- | INTEGER*1 | INTEGER*2 | | | | -- | INTEGER*2 | INTEGER*2 | | | | JZEXT | LOGICAL*1 | INTEGER*4 | | | | -- | LOGICAL*2 | INTEGER*4 | | | | -- | LOGICAL*4 | INTEGER*4 | | | | -- | INTEGER*1 | INTEGER*4 | | | | -- | INTEGER*2 | INTEGER*4 | | | | -- | INTEGER*4 | INTEGER*4 | | | | KZEXT | LOGICAL*1 | INTEGER*8 | | | | -- | LOGICAL*2 | INTEGER*8 | | | | -- | LOGICAL*4 | INTEGER*8 | | | | -- | LOGICAL*8 | INTEGER*8 | | | | -- | INTEGER*1 | INTEGER*8 | | | | -- | INTEGER*2 | INTEGER*8 | | | | -- | INTEGER*4 | INTEGER*8 | | | | -- | INTEGER*8 | INTEGER*8 | +------+----------+----------+------------+-------------+ The setting of compiler options specifying integer size can affect ZEXT.