root / src / lapack / double / dlasq3.f @ 3
Historique | Voir | Annoter | Télécharger (8,21 ko)
| 1 | 1 | pfleura2 | SUBROUTINE DLASQ3( I0, N0, Z, PP, DMIN, SIGMA, DESIG, QMAX, NFAIL, |
|---|---|---|---|
| 2 | 1 | pfleura2 | $ ITER, NDIV, IEEE, TTYPE, DMIN1, DMIN2, DN, DN1, |
| 3 | 1 | pfleura2 | $ DN2, G, TAU ) |
| 4 | 1 | pfleura2 | * |
| 5 | 1 | pfleura2 | * -- LAPACK routine (version 3.2.2) -- |
| 6 | 1 | pfleura2 | * |
| 7 | 1 | pfleura2 | * -- Contributed by Osni Marques of the Lawrence Berkeley National -- |
| 8 | 1 | pfleura2 | * -- Laboratory and Beresford Parlett of the Univ. of California at -- |
| 9 | 1 | pfleura2 | * -- Berkeley -- |
| 10 | 1 | pfleura2 | * -- June 2010 -- |
| 11 | 1 | pfleura2 | * |
| 12 | 1 | pfleura2 | * -- LAPACK is a software package provided by Univ. of Tennessee, -- |
| 13 | 1 | pfleura2 | * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- |
| 14 | 1 | pfleura2 | * |
| 15 | 1 | pfleura2 | * .. Scalar Arguments .. |
| 16 | 1 | pfleura2 | LOGICAL IEEE |
| 17 | 1 | pfleura2 | INTEGER I0, ITER, N0, NDIV, NFAIL, PP |
| 18 | 1 | pfleura2 | DOUBLE PRECISION DESIG, DMIN, DMIN1, DMIN2, DN, DN1, DN2, G, |
| 19 | 1 | pfleura2 | $ QMAX, SIGMA, TAU |
| 20 | 1 | pfleura2 | * .. |
| 21 | 1 | pfleura2 | * .. Array Arguments .. |
| 22 | 1 | pfleura2 | DOUBLE PRECISION Z( * ) |
| 23 | 1 | pfleura2 | * .. |
| 24 | 1 | pfleura2 | * |
| 25 | 1 | pfleura2 | * Purpose |
| 26 | 1 | pfleura2 | * ======= |
| 27 | 1 | pfleura2 | * |
| 28 | 1 | pfleura2 | * DLASQ3 checks for deflation, computes a shift (TAU) and calls dqds. |
| 29 | 1 | pfleura2 | * In case of failure it changes shifts, and tries again until output |
| 30 | 1 | pfleura2 | * is positive. |
| 31 | 1 | pfleura2 | * |
| 32 | 1 | pfleura2 | * Arguments |
| 33 | 1 | pfleura2 | * ========= |
| 34 | 1 | pfleura2 | * |
| 35 | 1 | pfleura2 | * I0 (input) INTEGER |
| 36 | 1 | pfleura2 | * First index. |
| 37 | 1 | pfleura2 | * |
| 38 | 1 | pfleura2 | * N0 (input/output) INTEGER |
| 39 | 1 | pfleura2 | * Last index. |
| 40 | 1 | pfleura2 | * |
| 41 | 1 | pfleura2 | * Z (input) DOUBLE PRECISION array, dimension ( 4*N ) |
| 42 | 1 | pfleura2 | * Z holds the qd array. |
| 43 | 1 | pfleura2 | * |
| 44 | 1 | pfleura2 | * PP (input/output) INTEGER |
| 45 | 1 | pfleura2 | * PP=0 for ping, PP=1 for pong. |
| 46 | 1 | pfleura2 | * PP=2 indicates that flipping was applied to the Z array |
| 47 | 1 | pfleura2 | * and that the initial tests for deflation should not be |
| 48 | 1 | pfleura2 | * performed. |
| 49 | 1 | pfleura2 | * |
| 50 | 1 | pfleura2 | * DMIN (output) DOUBLE PRECISION |
| 51 | 1 | pfleura2 | * Minimum value of d. |
| 52 | 1 | pfleura2 | * |
| 53 | 1 | pfleura2 | * SIGMA (output) DOUBLE PRECISION |
| 54 | 1 | pfleura2 | * Sum of shifts used in current segment. |
| 55 | 1 | pfleura2 | * |
| 56 | 1 | pfleura2 | * DESIG (input/output) DOUBLE PRECISION |
| 57 | 1 | pfleura2 | * Lower order part of SIGMA |
| 58 | 1 | pfleura2 | * |
| 59 | 1 | pfleura2 | * QMAX (input) DOUBLE PRECISION |
| 60 | 1 | pfleura2 | * Maximum value of q. |
| 61 | 1 | pfleura2 | * |
| 62 | 1 | pfleura2 | * NFAIL (output) INTEGER |
| 63 | 1 | pfleura2 | * Number of times shift was too big. |
| 64 | 1 | pfleura2 | * |
| 65 | 1 | pfleura2 | * ITER (output) INTEGER |
| 66 | 1 | pfleura2 | * Number of iterations. |
| 67 | 1 | pfleura2 | * |
| 68 | 1 | pfleura2 | * NDIV (output) INTEGER |
| 69 | 1 | pfleura2 | * Number of divisions. |
| 70 | 1 | pfleura2 | * |
| 71 | 1 | pfleura2 | * IEEE (input) LOGICAL |
| 72 | 1 | pfleura2 | * Flag for IEEE or non IEEE arithmetic (passed to DLASQ5). |
| 73 | 1 | pfleura2 | * |
| 74 | 1 | pfleura2 | * TTYPE (input/output) INTEGER |
| 75 | 1 | pfleura2 | * Shift type. |
| 76 | 1 | pfleura2 | * |
| 77 | 1 | pfleura2 | * DMIN1 (input/output) DOUBLE PRECISION |
| 78 | 1 | pfleura2 | * |
| 79 | 1 | pfleura2 | * DMIN2 (input/output) DOUBLE PRECISION |
| 80 | 1 | pfleura2 | * |
| 81 | 1 | pfleura2 | * DN (input/output) DOUBLE PRECISION |
| 82 | 1 | pfleura2 | * |
| 83 | 1 | pfleura2 | * DN1 (input/output) DOUBLE PRECISION |
| 84 | 1 | pfleura2 | * |
| 85 | 1 | pfleura2 | * DN2 (input/output) DOUBLE PRECISION |
| 86 | 1 | pfleura2 | * |
| 87 | 1 | pfleura2 | * G (input/output) DOUBLE PRECISION |
| 88 | 1 | pfleura2 | * |
| 89 | 1 | pfleura2 | * TAU (input/output) DOUBLE PRECISION |
| 90 | 1 | pfleura2 | * |
| 91 | 1 | pfleura2 | * These are passed as arguments in order to save their values |
| 92 | 1 | pfleura2 | * between calls to DLASQ3. |
| 93 | 1 | pfleura2 | * |
| 94 | 1 | pfleura2 | * ===================================================================== |
| 95 | 1 | pfleura2 | * |
| 96 | 1 | pfleura2 | * .. Parameters .. |
| 97 | 1 | pfleura2 | DOUBLE PRECISION CBIAS |
| 98 | 1 | pfleura2 | PARAMETER ( CBIAS = 1.50D0 ) |
| 99 | 1 | pfleura2 | DOUBLE PRECISION ZERO, QURTR, HALF, ONE, TWO, HUNDRD |
| 100 | 1 | pfleura2 | PARAMETER ( ZERO = 0.0D0, QURTR = 0.250D0, HALF = 0.5D0, |
| 101 | 1 | pfleura2 | $ ONE = 1.0D0, TWO = 2.0D0, HUNDRD = 100.0D0 ) |
| 102 | 1 | pfleura2 | * .. |
| 103 | 1 | pfleura2 | * .. Local Scalars .. |
| 104 | 1 | pfleura2 | INTEGER IPN4, J4, N0IN, NN, TTYPE |
| 105 | 1 | pfleura2 | DOUBLE PRECISION EPS, S, T, TEMP, TOL, TOL2 |
| 106 | 1 | pfleura2 | * .. |
| 107 | 1 | pfleura2 | * .. External Subroutines .. |
| 108 | 1 | pfleura2 | EXTERNAL DLASQ4, DLASQ5, DLASQ6 |
| 109 | 1 | pfleura2 | * .. |
| 110 | 1 | pfleura2 | * .. External Function .. |
| 111 | 1 | pfleura2 | DOUBLE PRECISION DLAMCH |
| 112 | 1 | pfleura2 | LOGICAL DISNAN |
| 113 | 1 | pfleura2 | EXTERNAL DISNAN, DLAMCH |
| 114 | 1 | pfleura2 | * .. |
| 115 | 1 | pfleura2 | * .. Intrinsic Functions .. |
| 116 | 1 | pfleura2 | INTRINSIC ABS, MAX, MIN, SQRT |
| 117 | 1 | pfleura2 | * .. |
| 118 | 1 | pfleura2 | * .. Executable Statements .. |
| 119 | 1 | pfleura2 | * |
| 120 | 1 | pfleura2 | N0IN = N0 |
| 121 | 1 | pfleura2 | EPS = DLAMCH( 'Precision' ) |
| 122 | 1 | pfleura2 | TOL = EPS*HUNDRD |
| 123 | 1 | pfleura2 | TOL2 = TOL**2 |
| 124 | 1 | pfleura2 | * |
| 125 | 1 | pfleura2 | * Check for deflation. |
| 126 | 1 | pfleura2 | * |
| 127 | 1 | pfleura2 | 10 CONTINUE |
| 128 | 1 | pfleura2 | * |
| 129 | 1 | pfleura2 | IF( N0.LT.I0 ) |
| 130 | 1 | pfleura2 | $ RETURN |
| 131 | 1 | pfleura2 | IF( N0.EQ.I0 ) |
| 132 | 1 | pfleura2 | $ GO TO 20 |
| 133 | 1 | pfleura2 | NN = 4*N0 + PP |
| 134 | 1 | pfleura2 | IF( N0.EQ.( I0+1 ) ) |
| 135 | 1 | pfleura2 | $ GO TO 40 |
| 136 | 1 | pfleura2 | * |
| 137 | 1 | pfleura2 | * Check whether E(N0-1) is negligible, 1 eigenvalue. |
| 138 | 1 | pfleura2 | * |
| 139 | 1 | pfleura2 | IF( Z( NN-5 ).GT.TOL2*( SIGMA+Z( NN-3 ) ) .AND. |
| 140 | 1 | pfleura2 | $ Z( NN-2*PP-4 ).GT.TOL2*Z( NN-7 ) ) |
| 141 | 1 | pfleura2 | $ GO TO 30 |
| 142 | 1 | pfleura2 | * |
| 143 | 1 | pfleura2 | 20 CONTINUE |
| 144 | 1 | pfleura2 | * |
| 145 | 1 | pfleura2 | Z( 4*N0-3 ) = Z( 4*N0+PP-3 ) + SIGMA |
| 146 | 1 | pfleura2 | N0 = N0 - 1 |
| 147 | 1 | pfleura2 | GO TO 10 |
| 148 | 1 | pfleura2 | * |
| 149 | 1 | pfleura2 | * Check whether E(N0-2) is negligible, 2 eigenvalues. |
| 150 | 1 | pfleura2 | * |
| 151 | 1 | pfleura2 | 30 CONTINUE |
| 152 | 1 | pfleura2 | * |
| 153 | 1 | pfleura2 | IF( Z( NN-9 ).GT.TOL2*SIGMA .AND. |
| 154 | 1 | pfleura2 | $ Z( NN-2*PP-8 ).GT.TOL2*Z( NN-11 ) ) |
| 155 | 1 | pfleura2 | $ GO TO 50 |
| 156 | 1 | pfleura2 | * |
| 157 | 1 | pfleura2 | 40 CONTINUE |
| 158 | 1 | pfleura2 | * |
| 159 | 1 | pfleura2 | IF( Z( NN-3 ).GT.Z( NN-7 ) ) THEN |
| 160 | 1 | pfleura2 | S = Z( NN-3 ) |
| 161 | 1 | pfleura2 | Z( NN-3 ) = Z( NN-7 ) |
| 162 | 1 | pfleura2 | Z( NN-7 ) = S |
| 163 | 1 | pfleura2 | END IF |
| 164 | 1 | pfleura2 | IF( Z( NN-5 ).GT.Z( NN-3 )*TOL2 ) THEN |
| 165 | 1 | pfleura2 | T = HALF*( ( Z( NN-7 )-Z( NN-3 ) )+Z( NN-5 ) ) |
| 166 | 1 | pfleura2 | S = Z( NN-3 )*( Z( NN-5 ) / T ) |
| 167 | 1 | pfleura2 | IF( S.LE.T ) THEN |
| 168 | 1 | pfleura2 | S = Z( NN-3 )*( Z( NN-5 ) / |
| 169 | 1 | pfleura2 | $ ( T*( ONE+SQRT( ONE+S / T ) ) ) ) |
| 170 | 1 | pfleura2 | ELSE |
| 171 | 1 | pfleura2 | S = Z( NN-3 )*( Z( NN-5 ) / ( T+SQRT( T )*SQRT( T+S ) ) ) |
| 172 | 1 | pfleura2 | END IF |
| 173 | 1 | pfleura2 | T = Z( NN-7 ) + ( S+Z( NN-5 ) ) |
| 174 | 1 | pfleura2 | Z( NN-3 ) = Z( NN-3 )*( Z( NN-7 ) / T ) |
| 175 | 1 | pfleura2 | Z( NN-7 ) = T |
| 176 | 1 | pfleura2 | END IF |
| 177 | 1 | pfleura2 | Z( 4*N0-7 ) = Z( NN-7 ) + SIGMA |
| 178 | 1 | pfleura2 | Z( 4*N0-3 ) = Z( NN-3 ) + SIGMA |
| 179 | 1 | pfleura2 | N0 = N0 - 2 |
| 180 | 1 | pfleura2 | GO TO 10 |
| 181 | 1 | pfleura2 | * |
| 182 | 1 | pfleura2 | 50 CONTINUE |
| 183 | 1 | pfleura2 | IF( PP.EQ.2 ) |
| 184 | 1 | pfleura2 | $ PP = 0 |
| 185 | 1 | pfleura2 | * |
| 186 | 1 | pfleura2 | * Reverse the qd-array, if warranted. |
| 187 | 1 | pfleura2 | * |
| 188 | 1 | pfleura2 | IF( DMIN.LE.ZERO .OR. N0.LT.N0IN ) THEN |
| 189 | 1 | pfleura2 | IF( CBIAS*Z( 4*I0+PP-3 ).LT.Z( 4*N0+PP-3 ) ) THEN |
| 190 | 1 | pfleura2 | IPN4 = 4*( I0+N0 ) |
| 191 | 1 | pfleura2 | DO 60 J4 = 4*I0, 2*( I0+N0-1 ), 4 |
| 192 | 1 | pfleura2 | TEMP = Z( J4-3 ) |
| 193 | 1 | pfleura2 | Z( J4-3 ) = Z( IPN4-J4-3 ) |
| 194 | 1 | pfleura2 | Z( IPN4-J4-3 ) = TEMP |
| 195 | 1 | pfleura2 | TEMP = Z( J4-2 ) |
| 196 | 1 | pfleura2 | Z( J4-2 ) = Z( IPN4-J4-2 ) |
| 197 | 1 | pfleura2 | Z( IPN4-J4-2 ) = TEMP |
| 198 | 1 | pfleura2 | TEMP = Z( J4-1 ) |
| 199 | 1 | pfleura2 | Z( J4-1 ) = Z( IPN4-J4-5 ) |
| 200 | 1 | pfleura2 | Z( IPN4-J4-5 ) = TEMP |
| 201 | 1 | pfleura2 | TEMP = Z( J4 ) |
| 202 | 1 | pfleura2 | Z( J4 ) = Z( IPN4-J4-4 ) |
| 203 | 1 | pfleura2 | Z( IPN4-J4-4 ) = TEMP |
| 204 | 1 | pfleura2 | 60 CONTINUE |
| 205 | 1 | pfleura2 | IF( N0-I0.LE.4 ) THEN |
| 206 | 1 | pfleura2 | Z( 4*N0+PP-1 ) = Z( 4*I0+PP-1 ) |
| 207 | 1 | pfleura2 | Z( 4*N0-PP ) = Z( 4*I0-PP ) |
| 208 | 1 | pfleura2 | END IF |
| 209 | 1 | pfleura2 | DMIN2 = MIN( DMIN2, Z( 4*N0+PP-1 ) ) |
| 210 | 1 | pfleura2 | Z( 4*N0+PP-1 ) = MIN( Z( 4*N0+PP-1 ), Z( 4*I0+PP-1 ), |
| 211 | 1 | pfleura2 | $ Z( 4*I0+PP+3 ) ) |
| 212 | 1 | pfleura2 | Z( 4*N0-PP ) = MIN( Z( 4*N0-PP ), Z( 4*I0-PP ), |
| 213 | 1 | pfleura2 | $ Z( 4*I0-PP+4 ) ) |
| 214 | 1 | pfleura2 | QMAX = MAX( QMAX, Z( 4*I0+PP-3 ), Z( 4*I0+PP+1 ) ) |
| 215 | 1 | pfleura2 | DMIN = -ZERO |
| 216 | 1 | pfleura2 | END IF |
| 217 | 1 | pfleura2 | END IF |
| 218 | 1 | pfleura2 | * |
| 219 | 1 | pfleura2 | * Choose a shift. |
| 220 | 1 | pfleura2 | * |
| 221 | 1 | pfleura2 | CALL DLASQ4( I0, N0, Z, PP, N0IN, DMIN, DMIN1, DMIN2, DN, DN1, |
| 222 | 1 | pfleura2 | $ DN2, TAU, TTYPE, G ) |
| 223 | 1 | pfleura2 | * |
| 224 | 1 | pfleura2 | * Call dqds until DMIN > 0. |
| 225 | 1 | pfleura2 | * |
| 226 | 1 | pfleura2 | 70 CONTINUE |
| 227 | 1 | pfleura2 | * |
| 228 | 1 | pfleura2 | CALL DLASQ5( I0, N0, Z, PP, TAU, DMIN, DMIN1, DMIN2, DN, |
| 229 | 1 | pfleura2 | $ DN1, DN2, IEEE ) |
| 230 | 1 | pfleura2 | * |
| 231 | 1 | pfleura2 | NDIV = NDIV + ( N0-I0+2 ) |
| 232 | 1 | pfleura2 | ITER = ITER + 1 |
| 233 | 1 | pfleura2 | * |
| 234 | 1 | pfleura2 | * Check status. |
| 235 | 1 | pfleura2 | * |
| 236 | 1 | pfleura2 | IF( DMIN.GE.ZERO .AND. DMIN1.GT.ZERO ) THEN |
| 237 | 1 | pfleura2 | * |
| 238 | 1 | pfleura2 | * Success. |
| 239 | 1 | pfleura2 | * |
| 240 | 1 | pfleura2 | GO TO 90 |
| 241 | 1 | pfleura2 | * |
| 242 | 1 | pfleura2 | ELSE IF( DMIN.LT.ZERO .AND. DMIN1.GT.ZERO .AND. |
| 243 | 1 | pfleura2 | $ Z( 4*( N0-1 )-PP ).LT.TOL*( SIGMA+DN1 ) .AND. |
| 244 | 1 | pfleura2 | $ ABS( DN ).LT.TOL*SIGMA ) THEN |
| 245 | 1 | pfleura2 | * |
| 246 | 1 | pfleura2 | * Convergence hidden by negative DN. |
| 247 | 1 | pfleura2 | * |
| 248 | 1 | pfleura2 | Z( 4*( N0-1 )-PP+2 ) = ZERO |
| 249 | 1 | pfleura2 | DMIN = ZERO |
| 250 | 1 | pfleura2 | GO TO 90 |
| 251 | 1 | pfleura2 | ELSE IF( DMIN.LT.ZERO ) THEN |
| 252 | 1 | pfleura2 | * |
| 253 | 1 | pfleura2 | * TAU too big. Select new TAU and try again. |
| 254 | 1 | pfleura2 | * |
| 255 | 1 | pfleura2 | NFAIL = NFAIL + 1 |
| 256 | 1 | pfleura2 | IF( TTYPE.LT.-22 ) THEN |
| 257 | 1 | pfleura2 | * |
| 258 | 1 | pfleura2 | * Failed twice. Play it safe. |
| 259 | 1 | pfleura2 | * |
| 260 | 1 | pfleura2 | TAU = ZERO |
| 261 | 1 | pfleura2 | ELSE IF( DMIN1.GT.ZERO ) THEN |
| 262 | 1 | pfleura2 | * |
| 263 | 1 | pfleura2 | * Late failure. Gives excellent shift. |
| 264 | 1 | pfleura2 | * |
| 265 | 1 | pfleura2 | TAU = ( TAU+DMIN )*( ONE-TWO*EPS ) |
| 266 | 1 | pfleura2 | TTYPE = TTYPE - 11 |
| 267 | 1 | pfleura2 | ELSE |
| 268 | 1 | pfleura2 | * |
| 269 | 1 | pfleura2 | * Early failure. Divide by 4. |
| 270 | 1 | pfleura2 | * |
| 271 | 1 | pfleura2 | TAU = QURTR*TAU |
| 272 | 1 | pfleura2 | TTYPE = TTYPE - 12 |
| 273 | 1 | pfleura2 | END IF |
| 274 | 1 | pfleura2 | GO TO 70 |
| 275 | 1 | pfleura2 | ELSE IF( DISNAN( DMIN ) ) THEN |
| 276 | 1 | pfleura2 | * |
| 277 | 1 | pfleura2 | * NaN. |
| 278 | 1 | pfleura2 | * |
| 279 | 1 | pfleura2 | IF( TAU.EQ.ZERO ) THEN |
| 280 | 1 | pfleura2 | GO TO 80 |
| 281 | 1 | pfleura2 | ELSE |
| 282 | 1 | pfleura2 | TAU = ZERO |
| 283 | 1 | pfleura2 | GO TO 70 |
| 284 | 1 | pfleura2 | END IF |
| 285 | 1 | pfleura2 | ELSE |
| 286 | 1 | pfleura2 | * |
| 287 | 1 | pfleura2 | * Possible underflow. Play it safe. |
| 288 | 1 | pfleura2 | * |
| 289 | 1 | pfleura2 | GO TO 80 |
| 290 | 1 | pfleura2 | END IF |
| 291 | 1 | pfleura2 | * |
| 292 | 1 | pfleura2 | * Risk of underflow. |
| 293 | 1 | pfleura2 | * |
| 294 | 1 | pfleura2 | 80 CONTINUE |
| 295 | 1 | pfleura2 | CALL DLASQ6( I0, N0, Z, PP, DMIN, DMIN1, DMIN2, DN, DN1, DN2 ) |
| 296 | 1 | pfleura2 | NDIV = NDIV + ( N0-I0+2 ) |
| 297 | 1 | pfleura2 | ITER = ITER + 1 |
| 298 | 1 | pfleura2 | TAU = ZERO |
| 299 | 1 | pfleura2 | * |
| 300 | 1 | pfleura2 | 90 CONTINUE |
| 301 | 1 | pfleura2 | IF( TAU.LT.SIGMA ) THEN |
| 302 | 1 | pfleura2 | DESIG = DESIG + TAU |
| 303 | 1 | pfleura2 | T = SIGMA + DESIG |
| 304 | 1 | pfleura2 | DESIG = DESIG - ( T-SIGMA ) |
| 305 | 1 | pfleura2 | ELSE |
| 306 | 1 | pfleura2 | T = SIGMA + TAU |
| 307 | 1 | pfleura2 | DESIG = SIGMA - ( T-TAU ) + DESIG |
| 308 | 1 | pfleura2 | END IF |
| 309 | 1 | pfleura2 | SIGMA = T |
| 310 | 1 | pfleura2 | * |
| 311 | 1 | pfleura2 | RETURN |
| 312 | 1 | pfleura2 | * |
| 313 | 1 | pfleura2 | * End of DLASQ3 |
| 314 | 1 | pfleura2 | * |
| 315 | 1 | pfleura2 | END |