EOSHIFT (array, shift [,boundary] [,dim])
Class: Transformational function - Generic
Performs an end-off shift on a rank-one array, or performs end-off
shifts on all the complete rank-one sections along a given
dimension of an array of rank two or greater.
Elements are shifted off at one end of a section and copies of a
boundary value are filled in at the other end. Different sections
can have different boundary values and can be shifted by different
amounts and in different directions.
The "array" can be of any type.
The "shift" can be a scalar integer or an array with a rank that is
one less than "array", and shape (d1, d2,..., d"dim"-1,
d"dim"+1,..., dn), where (d1, d2,..., dn) is the shape of "array".
The "boundary" must be of the same type and kind type parameter as
"array". It can be a scalar or an array with a shape that is one
less than that of "array" and shape (d1, d2,..., d"dim"-1,
d"dim"+1,..., dn). If "boundary is omitted, it is assumed to have
the following values:
"array" type "boundary" value
------------ ----------------
integer 0
real 0.0
complex (0.0, 0.0)
logical false
character (len) "len" blanks
The "dim" must be a scalar integer with a value in the range 1 to
n, where "n" is the rank of "array". If omitted, it is assumed to
be 1.
The result is an array with the same type, kind type parameter, and
shape as "array"
The value of "shift" determines the amount and direction of the
end-off shift. A positive integer causes a shift to the left (in
rows) or up (in columns). If an element is shifted off the
beginning of a vector, the "boundary" value is placed at the end of
the vector.
A negative integer causes a shift to the right (in rows) or down
(in columns). If an element is shifted off the end of a vector,
the "boundary" value is placed at the beginning of the vector.
Examples:
Consider that V is the array (1, 2, 3, 4, 5, 6).
EOSHIFT (V, SHIFT=2) shifts the array to the left by 2 positions,
producing the value (3, 4, 5, 6, 0, 0).
EOSHIFT (V, SHIFT= -3, BOUNDARY= 99) shifts the array to the right
by 3 positions, and uses the boundary value of 99, producing the
value (99, 99, 99, 1, 2, 3).
Consider that M is the following array:
|1 2 3|
|4 5 6|
|7 8 9|
EOSHIFT (M, SHIFT = 1, BOUNDARY = '*', DIM=2) produces the result:
|2 3 *|
|5 6 *|
|8 9 *|
EOSHIFT (M, SHIFT = -1, DIM = 1) produces the result:
|0 0 0|
|1 2 3|
|4 5 6|
EOSHIFT (M, SHIFT = (/1, -1, 0/), BOUNDARY = (/ '*', '?', '/' /),
DIM=2) produces the result:
|2 3 *|
|? 4 5|
|7 8 9|