root / src / lapack / double / dlasq2.f @ 3
Historique | Voir | Annoter | Télécharger (14,15 ko)
| 1 | 1 | pfleura2 | SUBROUTINE DLASQ2( N, Z, INFO ) |
|---|---|---|---|
| 2 | 1 | pfleura2 | * |
| 3 | 1 | pfleura2 | * -- LAPACK routine (version 3.2) -- |
| 4 | 1 | pfleura2 | * |
| 5 | 1 | pfleura2 | * -- Contributed by Osni Marques of the Lawrence Berkeley National -- |
| 6 | 1 | pfleura2 | * -- Laboratory and Beresford Parlett of the Univ. of California at -- |
| 7 | 1 | pfleura2 | * -- Berkeley -- |
| 8 | 1 | pfleura2 | * -- November 2008 -- |
| 9 | 1 | pfleura2 | * |
| 10 | 1 | pfleura2 | * -- LAPACK is a software package provided by Univ. of Tennessee, -- |
| 11 | 1 | pfleura2 | * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- |
| 12 | 1 | pfleura2 | * |
| 13 | 1 | pfleura2 | * .. Scalar Arguments .. |
| 14 | 1 | pfleura2 | INTEGER INFO, N |
| 15 | 1 | pfleura2 | * .. |
| 16 | 1 | pfleura2 | * .. Array Arguments .. |
| 17 | 1 | pfleura2 | DOUBLE PRECISION Z( * ) |
| 18 | 1 | pfleura2 | * .. |
| 19 | 1 | pfleura2 | * |
| 20 | 1 | pfleura2 | * Purpose |
| 21 | 1 | pfleura2 | * ======= |
| 22 | 1 | pfleura2 | * |
| 23 | 1 | pfleura2 | * DLASQ2 computes all the eigenvalues of the symmetric positive |
| 24 | 1 | pfleura2 | * definite tridiagonal matrix associated with the qd array Z to high |
| 25 | 1 | pfleura2 | * relative accuracy are computed to high relative accuracy, in the |
| 26 | 1 | pfleura2 | * absence of denormalization, underflow and overflow. |
| 27 | 1 | pfleura2 | * |
| 28 | 1 | pfleura2 | * To see the relation of Z to the tridiagonal matrix, let L be a |
| 29 | 1 | pfleura2 | * unit lower bidiagonal matrix with subdiagonals Z(2,4,6,,..) and |
| 30 | 1 | pfleura2 | * let U be an upper bidiagonal matrix with 1's above and diagonal |
| 31 | 1 | pfleura2 | * Z(1,3,5,,..). The tridiagonal is L*U or, if you prefer, the |
| 32 | 1 | pfleura2 | * symmetric tridiagonal to which it is similar. |
| 33 | 1 | pfleura2 | * |
| 34 | 1 | pfleura2 | * Note : DLASQ2 defines a logical variable, IEEE, which is true |
| 35 | 1 | pfleura2 | * on machines which follow ieee-754 floating-point standard in their |
| 36 | 1 | pfleura2 | * handling of infinities and NaNs, and false otherwise. This variable |
| 37 | 1 | pfleura2 | * is passed to DLASQ3. |
| 38 | 1 | pfleura2 | * |
| 39 | 1 | pfleura2 | * Arguments |
| 40 | 1 | pfleura2 | * ========= |
| 41 | 1 | pfleura2 | * |
| 42 | 1 | pfleura2 | * N (input) INTEGER |
| 43 | 1 | pfleura2 | * The number of rows and columns in the matrix. N >= 0. |
| 44 | 1 | pfleura2 | * |
| 45 | 1 | pfleura2 | * Z (input/output) DOUBLE PRECISION array, dimension ( 4*N ) |
| 46 | 1 | pfleura2 | * On entry Z holds the qd array. On exit, entries 1 to N hold |
| 47 | 1 | pfleura2 | * the eigenvalues in decreasing order, Z( 2*N+1 ) holds the |
| 48 | 1 | pfleura2 | * trace, and Z( 2*N+2 ) holds the sum of the eigenvalues. If |
| 49 | 1 | pfleura2 | * N > 2, then Z( 2*N+3 ) holds the iteration count, Z( 2*N+4 ) |
| 50 | 1 | pfleura2 | * holds NDIVS/NIN^2, and Z( 2*N+5 ) holds the percentage of |
| 51 | 1 | pfleura2 | * shifts that failed. |
| 52 | 1 | pfleura2 | * |
| 53 | 1 | pfleura2 | * INFO (output) INTEGER |
| 54 | 1 | pfleura2 | * = 0: successful exit |
| 55 | 1 | pfleura2 | * < 0: if the i-th argument is a scalar and had an illegal |
| 56 | 1 | pfleura2 | * value, then INFO = -i, if the i-th argument is an |
| 57 | 1 | pfleura2 | * array and the j-entry had an illegal value, then |
| 58 | 1 | pfleura2 | * INFO = -(i*100+j) |
| 59 | 1 | pfleura2 | * > 0: the algorithm failed |
| 60 | 1 | pfleura2 | * = 1, a split was marked by a positive value in E |
| 61 | 1 | pfleura2 | * = 2, current block of Z not diagonalized after 30*N |
| 62 | 1 | pfleura2 | * iterations (in inner while loop) |
| 63 | 1 | pfleura2 | * = 3, termination criterion of outer while loop not met |
| 64 | 1 | pfleura2 | * (program created more than N unreduced blocks) |
| 65 | 1 | pfleura2 | * |
| 66 | 1 | pfleura2 | * Further Details |
| 67 | 1 | pfleura2 | * =============== |
| 68 | 1 | pfleura2 | * Local Variables: I0:N0 defines a current unreduced segment of Z. |
| 69 | 1 | pfleura2 | * The shifts are accumulated in SIGMA. Iteration count is in ITER. |
| 70 | 1 | pfleura2 | * Ping-pong is controlled by PP (alternates between 0 and 1). |
| 71 | 1 | pfleura2 | * |
| 72 | 1 | pfleura2 | * ===================================================================== |
| 73 | 1 | pfleura2 | * |
| 74 | 1 | pfleura2 | * .. Parameters .. |
| 75 | 1 | pfleura2 | DOUBLE PRECISION CBIAS |
| 76 | 1 | pfleura2 | PARAMETER ( CBIAS = 1.50D0 ) |
| 77 | 1 | pfleura2 | DOUBLE PRECISION ZERO, HALF, ONE, TWO, FOUR, HUNDRD |
| 78 | 1 | pfleura2 | PARAMETER ( ZERO = 0.0D0, HALF = 0.5D0, ONE = 1.0D0, |
| 79 | 1 | pfleura2 | $ TWO = 2.0D0, FOUR = 4.0D0, HUNDRD = 100.0D0 ) |
| 80 | 1 | pfleura2 | * .. |
| 81 | 1 | pfleura2 | * .. Local Scalars .. |
| 82 | 1 | pfleura2 | LOGICAL IEEE |
| 83 | 1 | pfleura2 | INTEGER I0, I4, IINFO, IPN4, ITER, IWHILA, IWHILB, K, |
| 84 | 1 | pfleura2 | $ KMIN, N0, NBIG, NDIV, NFAIL, PP, SPLT, TTYPE |
| 85 | 1 | pfleura2 | DOUBLE PRECISION D, DEE, DEEMIN, DESIG, DMIN, DMIN1, DMIN2, DN, |
| 86 | 1 | pfleura2 | $ DN1, DN2, E, EMAX, EMIN, EPS, G, OLDEMN, QMAX, |
| 87 | 1 | pfleura2 | $ QMIN, S, SAFMIN, SIGMA, T, TAU, TEMP, TOL, |
| 88 | 1 | pfleura2 | $ TOL2, TRACE, ZMAX |
| 89 | 1 | pfleura2 | * .. |
| 90 | 1 | pfleura2 | * .. External Subroutines .. |
| 91 | 1 | pfleura2 | EXTERNAL DLASQ3, DLASRT, XERBLA |
| 92 | 1 | pfleura2 | * .. |
| 93 | 1 | pfleura2 | * .. External Functions .. |
| 94 | 1 | pfleura2 | INTEGER ILAENV |
| 95 | 1 | pfleura2 | DOUBLE PRECISION DLAMCH |
| 96 | 1 | pfleura2 | EXTERNAL DLAMCH, ILAENV |
| 97 | 1 | pfleura2 | * .. |
| 98 | 1 | pfleura2 | * .. Intrinsic Functions .. |
| 99 | 1 | pfleura2 | INTRINSIC ABS, DBLE, MAX, MIN, SQRT |
| 100 | 1 | pfleura2 | * .. |
| 101 | 1 | pfleura2 | * .. Executable Statements .. |
| 102 | 1 | pfleura2 | * |
| 103 | 1 | pfleura2 | * Test the input arguments. |
| 104 | 1 | pfleura2 | * (in case DLASQ2 is not called by DLASQ1) |
| 105 | 1 | pfleura2 | * |
| 106 | 1 | pfleura2 | INFO = 0 |
| 107 | 1 | pfleura2 | EPS = DLAMCH( 'Precision' ) |
| 108 | 1 | pfleura2 | SAFMIN = DLAMCH( 'Safe minimum' ) |
| 109 | 1 | pfleura2 | TOL = EPS*HUNDRD |
| 110 | 1 | pfleura2 | TOL2 = TOL**2 |
| 111 | 1 | pfleura2 | * |
| 112 | 1 | pfleura2 | IF( N.LT.0 ) THEN |
| 113 | 1 | pfleura2 | INFO = -1 |
| 114 | 1 | pfleura2 | CALL XERBLA( 'DLASQ2', 1 ) |
| 115 | 1 | pfleura2 | RETURN |
| 116 | 1 | pfleura2 | ELSE IF( N.EQ.0 ) THEN |
| 117 | 1 | pfleura2 | RETURN |
| 118 | 1 | pfleura2 | ELSE IF( N.EQ.1 ) THEN |
| 119 | 1 | pfleura2 | * |
| 120 | 1 | pfleura2 | * 1-by-1 case. |
| 121 | 1 | pfleura2 | * |
| 122 | 1 | pfleura2 | IF( Z( 1 ).LT.ZERO ) THEN |
| 123 | 1 | pfleura2 | INFO = -201 |
| 124 | 1 | pfleura2 | CALL XERBLA( 'DLASQ2', 2 ) |
| 125 | 1 | pfleura2 | END IF |
| 126 | 1 | pfleura2 | RETURN |
| 127 | 1 | pfleura2 | ELSE IF( N.EQ.2 ) THEN |
| 128 | 1 | pfleura2 | * |
| 129 | 1 | pfleura2 | * 2-by-2 case. |
| 130 | 1 | pfleura2 | * |
| 131 | 1 | pfleura2 | IF( Z( 2 ).LT.ZERO .OR. Z( 3 ).LT.ZERO ) THEN |
| 132 | 1 | pfleura2 | INFO = -2 |
| 133 | 1 | pfleura2 | CALL XERBLA( 'DLASQ2', 2 ) |
| 134 | 1 | pfleura2 | RETURN |
| 135 | 1 | pfleura2 | ELSE IF( Z( 3 ).GT.Z( 1 ) ) THEN |
| 136 | 1 | pfleura2 | D = Z( 3 ) |
| 137 | 1 | pfleura2 | Z( 3 ) = Z( 1 ) |
| 138 | 1 | pfleura2 | Z( 1 ) = D |
| 139 | 1 | pfleura2 | END IF |
| 140 | 1 | pfleura2 | Z( 5 ) = Z( 1 ) + Z( 2 ) + Z( 3 ) |
| 141 | 1 | pfleura2 | IF( Z( 2 ).GT.Z( 3 )*TOL2 ) THEN |
| 142 | 1 | pfleura2 | T = HALF*( ( Z( 1 )-Z( 3 ) )+Z( 2 ) ) |
| 143 | 1 | pfleura2 | S = Z( 3 )*( Z( 2 ) / T ) |
| 144 | 1 | pfleura2 | IF( S.LE.T ) THEN |
| 145 | 1 | pfleura2 | S = Z( 3 )*( Z( 2 ) / ( T*( ONE+SQRT( ONE+S / T ) ) ) ) |
| 146 | 1 | pfleura2 | ELSE |
| 147 | 1 | pfleura2 | S = Z( 3 )*( Z( 2 ) / ( T+SQRT( T )*SQRT( T+S ) ) ) |
| 148 | 1 | pfleura2 | END IF |
| 149 | 1 | pfleura2 | T = Z( 1 ) + ( S+Z( 2 ) ) |
| 150 | 1 | pfleura2 | Z( 3 ) = Z( 3 )*( Z( 1 ) / T ) |
| 151 | 1 | pfleura2 | Z( 1 ) = T |
| 152 | 1 | pfleura2 | END IF |
| 153 | 1 | pfleura2 | Z( 2 ) = Z( 3 ) |
| 154 | 1 | pfleura2 | Z( 6 ) = Z( 2 ) + Z( 1 ) |
| 155 | 1 | pfleura2 | RETURN |
| 156 | 1 | pfleura2 | END IF |
| 157 | 1 | pfleura2 | * |
| 158 | 1 | pfleura2 | * Check for negative data and compute sums of q's and e's. |
| 159 | 1 | pfleura2 | * |
| 160 | 1 | pfleura2 | Z( 2*N ) = ZERO |
| 161 | 1 | pfleura2 | EMIN = Z( 2 ) |
| 162 | 1 | pfleura2 | QMAX = ZERO |
| 163 | 1 | pfleura2 | ZMAX = ZERO |
| 164 | 1 | pfleura2 | D = ZERO |
| 165 | 1 | pfleura2 | E = ZERO |
| 166 | 1 | pfleura2 | * |
| 167 | 1 | pfleura2 | DO 10 K = 1, 2*( N-1 ), 2 |
| 168 | 1 | pfleura2 | IF( Z( K ).LT.ZERO ) THEN |
| 169 | 1 | pfleura2 | INFO = -( 200+K ) |
| 170 | 1 | pfleura2 | CALL XERBLA( 'DLASQ2', 2 ) |
| 171 | 1 | pfleura2 | RETURN |
| 172 | 1 | pfleura2 | ELSE IF( Z( K+1 ).LT.ZERO ) THEN |
| 173 | 1 | pfleura2 | INFO = -( 200+K+1 ) |
| 174 | 1 | pfleura2 | CALL XERBLA( 'DLASQ2', 2 ) |
| 175 | 1 | pfleura2 | RETURN |
| 176 | 1 | pfleura2 | END IF |
| 177 | 1 | pfleura2 | D = D + Z( K ) |
| 178 | 1 | pfleura2 | E = E + Z( K+1 ) |
| 179 | 1 | pfleura2 | QMAX = MAX( QMAX, Z( K ) ) |
| 180 | 1 | pfleura2 | EMIN = MIN( EMIN, Z( K+1 ) ) |
| 181 | 1 | pfleura2 | ZMAX = MAX( QMAX, ZMAX, Z( K+1 ) ) |
| 182 | 1 | pfleura2 | 10 CONTINUE |
| 183 | 1 | pfleura2 | IF( Z( 2*N-1 ).LT.ZERO ) THEN |
| 184 | 1 | pfleura2 | INFO = -( 200+2*N-1 ) |
| 185 | 1 | pfleura2 | CALL XERBLA( 'DLASQ2', 2 ) |
| 186 | 1 | pfleura2 | RETURN |
| 187 | 1 | pfleura2 | END IF |
| 188 | 1 | pfleura2 | D = D + Z( 2*N-1 ) |
| 189 | 1 | pfleura2 | QMAX = MAX( QMAX, Z( 2*N-1 ) ) |
| 190 | 1 | pfleura2 | ZMAX = MAX( QMAX, ZMAX ) |
| 191 | 1 | pfleura2 | * |
| 192 | 1 | pfleura2 | * Check for diagonality. |
| 193 | 1 | pfleura2 | * |
| 194 | 1 | pfleura2 | IF( E.EQ.ZERO ) THEN |
| 195 | 1 | pfleura2 | DO 20 K = 2, N |
| 196 | 1 | pfleura2 | Z( K ) = Z( 2*K-1 ) |
| 197 | 1 | pfleura2 | 20 CONTINUE |
| 198 | 1 | pfleura2 | CALL DLASRT( 'D', N, Z, IINFO ) |
| 199 | 1 | pfleura2 | Z( 2*N-1 ) = D |
| 200 | 1 | pfleura2 | RETURN |
| 201 | 1 | pfleura2 | END IF |
| 202 | 1 | pfleura2 | * |
| 203 | 1 | pfleura2 | TRACE = D + E |
| 204 | 1 | pfleura2 | * |
| 205 | 1 | pfleura2 | * Check for zero data. |
| 206 | 1 | pfleura2 | * |
| 207 | 1 | pfleura2 | IF( TRACE.EQ.ZERO ) THEN |
| 208 | 1 | pfleura2 | Z( 2*N-1 ) = ZERO |
| 209 | 1 | pfleura2 | RETURN |
| 210 | 1 | pfleura2 | END IF |
| 211 | 1 | pfleura2 | * |
| 212 | 1 | pfleura2 | * Check whether the machine is IEEE conformable. |
| 213 | 1 | pfleura2 | * |
| 214 | 1 | pfleura2 | IEEE = ILAENV( 10, 'DLASQ2', 'N', 1, 2, 3, 4 ).EQ.1 .AND. |
| 215 | 1 | pfleura2 | $ ILAENV( 11, 'DLASQ2', 'N', 1, 2, 3, 4 ).EQ.1 |
| 216 | 1 | pfleura2 | * |
| 217 | 1 | pfleura2 | * Rearrange data for locality: Z=(q1,qq1,e1,ee1,q2,qq2,e2,ee2,...). |
| 218 | 1 | pfleura2 | * |
| 219 | 1 | pfleura2 | DO 30 K = 2*N, 2, -2 |
| 220 | 1 | pfleura2 | Z( 2*K ) = ZERO |
| 221 | 1 | pfleura2 | Z( 2*K-1 ) = Z( K ) |
| 222 | 1 | pfleura2 | Z( 2*K-2 ) = ZERO |
| 223 | 1 | pfleura2 | Z( 2*K-3 ) = Z( K-1 ) |
| 224 | 1 | pfleura2 | 30 CONTINUE |
| 225 | 1 | pfleura2 | * |
| 226 | 1 | pfleura2 | I0 = 1 |
| 227 | 1 | pfleura2 | N0 = N |
| 228 | 1 | pfleura2 | * |
| 229 | 1 | pfleura2 | * Reverse the qd-array, if warranted. |
| 230 | 1 | pfleura2 | * |
| 231 | 1 | pfleura2 | IF( CBIAS*Z( 4*I0-3 ).LT.Z( 4*N0-3 ) ) THEN |
| 232 | 1 | pfleura2 | IPN4 = 4*( I0+N0 ) |
| 233 | 1 | pfleura2 | DO 40 I4 = 4*I0, 2*( I0+N0-1 ), 4 |
| 234 | 1 | pfleura2 | TEMP = Z( I4-3 ) |
| 235 | 1 | pfleura2 | Z( I4-3 ) = Z( IPN4-I4-3 ) |
| 236 | 1 | pfleura2 | Z( IPN4-I4-3 ) = TEMP |
| 237 | 1 | pfleura2 | TEMP = Z( I4-1 ) |
| 238 | 1 | pfleura2 | Z( I4-1 ) = Z( IPN4-I4-5 ) |
| 239 | 1 | pfleura2 | Z( IPN4-I4-5 ) = TEMP |
| 240 | 1 | pfleura2 | 40 CONTINUE |
| 241 | 1 | pfleura2 | END IF |
| 242 | 1 | pfleura2 | * |
| 243 | 1 | pfleura2 | * Initial split checking via dqd and Li's test. |
| 244 | 1 | pfleura2 | * |
| 245 | 1 | pfleura2 | PP = 0 |
| 246 | 1 | pfleura2 | * |
| 247 | 1 | pfleura2 | DO 80 K = 1, 2 |
| 248 | 1 | pfleura2 | * |
| 249 | 1 | pfleura2 | D = Z( 4*N0+PP-3 ) |
| 250 | 1 | pfleura2 | DO 50 I4 = 4*( N0-1 ) + PP, 4*I0 + PP, -4 |
| 251 | 1 | pfleura2 | IF( Z( I4-1 ).LE.TOL2*D ) THEN |
| 252 | 1 | pfleura2 | Z( I4-1 ) = -ZERO |
| 253 | 1 | pfleura2 | D = Z( I4-3 ) |
| 254 | 1 | pfleura2 | ELSE |
| 255 | 1 | pfleura2 | D = Z( I4-3 )*( D / ( D+Z( I4-1 ) ) ) |
| 256 | 1 | pfleura2 | END IF |
| 257 | 1 | pfleura2 | 50 CONTINUE |
| 258 | 1 | pfleura2 | * |
| 259 | 1 | pfleura2 | * dqd maps Z to ZZ plus Li's test. |
| 260 | 1 | pfleura2 | * |
| 261 | 1 | pfleura2 | EMIN = Z( 4*I0+PP+1 ) |
| 262 | 1 | pfleura2 | D = Z( 4*I0+PP-3 ) |
| 263 | 1 | pfleura2 | DO 60 I4 = 4*I0 + PP, 4*( N0-1 ) + PP, 4 |
| 264 | 1 | pfleura2 | Z( I4-2*PP-2 ) = D + Z( I4-1 ) |
| 265 | 1 | pfleura2 | IF( Z( I4-1 ).LE.TOL2*D ) THEN |
| 266 | 1 | pfleura2 | Z( I4-1 ) = -ZERO |
| 267 | 1 | pfleura2 | Z( I4-2*PP-2 ) = D |
| 268 | 1 | pfleura2 | Z( I4-2*PP ) = ZERO |
| 269 | 1 | pfleura2 | D = Z( I4+1 ) |
| 270 | 1 | pfleura2 | ELSE IF( SAFMIN*Z( I4+1 ).LT.Z( I4-2*PP-2 ) .AND. |
| 271 | 1 | pfleura2 | $ SAFMIN*Z( I4-2*PP-2 ).LT.Z( I4+1 ) ) THEN |
| 272 | 1 | pfleura2 | TEMP = Z( I4+1 ) / Z( I4-2*PP-2 ) |
| 273 | 1 | pfleura2 | Z( I4-2*PP ) = Z( I4-1 )*TEMP |
| 274 | 1 | pfleura2 | D = D*TEMP |
| 275 | 1 | pfleura2 | ELSE |
| 276 | 1 | pfleura2 | Z( I4-2*PP ) = Z( I4+1 )*( Z( I4-1 ) / Z( I4-2*PP-2 ) ) |
| 277 | 1 | pfleura2 | D = Z( I4+1 )*( D / Z( I4-2*PP-2 ) ) |
| 278 | 1 | pfleura2 | END IF |
| 279 | 1 | pfleura2 | EMIN = MIN( EMIN, Z( I4-2*PP ) ) |
| 280 | 1 | pfleura2 | 60 CONTINUE |
| 281 | 1 | pfleura2 | Z( 4*N0-PP-2 ) = D |
| 282 | 1 | pfleura2 | * |
| 283 | 1 | pfleura2 | * Now find qmax. |
| 284 | 1 | pfleura2 | * |
| 285 | 1 | pfleura2 | QMAX = Z( 4*I0-PP-2 ) |
| 286 | 1 | pfleura2 | DO 70 I4 = 4*I0 - PP + 2, 4*N0 - PP - 2, 4 |
| 287 | 1 | pfleura2 | QMAX = MAX( QMAX, Z( I4 ) ) |
| 288 | 1 | pfleura2 | 70 CONTINUE |
| 289 | 1 | pfleura2 | * |
| 290 | 1 | pfleura2 | * Prepare for the next iteration on K. |
| 291 | 1 | pfleura2 | * |
| 292 | 1 | pfleura2 | PP = 1 - PP |
| 293 | 1 | pfleura2 | 80 CONTINUE |
| 294 | 1 | pfleura2 | * |
| 295 | 1 | pfleura2 | * Initialise variables to pass to DLASQ3. |
| 296 | 1 | pfleura2 | * |
| 297 | 1 | pfleura2 | TTYPE = 0 |
| 298 | 1 | pfleura2 | DMIN1 = ZERO |
| 299 | 1 | pfleura2 | DMIN2 = ZERO |
| 300 | 1 | pfleura2 | DN = ZERO |
| 301 | 1 | pfleura2 | DN1 = ZERO |
| 302 | 1 | pfleura2 | DN2 = ZERO |
| 303 | 1 | pfleura2 | G = ZERO |
| 304 | 1 | pfleura2 | TAU = ZERO |
| 305 | 1 | pfleura2 | * |
| 306 | 1 | pfleura2 | ITER = 2 |
| 307 | 1 | pfleura2 | NFAIL = 0 |
| 308 | 1 | pfleura2 | NDIV = 2*( N0-I0 ) |
| 309 | 1 | pfleura2 | * |
| 310 | 1 | pfleura2 | DO 160 IWHILA = 1, N + 1 |
| 311 | 1 | pfleura2 | IF( N0.LT.1 ) |
| 312 | 1 | pfleura2 | $ GO TO 170 |
| 313 | 1 | pfleura2 | * |
| 314 | 1 | pfleura2 | * While array unfinished do |
| 315 | 1 | pfleura2 | * |
| 316 | 1 | pfleura2 | * E(N0) holds the value of SIGMA when submatrix in I0:N0 |
| 317 | 1 | pfleura2 | * splits from the rest of the array, but is negated. |
| 318 | 1 | pfleura2 | * |
| 319 | 1 | pfleura2 | DESIG = ZERO |
| 320 | 1 | pfleura2 | IF( N0.EQ.N ) THEN |
| 321 | 1 | pfleura2 | SIGMA = ZERO |
| 322 | 1 | pfleura2 | ELSE |
| 323 | 1 | pfleura2 | SIGMA = -Z( 4*N0-1 ) |
| 324 | 1 | pfleura2 | END IF |
| 325 | 1 | pfleura2 | IF( SIGMA.LT.ZERO ) THEN |
| 326 | 1 | pfleura2 | INFO = 1 |
| 327 | 1 | pfleura2 | RETURN |
| 328 | 1 | pfleura2 | END IF |
| 329 | 1 | pfleura2 | * |
| 330 | 1 | pfleura2 | * Find last unreduced submatrix's top index I0, find QMAX and |
| 331 | 1 | pfleura2 | * EMIN. Find Gershgorin-type bound if Q's much greater than E's. |
| 332 | 1 | pfleura2 | * |
| 333 | 1 | pfleura2 | EMAX = ZERO |
| 334 | 1 | pfleura2 | IF( N0.GT.I0 ) THEN |
| 335 | 1 | pfleura2 | EMIN = ABS( Z( 4*N0-5 ) ) |
| 336 | 1 | pfleura2 | ELSE |
| 337 | 1 | pfleura2 | EMIN = ZERO |
| 338 | 1 | pfleura2 | END IF |
| 339 | 1 | pfleura2 | QMIN = Z( 4*N0-3 ) |
| 340 | 1 | pfleura2 | QMAX = QMIN |
| 341 | 1 | pfleura2 | DO 90 I4 = 4*N0, 8, -4 |
| 342 | 1 | pfleura2 | IF( Z( I4-5 ).LE.ZERO ) |
| 343 | 1 | pfleura2 | $ GO TO 100 |
| 344 | 1 | pfleura2 | IF( QMIN.GE.FOUR*EMAX ) THEN |
| 345 | 1 | pfleura2 | QMIN = MIN( QMIN, Z( I4-3 ) ) |
| 346 | 1 | pfleura2 | EMAX = MAX( EMAX, Z( I4-5 ) ) |
| 347 | 1 | pfleura2 | END IF |
| 348 | 1 | pfleura2 | QMAX = MAX( QMAX, Z( I4-7 )+Z( I4-5 ) ) |
| 349 | 1 | pfleura2 | EMIN = MIN( EMIN, Z( I4-5 ) ) |
| 350 | 1 | pfleura2 | 90 CONTINUE |
| 351 | 1 | pfleura2 | I4 = 4 |
| 352 | 1 | pfleura2 | * |
| 353 | 1 | pfleura2 | 100 CONTINUE |
| 354 | 1 | pfleura2 | I0 = I4 / 4 |
| 355 | 1 | pfleura2 | PP = 0 |
| 356 | 1 | pfleura2 | * |
| 357 | 1 | pfleura2 | IF( N0-I0.GT.1 ) THEN |
| 358 | 1 | pfleura2 | DEE = Z( 4*I0-3 ) |
| 359 | 1 | pfleura2 | DEEMIN = DEE |
| 360 | 1 | pfleura2 | KMIN = I0 |
| 361 | 1 | pfleura2 | DO 110 I4 = 4*I0+1, 4*N0-3, 4 |
| 362 | 1 | pfleura2 | DEE = Z( I4 )*( DEE /( DEE+Z( I4-2 ) ) ) |
| 363 | 1 | pfleura2 | IF( DEE.LE.DEEMIN ) THEN |
| 364 | 1 | pfleura2 | DEEMIN = DEE |
| 365 | 1 | pfleura2 | KMIN = ( I4+3 )/4 |
| 366 | 1 | pfleura2 | END IF |
| 367 | 1 | pfleura2 | 110 CONTINUE |
| 368 | 1 | pfleura2 | IF( (KMIN-I0)*2.LT.N0-KMIN .AND. |
| 369 | 1 | pfleura2 | $ DEEMIN.LE.HALF*Z(4*N0-3) ) THEN |
| 370 | 1 | pfleura2 | IPN4 = 4*( I0+N0 ) |
| 371 | 1 | pfleura2 | PP = 2 |
| 372 | 1 | pfleura2 | DO 120 I4 = 4*I0, 2*( I0+N0-1 ), 4 |
| 373 | 1 | pfleura2 | TEMP = Z( I4-3 ) |
| 374 | 1 | pfleura2 | Z( I4-3 ) = Z( IPN4-I4-3 ) |
| 375 | 1 | pfleura2 | Z( IPN4-I4-3 ) = TEMP |
| 376 | 1 | pfleura2 | TEMP = Z( I4-2 ) |
| 377 | 1 | pfleura2 | Z( I4-2 ) = Z( IPN4-I4-2 ) |
| 378 | 1 | pfleura2 | Z( IPN4-I4-2 ) = TEMP |
| 379 | 1 | pfleura2 | TEMP = Z( I4-1 ) |
| 380 | 1 | pfleura2 | Z( I4-1 ) = Z( IPN4-I4-5 ) |
| 381 | 1 | pfleura2 | Z( IPN4-I4-5 ) = TEMP |
| 382 | 1 | pfleura2 | TEMP = Z( I4 ) |
| 383 | 1 | pfleura2 | Z( I4 ) = Z( IPN4-I4-4 ) |
| 384 | 1 | pfleura2 | Z( IPN4-I4-4 ) = TEMP |
| 385 | 1 | pfleura2 | 120 CONTINUE |
| 386 | 1 | pfleura2 | END IF |
| 387 | 1 | pfleura2 | END IF |
| 388 | 1 | pfleura2 | * |
| 389 | 1 | pfleura2 | * Put -(initial shift) into DMIN. |
| 390 | 1 | pfleura2 | * |
| 391 | 1 | pfleura2 | DMIN = -MAX( ZERO, QMIN-TWO*SQRT( QMIN )*SQRT( EMAX ) ) |
| 392 | 1 | pfleura2 | * |
| 393 | 1 | pfleura2 | * Now I0:N0 is unreduced. |
| 394 | 1 | pfleura2 | * PP = 0 for ping, PP = 1 for pong. |
| 395 | 1 | pfleura2 | * PP = 2 indicates that flipping was applied to the Z array and |
| 396 | 1 | pfleura2 | * and that the tests for deflation upon entry in DLASQ3 |
| 397 | 1 | pfleura2 | * should not be performed. |
| 398 | 1 | pfleura2 | * |
| 399 | 1 | pfleura2 | NBIG = 30*( N0-I0+1 ) |
| 400 | 1 | pfleura2 | DO 140 IWHILB = 1, NBIG |
| 401 | 1 | pfleura2 | IF( I0.GT.N0 ) |
| 402 | 1 | pfleura2 | $ GO TO 150 |
| 403 | 1 | pfleura2 | * |
| 404 | 1 | pfleura2 | * While submatrix unfinished take a good dqds step. |
| 405 | 1 | pfleura2 | * |
| 406 | 1 | pfleura2 | CALL DLASQ3( I0, N0, Z, PP, DMIN, SIGMA, DESIG, QMAX, NFAIL, |
| 407 | 1 | pfleura2 | $ ITER, NDIV, IEEE, TTYPE, DMIN1, DMIN2, DN, DN1, |
| 408 | 1 | pfleura2 | $ DN2, G, TAU ) |
| 409 | 1 | pfleura2 | * |
| 410 | 1 | pfleura2 | PP = 1 - PP |
| 411 | 1 | pfleura2 | * |
| 412 | 1 | pfleura2 | * When EMIN is very small check for splits. |
| 413 | 1 | pfleura2 | * |
| 414 | 1 | pfleura2 | IF( PP.EQ.0 .AND. N0-I0.GE.3 ) THEN |
| 415 | 1 | pfleura2 | IF( Z( 4*N0 ).LE.TOL2*QMAX .OR. |
| 416 | 1 | pfleura2 | $ Z( 4*N0-1 ).LE.TOL2*SIGMA ) THEN |
| 417 | 1 | pfleura2 | SPLT = I0 - 1 |
| 418 | 1 | pfleura2 | QMAX = Z( 4*I0-3 ) |
| 419 | 1 | pfleura2 | EMIN = Z( 4*I0-1 ) |
| 420 | 1 | pfleura2 | OLDEMN = Z( 4*I0 ) |
| 421 | 1 | pfleura2 | DO 130 I4 = 4*I0, 4*( N0-3 ), 4 |
| 422 | 1 | pfleura2 | IF( Z( I4 ).LE.TOL2*Z( I4-3 ) .OR. |
| 423 | 1 | pfleura2 | $ Z( I4-1 ).LE.TOL2*SIGMA ) THEN |
| 424 | 1 | pfleura2 | Z( I4-1 ) = -SIGMA |
| 425 | 1 | pfleura2 | SPLT = I4 / 4 |
| 426 | 1 | pfleura2 | QMAX = ZERO |
| 427 | 1 | pfleura2 | EMIN = Z( I4+3 ) |
| 428 | 1 | pfleura2 | OLDEMN = Z( I4+4 ) |
| 429 | 1 | pfleura2 | ELSE |
| 430 | 1 | pfleura2 | QMAX = MAX( QMAX, Z( I4+1 ) ) |
| 431 | 1 | pfleura2 | EMIN = MIN( EMIN, Z( I4-1 ) ) |
| 432 | 1 | pfleura2 | OLDEMN = MIN( OLDEMN, Z( I4 ) ) |
| 433 | 1 | pfleura2 | END IF |
| 434 | 1 | pfleura2 | 130 CONTINUE |
| 435 | 1 | pfleura2 | Z( 4*N0-1 ) = EMIN |
| 436 | 1 | pfleura2 | Z( 4*N0 ) = OLDEMN |
| 437 | 1 | pfleura2 | I0 = SPLT + 1 |
| 438 | 1 | pfleura2 | END IF |
| 439 | 1 | pfleura2 | END IF |
| 440 | 1 | pfleura2 | * |
| 441 | 1 | pfleura2 | 140 CONTINUE |
| 442 | 1 | pfleura2 | * |
| 443 | 1 | pfleura2 | INFO = 2 |
| 444 | 1 | pfleura2 | RETURN |
| 445 | 1 | pfleura2 | * |
| 446 | 1 | pfleura2 | * end IWHILB |
| 447 | 1 | pfleura2 | * |
| 448 | 1 | pfleura2 | 150 CONTINUE |
| 449 | 1 | pfleura2 | * |
| 450 | 1 | pfleura2 | 160 CONTINUE |
| 451 | 1 | pfleura2 | * |
| 452 | 1 | pfleura2 | INFO = 3 |
| 453 | 1 | pfleura2 | RETURN |
| 454 | 1 | pfleura2 | * |
| 455 | 1 | pfleura2 | * end IWHILA |
| 456 | 1 | pfleura2 | * |
| 457 | 1 | pfleura2 | 170 CONTINUE |
| 458 | 1 | pfleura2 | * |
| 459 | 1 | pfleura2 | * Move q's to the front. |
| 460 | 1 | pfleura2 | * |
| 461 | 1 | pfleura2 | DO 180 K = 2, N |
| 462 | 1 | pfleura2 | Z( K ) = Z( 4*K-3 ) |
| 463 | 1 | pfleura2 | 180 CONTINUE |
| 464 | 1 | pfleura2 | * |
| 465 | 1 | pfleura2 | * Sort and compute sum of eigenvalues. |
| 466 | 1 | pfleura2 | * |
| 467 | 1 | pfleura2 | CALL DLASRT( 'D', N, Z, IINFO ) |
| 468 | 1 | pfleura2 | * |
| 469 | 1 | pfleura2 | E = ZERO |
| 470 | 1 | pfleura2 | DO 190 K = N, 1, -1 |
| 471 | 1 | pfleura2 | E = E + Z( K ) |
| 472 | 1 | pfleura2 | 190 CONTINUE |
| 473 | 1 | pfleura2 | * |
| 474 | 1 | pfleura2 | * Store trace, sum(eigenvalues) and information on performance. |
| 475 | 1 | pfleura2 | * |
| 476 | 1 | pfleura2 | Z( 2*N+1 ) = TRACE |
| 477 | 1 | pfleura2 | Z( 2*N+2 ) = E |
| 478 | 1 | pfleura2 | Z( 2*N+3 ) = DBLE( ITER ) |
| 479 | 1 | pfleura2 | Z( 2*N+4 ) = DBLE( NDIV ) / DBLE( N**2 ) |
| 480 | 1 | pfleura2 | Z( 2*N+5 ) = HUNDRD*NFAIL / DBLE( ITER ) |
| 481 | 1 | pfleura2 | RETURN |
| 482 | 1 | pfleura2 | * |
| 483 | 1 | pfleura2 | * End of DLASQ2 |
| 484 | 1 | pfleura2 | * |
| 485 | 1 | pfleura2 | END |