Routine: SLASRT2()  File: SRC\slasrt2.f

 
 
# lines: 268
  # code: 268
  # comment: 0
  # blank:0
# Variables:6
# Callers:3
# Callings:0
# Words:9
# Keywords:7
 

 

..
     .. Local Scalars ..
     ..
     .. Local Arrays ..
     ..
     .. External Functions ..
     ..
     .. External Subroutines ..
     ..
     .. Executable Statements ..
     Test the input paramters.
     Quick return if possible
        Do Insertion sort on D( START:ENDD )
           Sort into decreasing order
           Sort into increasing order
        Partition D( START:ENDD ) and stack parts, largest one first
        Choose partition entry as median of 3
           Sort into decreasing order
           Sort into increasing order
     End of SLASRT2

 
Display dynamic version Find AutoScroll Reload FontSize: - + Hide Comments Hide Blanks Frame FullScreen MailPrint

 
01        SUBROUTINE SLASRT2( ID , N , D , KEY , INFO )
02  
03  *     -- ScaLAPACK routine(version 1.7) --
04  *     University of Tennessee , Knoxville , Oak Ridge National Laboratory ,
05  *     and University of California , Berkeley.
06  *     May 1 , 1997
07  
08  *     .. Scalar Arguments ..
09        CHARACTER ID
10        INTEGER INFO , N
11  *     ..
12  *     .. Array Arguments ..
13        INTEGER KEY( * )
14        REAL D( * )
15  *     ..
16  
17  *     Purpose
18  *     === ====
19  
20  *     Sort the numbers in D in increasing order(if ID = 'I') or
21  *     in decreasing order(if ID = 'D' ).
22  
23  *     Use Quick Sort , reverting to Insertion sort on arrays of
24  *     size <= 20. Dimension of STACK limits N to about 2**32.
25  
26  *     Arguments
27  *     === ======
28  
29  *     ID(input) CHARACTER*1
30  *     = 'I' : sort D in increasing order ;
31  *     = 'D' : sort D in decreasing order.
32  
33  *     N(input) INTEGER
34  *     The length of the array D.
35  
36  *     D(input / output) REAL array , dimension(N)
37  *     On entry , the array to be sorted.
38  *     On exit , D has been sorted into increasing order
39  *     (D(1) <= ... <= D(N) ) or into decreasing order
40  *     (D(1) >= ... >= D(N) ) , depending on ID.
41  
42  *     KEY(input / output) INTEGER array , dimension(N)
43  *     On entry , KEY contains a key to each of the entries in D()
44  *     Typically , KEY(I) = I for all I
45  *     On exit , KEY is permuted in exactly the same manner as
46  *     D() was permuted from input to output
47  *     Therefore , if KEY(I) = I for all I upon input , then
48  *     D_out(I) = D_in(KEY(I))
49  
50  *     INFO(output) INTEGER
51  *     = 0 : successful exit
52  *     < 0 : if INFO = - i , the i - th argument had an illegal value
53  
54  *     === ==================================================================
55  
56  *     .. Parameters ..
57        INTEGER SELECT
58        PARAMETER( SELECT = 20 )
59        END