F_SSORT/F_DSORT

Sort vector entries

Name

F_SSORT/F_DSORT

 

 

Sort vector entries

 

Purpose

F_xSORT sorts the entries of a real vector x in increasing or decreasing order

 

and overwrites x with the sorted vector. If n is less than or equal to zero,

 

F_xSORT returns immediately. F_xSORT is not defined for complex vectors; it

 

operates strictly on real vectors.

 

Usage

VECLIB:

 

 

INTEGER*4

INCX, N, SORT

 

REAL*4

X( * )

 

SUBROUTINE F_SSORT (SORT, N, X, INCX)

 

INTEGER*4

INCX, N, SORT

 

REAL*8

X( * )

 

SUBROUTINE F_DSORT (SORT, N, X, INCX)

 

VECLIB8:

 

 

INTEGER*8

INCX, N, SORT

 

REAL*4

X( * )

 

SUBROUTINE F_SSORT (SORT, N, X, INCX)

 

INTEGER*8

INCX, N, SORT

 

REAL*8

X( * )

 

SUBROUTINE F_DSORT (SORT, N, X, INCX)

Input

SORT

Specifies whether the data should be sorted in

 

 

increasing or decreasing order. Use either

 

 

BLAS_INCREASING_ORDER or

 

 

BLAS_DECREASING_ORDER.

 

N

Number of elements of vector x.

 

X

REAL array, minimum length (N - 1) x incx + 1.

 

INCX

Increment for the array x. A vector x having component

 

 

xi, i = 1,..., n, is stored in an array X() with increment

 

 

argument incx. If incx > 0 then xi is stored in

 

 

X (1 + (i - 1) x incx). If incx < 0 then xi is stored in

 

 

X (1 + (N - i) x incx). incx = 0 is an illegal value.

Output

X

The sorted array replaces the input.

192HP MLIB User’s Guide