Manual Reference Pages  - eoshift (3fortran)

NAME

EOSHIFT(3) - [TRANSFORMATIONAL] End-off shift of elements of an array

SYNOPSIS

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

       type(TYPE(kind=KIND)) function eoshift(array,shift,boundary,dim)

type(TYPE(kind=KIND)),intent(in) :: array(..) integer(kind=**),intent(in) :: shift(..) type(TYPE(kind=KIND)),intent(in) :: boundary(..) integer(kind=**),intent(in) :: dim

CHARACTERISTICS

o ARRAY an array of any type
o SHIFT is an integer of any kind. It may be a scalar. If the rank of ARRAY is greater than one, and DIM is specified it is the same shape as ARRAY reduced by removing dimension DIM.
o BOUNDARY May be a scalar of the same type and kind as ARRAY. It must be a scalar when ARRAY has a rank of one. Otherwise, it may be an array of the same shape as ARRAY reduced by dimension DIM. It may only be absent for certain types, as described below.
o DIM is an integer of any kind. It defaults to one.
o the result has the same type, type parameters, and shape as ARRAY.
o a kind designated as ** may be any supported kind for the type
o The result is an array of same type, kind and rank as the ARRAY argument.

DESCRIPTION

EOSHIFT(3) performs an end-off shift on elements of ARRAY along the dimension of DIM.

Elements shifted out one end of each rank one section are dropped.

If BOUNDARY is present then the corresponding value from BOUNDARY is copied back in the other end, else default values are used.

OPTIONS

o ARRAY : array of any type whose elements are to be shifted. 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.
o SHIFT : the number of elements to shift. A negative value shifts to the right, a positive value to the left of the vector(s) being shifted.
o BOUNDARY : the value to use to fill in the elements vacated by the shift. If BOUNDARY is not present then the following are copied in depending on the type of ARRAY.

        Array Type    | Boundary Value
        -----------------------------------------------------
        Numeric       | 0, 0.0, or (0.0, 0.0) of the type and kind of "array"
        Logical       | .false.
        Character(len)|  LEN blanks

These are the only types for which BOUNDARY may not be present. For these types the kind is converted as neccessary to the kind of ARRAY.
o DIM : DIM is in the range of

1 <= DIM <= n

where "N" is the rank of ARRAY. If DIM is omitted it is taken to be 1.

RESULT

Returns an array of the same characteristics as the input with the specified number of elements dropped off along the specified direction indicated, backfilling the vacated elements with a value indicated by the BOUNDARY value.

EXAMPLES

Sample program:

    program demo_eoshift
    implicit none
    integer, dimension(3,3) :: a
    integer :: i

a = reshape( [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ], [ 3, 3 ]) print ’(3i3)’, (a(i,:),i=1,3)

print *

! shift it a = eoshift(a, SHIFT=[1, 2, 1], BOUNDARY=-5, DIM=2) print ’(3i3)’, (a(i,:),i=1,3)

end program demo_eoshift

Results:

      >  1  4  7
      >  2  5  8
      >  3  6  9
      >
      >  4  7 -5
      >  8 -5 -5
      >  6  9 -5

STANDARD

Fortran 95

SEE ALSO

DSHIFTR(3), DSHIFTL(3)

fortran-lang intrinsic descriptions (license: MIT) @urbanjost


Nemo Release 3.1 eoshift (3fortran) April 28, 2024
Generated by manServer 1.08 from a02bab80-7eb5-45c9-b30a-719a3e8bc183 using man macros.