SYNOPSIS

SUBROUTINE DLASRT2(

ID, N, D, KEY, INFO )

CHARACTER

ID

INTEGER

INFO, N

INTEGER

KEY( * )

DOUBLE

PRECISION D( * )

PURPOSE

Sort the numbers in D in increasing order (if ID = 'I') or in decreasing order (if ID = 'D' ).

Use Quick Sort, reverting to Insertion sort on arrays of

size <= 20. Dimension of STACK limits N to about 2**32.

ARGUMENTS

ID (input) CHARACTER*1

= 'I': sort D in increasing order;

= 'D': sort D in decreasing order.

N (input) INTEGER

The length of the array D.

D (input/output) DOUBLE PRECISION array, dimension (N)

On entry, the array to be sorted. On exit, D has been sorted into increasing order (D(1) <= ... <= D(N) ) or into decreasing order (D(1) >= ... >= D(N) ), depending on ID.

KEY (input/output) INTEGER array, dimension (N)

On entry, KEY contains a key to each of the entries in D() Typically, KEY(I) = I for all I On exit, KEY is permuted in exactly the same manner as D() was permuted from input to output Therefore, if KEY(I) = I for all I upon input, then D_out(I) = D_in(KEY(I))

INFO (output) INTEGER

= 0: successful exit

< 0: if INFO = -i, the i-th argument had an illegal value