Fortran Wiki
eoshift

Description

eoshift(array, shift[, boundary, dim]) performs an end-off shift on elements of array along the dimension of dim. If dim is omitted it is taken to be 1. dim is a scaler of type integer in the range of 1DIMn1 \leq \text{DIM} \leq n where nn is the rank of array. If the rank of array is one, then all elements of array are shifted by shift places. If rank is greater than one, then all complete rank one sections of array along the given dimension are shifted. Elements shifted out one end of each rank one section are dropped. If boundary is present then the corresponding value of from boundary is copied back in the other end. If boundary is not present then the following are copied in depending on the type of array.

Array Type - Boundary Value

  • Numeric - 0 of the type and kind of array.
  • Logical - .false..
  • Character(len) - len blanks.

Standard

Fortran 95 and later

Class

Transformational function

Syntax

result = eoshift(array, shift [, boundary, dim])

Arguments

  • array - May be any type, not scaler.
  • shift - The type shall be integer.
  • boundary - Same type as array.
  • dim - The type shall be integer.

Return value

Returns an array of same type and rank as the array argument.

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

category: intrinsics