EOSHIFT — End-off shift elements of an array#
-
EOSHIFT(ARRAY, SHIFT, BOUNDARY, DIM)#
EOSHIFT(ARRAY, SHIFT[, BOUNDARY, DIM])performs an end-off shift on elements ofARRAYalong the dimension ofDIM. IfDIMis omitted it is taken to be1.DIMis a scalar of typeINTEGERin the range of 1 leq DIM leq n) where n is the rank ofARRAY. If the rank ofARRAYis one, then all elements ofARRAYare shifted bySHIFTplaces. If rank is greater than one, then all complete rank one sections ofARRAYalong the given dimension are shifted. Elements shifted out one end of each rank one section are dropped. IfBOUNDARYis present then the corresponding value of fromBOUNDARYis copied back in the other end. IfBOUNDARYis not present then the following are copied in depending on the type ofARRAY.- Parameters:
ARRAY – May be any type, not scalar.
SHIFT – The type shall be
INTEGER.BOUNDARY – Same type as
ARRAY.DIM – The type shall be
INTEGER.
- Returns:
Returns an array of same type and rank as the
ARRAYargument.
- Standard:
Fortran 90 and later
- Class:
Transformational function
- Syntax:
RESULT = EOSHIFT(ARRAY, SHIFT [, BOUNDARY, DIM])
- Example:
program test_eoshift integer, dimension(3,3) :: a a = reshape( (/ 1, 2, 3, 4, 5, 6, 7, 8, 9 /), (/ 3, 3 /)) print '(3i3)', a(1,:) print '(3i3)', a(2,:) print '(3i3)', a(3,:) a = EOSHIFT(a, SHIFT=(/1, 2, 1/), BOUNDARY=-5, DIM=2) print * print '(3i3)', a(1,:) print '(3i3)', a(2,:) print '(3i3)', a(3,:) end program test_eoshift