CXML

SSORTB (3sciport)


SYNOPSIS

  Call SSORTB( ad, n, x, incx, [id], [incd] )

ARGUMENTS

  ad              Character.
                  Indicates whether to sort in ascending or descending order.
                  Any character string starting with 'a', 'A', 'd', or 'D' is
                  valid. Strings starting with 'a' or 'A' request ascending
                  order. Strings starting with 'd' or 'D' request descending
                  order.

  n               Integer.
                  The number of elements to be sorted.

  x               Real vector.
                  The real data to be sorted.

  incx            Integer.
                  The increment between elements of x.

  id              Integer vector.
                  This is an optional argument. Its presence requests an
                  indexed sort. Its absence requests an inplace sort. If
                  present it is can be used to access vector x in sorted
                  order.

                  WARNING! The comma preceding this argument must be present.

  incd            Integer.
                  This is an optional argument needed only if an index sort
                  is requested.  If an indexed sort is requested, incd
                  contains the increment between elements of vector id.

DESCRIPTION

  SSORTB can perform an in-place or indexed sort in ascending or descending
  order. An in-place sort overwrites the input data vector with the sorted
  output. An indexed sort returns a permuted index vector which can be used
  to access the unmodified data vector in its sorted order.

  This implementation of SSORTB differs from its Cray counterpart in two
  inportant ways.

  The first, and most important way, is that Cray source code using the four
  argument call to request an in-place sort should be modified slightly. For
  example, if this is the old CALL statement:

          Call SSORTB( 'A', N, X, 2 )

  this should be the new CALL statement:

          Call SSORTB( 'A', N, X, 2, , )

  Notice, two extra commas are used to pass null arguments expected by this
  version of SSORTB. The routine determines presence or absence of the id
  argument by accessing its argument pointer. Null arguments pass empty
  pointers.

  This routine uses a radix sort algorithm, not Batcher's bitonic merge
  algorithm. As such, this sort is stable while the Cray version is not.

  For equations and other information, see Volume 3: UNICOS Math and
  Scientific Library Reference Manual SR-2081 7.0, Cray Research, Inc.

CXML Home Page

Index of CXML Routines