CXML

gen_sort 


FORMAT

  GEN_SORT

  ( order, type, size, n, x, incx, y, incy )

Arguments

  order               character*1
                      On entry, order specifies the operation to be performed
                      as follows:

                      If order = 'A' or 'a', x is sorted in ascending
                      sequence

                      If order = 'D' or 'd', x is sorted in descending
                      sequence
                      On exit, order is unchanged.

  type                character*1
                      On entry, type specifies the data type of vectors x and
                      y. The following types are valid:

                      If type = 'B' or 'b', binary (unsigned integer)

                      If type = 'C' or 'c', character string

                      If type = 'I' or 'i', integer (signed)

                      If type = 'L' or 'l', logical - Fortran .TRUE. or
                      .FALSE.

                      If type = 'R' or 'r', IEEE floating point

                      If type = 'V' or 'v', VAXG floating point
                      On exit, type is unchanged.

  size                integer*4
                      On entry, size specifies the size, in bytes, of each
                      element of data vectors x and y. Valid combinations of
                      type and size are shown below:

                      If type = 'B' or 'b' - size = { 1,2,4,8 }

                      If type = 'C' or 'c' - size = { 0 < size < 65536 }

                      If type = 'I' or 'i' - size = { 1,2,4,8 }

                      If type = 'L' or 'l' - size = { 1,2,4,8 }

                      If type = 'R' or 'r' - size = { 4,8,16 }

                      If type = 'V' or 'v' - size = { 4,8 }
                      On exit, size is unchanged.

  n                   integer*4
                      On entry, the length of the x and y vectors.
                      On exit, n is unchanged.

  x                   data vector
                      On entry, a length n vector of data to be sorted.  Each
                      element of vector x is of type and size specified.
                      On exit, vector x is unchanged, unless it overlaps
                      vector y.

  incx                integer*4
                      On entry, incx specifies the distance between elements
                      of vector x. incx must be positive.
                      On exit, incx is unchanged.

  y                   data vector
                      On entry, vector y is ignored.
                      On exit, vector y is overwritten with sorted data.
                      Each element of vector y is of type and size specified.

  incy                integer*4
                      On entry, incy specifies the distance between elements
                      of vector y. incy must be positive.
                      On exit, incy is unchanged.

Description

  GEN_SORT is a general purpose, in memory, sort routine. GEN_SORT accepts
  the following FORTRAN data types:

          INTEGER*1, INTEGER*2, INTEGER*4, INTEGER*8

          LOGICAL*1, LOGICAL*2, LOGICAL*4, LOGICAL*8

          REAL*4, REAL*8, REAL*16

          CHARACTER*(*)

  GEN_SORT also accepts unsigned "binary" integers of 1, 2, 4, or 8 byte
  sizes.

  A radix algorithm is employed to sort the data. For all data types except
  REAL*16 and CHARACTER*(*), an N*16 byte work space is acquired from heap
  storage. For REAL*16 data, a work space of N*24 bytes is taken from heap
  storage. Heap work space required for CHARACTER data is N*((SIZE-1)/8+3)*8
  bytes in size.

Example

  REAL*4 DATA( 100 )
  N = 100
  CALL GEN_SORT( 'A','R',4,N,DATA,1,DATA,1 )

  This FORTRAN code sorts a 100 element single precision real vector, in
  place.

CXML Home Page

Index of CXML Routines