LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ dlaord()

subroutine dlaord ( character  job,
integer  n,
double precision, dimension( * )  x,
integer  incx 
)

DLAORD

Purpose:
 DLAORD sorts the elements of a vector x in increasing or decreasing
 order.
Parameters
[in]JOB
          JOB is CHARACTER
          = 'I':  Sort in increasing order
          = 'D':  Sort in decreasing order
[in]N
          N is INTEGER
          The length of the vector X.
[in,out]X
          X is DOUBLE PRECISION array, dimension
                         (1+(N-1)*INCX)
          On entry, the vector of length n to be sorted.
          On exit, the vector x is sorted in the prescribed order.
[in]INCX
          INCX is INTEGER
          The spacing between successive elements of X.  INCX >= 0.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 72 of file dlaord.f.

73*
74* -- LAPACK test routine --
75* -- LAPACK is a software package provided by Univ. of Tennessee, --
76* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
77*
78* .. Scalar Arguments ..
79 CHARACTER JOB
80 INTEGER INCX, N
81* ..
82* .. Array Arguments ..
83 DOUBLE PRECISION X( * )
84* ..
85*
86* =====================================================================
87*
88* .. Local Scalars ..
89 INTEGER I, INC, IX, IXNEXT
90 DOUBLE PRECISION TEMP
91* ..
92* .. External Functions ..
93 LOGICAL LSAME
94 EXTERNAL lsame
95* ..
96* .. Intrinsic Functions ..
97 INTRINSIC abs
98* ..
99* .. Executable Statements ..
100*
101 inc = abs( incx )
102 IF( lsame( job, 'I' ) ) THEN
103*
104* Sort in increasing order
105*
106 DO 20 i = 2, n
107 ix = 1 + ( i-1 )*inc
108 10 CONTINUE
109 IF( ix.EQ.1 )
110 $ GO TO 20
111 ixnext = ix - inc
112 IF( x( ix ).GT.x( ixnext ) ) THEN
113 GO TO 20
114 ELSE
115 temp = x( ix )
116 x( ix ) = x( ixnext )
117 x( ixnext ) = temp
118 END IF
119 ix = ixnext
120 GO TO 10
121 20 CONTINUE
122*
123 ELSE IF( lsame( job, 'D' ) ) THEN
124*
125* Sort in decreasing order
126*
127 DO 40 i = 2, n
128 ix = 1 + ( i-1 )*inc
129 30 CONTINUE
130 IF( ix.EQ.1 )
131 $ GO TO 40
132 ixnext = ix - inc
133 IF( x( ix ).LT.x( ixnext ) ) THEN
134 GO TO 40
135 ELSE
136 temp = x( ix )
137 x( ix ) = x( ixnext )
138 x( ixnext ) = temp
139 END IF
140 ix = ixnext
141 GO TO 30
142 40 CONTINUE
143 END IF
144 RETURN
145*
146* End of DLAORD
147*
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
Here is the caller graph for this function: