00001 SUBROUTINE SLAED4( N, I, D, Z, DELTA, RHO, DLAM, INFO )
00002
00003
00004
00005
00006
00007
00008
00009 INTEGER I, INFO, N
00010 REAL DLAM, RHO
00011
00012
00013 REAL D( * ), DELTA( * ), Z( * )
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092 INTEGER MAXIT
00093 PARAMETER ( MAXIT = 30 )
00094 REAL ZERO, ONE, TWO, THREE, FOUR, EIGHT, TEN
00095 PARAMETER ( ZERO = 0.0E0, ONE = 1.0E0, TWO = 2.0E0,
00096 $ THREE = 3.0E0, FOUR = 4.0E0, EIGHT = 8.0E0,
00097 $ TEN = 10.0E0 )
00098
00099
00100 LOGICAL ORGATI, SWTCH, SWTCH3
00101 INTEGER II, IIM1, IIP1, IP1, ITER, J, NITER
00102 REAL A, B, C, DEL, DLTLB, DLTUB, DPHI, DPSI, DW,
00103 $ EPS, ERRETM, ETA, MIDPT, PHI, PREW, PSI,
00104 $ RHOINV, TAU, TEMP, TEMP1, W
00105
00106
00107 REAL ZZ( 3 )
00108
00109
00110 REAL SLAMCH
00111 EXTERNAL SLAMCH
00112
00113
00114 EXTERNAL SLAED5, SLAED6
00115
00116
00117 INTRINSIC ABS, MAX, MIN, SQRT
00118
00119
00120
00121
00122
00123
00124
00125
00126 INFO = 0
00127 IF( N.EQ.1 ) THEN
00128
00129
00130
00131 DLAM = D( 1 ) + RHO*Z( 1 )*Z( 1 )
00132 DELTA( 1 ) = ONE
00133 RETURN
00134 END IF
00135 IF( N.EQ.2 ) THEN
00136 CALL SLAED5( I, D, Z, DELTA, RHO, DLAM )
00137 RETURN
00138 END IF
00139
00140
00141
00142 EPS = SLAMCH( 'Epsilon' )
00143 RHOINV = ONE / RHO
00144
00145
00146
00147 IF( I.EQ.N ) THEN
00148
00149
00150
00151 II = N - 1
00152 NITER = 1
00153
00154
00155
00156 MIDPT = RHO / TWO
00157
00158
00159
00160
00161 DO 10 J = 1, N
00162 DELTA( J ) = ( D( J )-D( I ) ) - MIDPT
00163 10 CONTINUE
00164
00165 PSI = ZERO
00166 DO 20 J = 1, N - 2
00167 PSI = PSI + Z( J )*Z( J ) / DELTA( J )
00168 20 CONTINUE
00169
00170 C = RHOINV + PSI
00171 W = C + Z( II )*Z( II ) / DELTA( II ) +
00172 $ Z( N )*Z( N ) / DELTA( N )
00173
00174 IF( W.LE.ZERO ) THEN
00175 TEMP = Z( N-1 )*Z( N-1 ) / ( D( N )-D( N-1 )+RHO ) +
00176 $ Z( N )*Z( N ) / RHO
00177 IF( C.LE.TEMP ) THEN
00178 TAU = RHO
00179 ELSE
00180 DEL = D( N ) - D( N-1 )
00181 A = -C*DEL + Z( N-1 )*Z( N-1 ) + Z( N )*Z( N )
00182 B = Z( N )*Z( N )*DEL
00183 IF( A.LT.ZERO ) THEN
00184 TAU = TWO*B / ( SQRT( A*A+FOUR*B*C )-A )
00185 ELSE
00186 TAU = ( A+SQRT( A*A+FOUR*B*C ) ) / ( TWO*C )
00187 END IF
00188 END IF
00189
00190
00191
00192
00193 DLTLB = MIDPT
00194 DLTUB = RHO
00195 ELSE
00196 DEL = D( N ) - D( N-1 )
00197 A = -C*DEL + Z( N-1 )*Z( N-1 ) + Z( N )*Z( N )
00198 B = Z( N )*Z( N )*DEL
00199 IF( A.LT.ZERO ) THEN
00200 TAU = TWO*B / ( SQRT( A*A+FOUR*B*C )-A )
00201 ELSE
00202 TAU = ( A+SQRT( A*A+FOUR*B*C ) ) / ( TWO*C )
00203 END IF
00204
00205
00206
00207
00208 DLTLB = ZERO
00209 DLTUB = MIDPT
00210 END IF
00211
00212 DO 30 J = 1, N
00213 DELTA( J ) = ( D( J )-D( I ) ) - TAU
00214 30 CONTINUE
00215
00216
00217
00218 DPSI = ZERO
00219 PSI = ZERO
00220 ERRETM = ZERO
00221 DO 40 J = 1, II
00222 TEMP = Z( J ) / DELTA( J )
00223 PSI = PSI + Z( J )*TEMP
00224 DPSI = DPSI + TEMP*TEMP
00225 ERRETM = ERRETM + PSI
00226 40 CONTINUE
00227 ERRETM = ABS( ERRETM )
00228
00229
00230
00231 TEMP = Z( N ) / DELTA( N )
00232 PHI = Z( N )*TEMP
00233 DPHI = TEMP*TEMP
00234 ERRETM = EIGHT*( -PHI-PSI ) + ERRETM - PHI + RHOINV +
00235 $ ABS( TAU )*( DPSI+DPHI )
00236
00237 W = RHOINV + PHI + PSI
00238
00239
00240
00241 IF( ABS( W ).LE.EPS*ERRETM ) THEN
00242 DLAM = D( I ) + TAU
00243 GO TO 250
00244 END IF
00245
00246 IF( W.LE.ZERO ) THEN
00247 DLTLB = MAX( DLTLB, TAU )
00248 ELSE
00249 DLTUB = MIN( DLTUB, TAU )
00250 END IF
00251
00252
00253
00254 NITER = NITER + 1
00255 C = W - DELTA( N-1 )*DPSI - DELTA( N )*DPHI
00256 A = ( DELTA( N-1 )+DELTA( N ) )*W -
00257 $ DELTA( N-1 )*DELTA( N )*( DPSI+DPHI )
00258 B = DELTA( N-1 )*DELTA( N )*W
00259 IF( C.LT.ZERO )
00260 $ C = ABS( C )
00261 IF( C.EQ.ZERO ) THEN
00262
00263
00264 ETA = DLTUB - TAU
00265 ELSE IF( A.GE.ZERO ) THEN
00266 ETA = ( A+SQRT( ABS( A*A-FOUR*B*C ) ) ) / ( TWO*C )
00267 ELSE
00268 ETA = TWO*B / ( A-SQRT( ABS( A*A-FOUR*B*C ) ) )
00269 END IF
00270
00271
00272
00273
00274
00275
00276
00277 IF( W*ETA.GT.ZERO )
00278 $ ETA = -W / ( DPSI+DPHI )
00279 TEMP = TAU + ETA
00280 IF( TEMP.GT.DLTUB .OR. TEMP.LT.DLTLB ) THEN
00281 IF( W.LT.ZERO ) THEN
00282 ETA = ( DLTUB-TAU ) / TWO
00283 ELSE
00284 ETA = ( DLTLB-TAU ) / TWO
00285 END IF
00286 END IF
00287 DO 50 J = 1, N
00288 DELTA( J ) = DELTA( J ) - ETA
00289 50 CONTINUE
00290
00291 TAU = TAU + ETA
00292
00293
00294
00295 DPSI = ZERO
00296 PSI = ZERO
00297 ERRETM = ZERO
00298 DO 60 J = 1, II
00299 TEMP = Z( J ) / DELTA( J )
00300 PSI = PSI + Z( J )*TEMP
00301 DPSI = DPSI + TEMP*TEMP
00302 ERRETM = ERRETM + PSI
00303 60 CONTINUE
00304 ERRETM = ABS( ERRETM )
00305
00306
00307
00308 TEMP = Z( N ) / DELTA( N )
00309 PHI = Z( N )*TEMP
00310 DPHI = TEMP*TEMP
00311 ERRETM = EIGHT*( -PHI-PSI ) + ERRETM - PHI + RHOINV +
00312 $ ABS( TAU )*( DPSI+DPHI )
00313
00314 W = RHOINV + PHI + PSI
00315
00316
00317
00318 ITER = NITER + 1
00319
00320 DO 90 NITER = ITER, MAXIT
00321
00322
00323
00324 IF( ABS( W ).LE.EPS*ERRETM ) THEN
00325 DLAM = D( I ) + TAU
00326 GO TO 250
00327 END IF
00328
00329 IF( W.LE.ZERO ) THEN
00330 DLTLB = MAX( DLTLB, TAU )
00331 ELSE
00332 DLTUB = MIN( DLTUB, TAU )
00333 END IF
00334
00335
00336
00337 C = W - DELTA( N-1 )*DPSI - DELTA( N )*DPHI
00338 A = ( DELTA( N-1 )+DELTA( N ) )*W -
00339 $ DELTA( N-1 )*DELTA( N )*( DPSI+DPHI )
00340 B = DELTA( N-1 )*DELTA( N )*W
00341 IF( A.GE.ZERO ) THEN
00342 ETA = ( A+SQRT( ABS( A*A-FOUR*B*C ) ) ) / ( TWO*C )
00343 ELSE
00344 ETA = TWO*B / ( A-SQRT( ABS( A*A-FOUR*B*C ) ) )
00345 END IF
00346
00347
00348
00349
00350
00351
00352
00353 IF( W*ETA.GT.ZERO )
00354 $ ETA = -W / ( DPSI+DPHI )
00355 TEMP = TAU + ETA
00356 IF( TEMP.GT.DLTUB .OR. TEMP.LT.DLTLB ) THEN
00357 IF( W.LT.ZERO ) THEN
00358 ETA = ( DLTUB-TAU ) / TWO
00359 ELSE
00360 ETA = ( DLTLB-TAU ) / TWO
00361 END IF
00362 END IF
00363 DO 70 J = 1, N
00364 DELTA( J ) = DELTA( J ) - ETA
00365 70 CONTINUE
00366
00367 TAU = TAU + ETA
00368
00369
00370
00371 DPSI = ZERO
00372 PSI = ZERO
00373 ERRETM = ZERO
00374 DO 80 J = 1, II
00375 TEMP = Z( J ) / DELTA( J )
00376 PSI = PSI + Z( J )*TEMP
00377 DPSI = DPSI + TEMP*TEMP
00378 ERRETM = ERRETM + PSI
00379 80 CONTINUE
00380 ERRETM = ABS( ERRETM )
00381
00382
00383
00384 TEMP = Z( N ) / DELTA( N )
00385 PHI = Z( N )*TEMP
00386 DPHI = TEMP*TEMP
00387 ERRETM = EIGHT*( -PHI-PSI ) + ERRETM - PHI + RHOINV +
00388 $ ABS( TAU )*( DPSI+DPHI )
00389
00390 W = RHOINV + PHI + PSI
00391 90 CONTINUE
00392
00393
00394
00395 INFO = 1
00396 DLAM = D( I ) + TAU
00397 GO TO 250
00398
00399
00400
00401 ELSE
00402
00403
00404
00405 NITER = 1
00406 IP1 = I + 1
00407
00408
00409
00410 DEL = D( IP1 ) - D( I )
00411 MIDPT = DEL / TWO
00412 DO 100 J = 1, N
00413 DELTA( J ) = ( D( J )-D( I ) ) - MIDPT
00414 100 CONTINUE
00415
00416 PSI = ZERO
00417 DO 110 J = 1, I - 1
00418 PSI = PSI + Z( J )*Z( J ) / DELTA( J )
00419 110 CONTINUE
00420
00421 PHI = ZERO
00422 DO 120 J = N, I + 2, -1
00423 PHI = PHI + Z( J )*Z( J ) / DELTA( J )
00424 120 CONTINUE
00425 C = RHOINV + PSI + PHI
00426 W = C + Z( I )*Z( I ) / DELTA( I ) +
00427 $ Z( IP1 )*Z( IP1 ) / DELTA( IP1 )
00428
00429 IF( W.GT.ZERO ) THEN
00430
00431
00432
00433
00434
00435 ORGATI = .TRUE.
00436 A = C*DEL + Z( I )*Z( I ) + Z( IP1 )*Z( IP1 )
00437 B = Z( I )*Z( I )*DEL
00438 IF( A.GT.ZERO ) THEN
00439 TAU = TWO*B / ( A+SQRT( ABS( A*A-FOUR*B*C ) ) )
00440 ELSE
00441 TAU = ( A-SQRT( ABS( A*A-FOUR*B*C ) ) ) / ( TWO*C )
00442 END IF
00443 DLTLB = ZERO
00444 DLTUB = MIDPT
00445 ELSE
00446
00447
00448
00449
00450
00451 ORGATI = .FALSE.
00452 A = C*DEL - Z( I )*Z( I ) - Z( IP1 )*Z( IP1 )
00453 B = Z( IP1 )*Z( IP1 )*DEL
00454 IF( A.LT.ZERO ) THEN
00455 TAU = TWO*B / ( A-SQRT( ABS( A*A+FOUR*B*C ) ) )
00456 ELSE
00457 TAU = -( A+SQRT( ABS( A*A+FOUR*B*C ) ) ) / ( TWO*C )
00458 END IF
00459 DLTLB = -MIDPT
00460 DLTUB = ZERO
00461 END IF
00462
00463 IF( ORGATI ) THEN
00464 DO 130 J = 1, N
00465 DELTA( J ) = ( D( J )-D( I ) ) - TAU
00466 130 CONTINUE
00467 ELSE
00468 DO 140 J = 1, N
00469 DELTA( J ) = ( D( J )-D( IP1 ) ) - TAU
00470 140 CONTINUE
00471 END IF
00472 IF( ORGATI ) THEN
00473 II = I
00474 ELSE
00475 II = I + 1
00476 END IF
00477 IIM1 = II - 1
00478 IIP1 = II + 1
00479
00480
00481
00482 DPSI = ZERO
00483 PSI = ZERO
00484 ERRETM = ZERO
00485 DO 150 J = 1, IIM1
00486 TEMP = Z( J ) / DELTA( J )
00487 PSI = PSI + Z( J )*TEMP
00488 DPSI = DPSI + TEMP*TEMP
00489 ERRETM = ERRETM + PSI
00490 150 CONTINUE
00491 ERRETM = ABS( ERRETM )
00492
00493
00494
00495 DPHI = ZERO
00496 PHI = ZERO
00497 DO 160 J = N, IIP1, -1
00498 TEMP = Z( J ) / DELTA( J )
00499 PHI = PHI + Z( J )*TEMP
00500 DPHI = DPHI + TEMP*TEMP
00501 ERRETM = ERRETM + PHI
00502 160 CONTINUE
00503
00504 W = RHOINV + PHI + PSI
00505
00506
00507
00508
00509 SWTCH3 = .FALSE.
00510 IF( ORGATI ) THEN
00511 IF( W.LT.ZERO )
00512 $ SWTCH3 = .TRUE.
00513 ELSE
00514 IF( W.GT.ZERO )
00515 $ SWTCH3 = .TRUE.
00516 END IF
00517 IF( II.EQ.1 .OR. II.EQ.N )
00518 $ SWTCH3 = .FALSE.
00519
00520 TEMP = Z( II ) / DELTA( II )
00521 DW = DPSI + DPHI + TEMP*TEMP
00522 TEMP = Z( II )*TEMP
00523 W = W + TEMP
00524 ERRETM = EIGHT*( PHI-PSI ) + ERRETM + TWO*RHOINV +
00525 $ THREE*ABS( TEMP ) + ABS( TAU )*DW
00526
00527
00528
00529 IF( ABS( W ).LE.EPS*ERRETM ) THEN
00530 IF( ORGATI ) THEN
00531 DLAM = D( I ) + TAU
00532 ELSE
00533 DLAM = D( IP1 ) + TAU
00534 END IF
00535 GO TO 250
00536 END IF
00537
00538 IF( W.LE.ZERO ) THEN
00539 DLTLB = MAX( DLTLB, TAU )
00540 ELSE
00541 DLTUB = MIN( DLTUB, TAU )
00542 END IF
00543
00544
00545
00546 NITER = NITER + 1
00547 IF( .NOT.SWTCH3 ) THEN
00548 IF( ORGATI ) THEN
00549 C = W - DELTA( IP1 )*DW - ( D( I )-D( IP1 ) )*
00550 $ ( Z( I ) / DELTA( I ) )**2
00551 ELSE
00552 C = W - DELTA( I )*DW - ( D( IP1 )-D( I ) )*
00553 $ ( Z( IP1 ) / DELTA( IP1 ) )**2
00554 END IF
00555 A = ( DELTA( I )+DELTA( IP1 ) )*W -
00556 $ DELTA( I )*DELTA( IP1 )*DW
00557 B = DELTA( I )*DELTA( IP1 )*W
00558 IF( C.EQ.ZERO ) THEN
00559 IF( A.EQ.ZERO ) THEN
00560 IF( ORGATI ) THEN
00561 A = Z( I )*Z( I ) + DELTA( IP1 )*DELTA( IP1 )*
00562 $ ( DPSI+DPHI )
00563 ELSE
00564 A = Z( IP1 )*Z( IP1 ) + DELTA( I )*DELTA( I )*
00565 $ ( DPSI+DPHI )
00566 END IF
00567 END IF
00568 ETA = B / A
00569 ELSE IF( A.LE.ZERO ) THEN
00570 ETA = ( A-SQRT( ABS( A*A-FOUR*B*C ) ) ) / ( TWO*C )
00571 ELSE
00572 ETA = TWO*B / ( A+SQRT( ABS( A*A-FOUR*B*C ) ) )
00573 END IF
00574 ELSE
00575
00576
00577
00578 TEMP = RHOINV + PSI + PHI
00579 IF( ORGATI ) THEN
00580 TEMP1 = Z( IIM1 ) / DELTA( IIM1 )
00581 TEMP1 = TEMP1*TEMP1
00582 C = TEMP - DELTA( IIP1 )*( DPSI+DPHI ) -
00583 $ ( D( IIM1 )-D( IIP1 ) )*TEMP1
00584 ZZ( 1 ) = Z( IIM1 )*Z( IIM1 )
00585 ZZ( 3 ) = DELTA( IIP1 )*DELTA( IIP1 )*
00586 $ ( ( DPSI-TEMP1 )+DPHI )
00587 ELSE
00588 TEMP1 = Z( IIP1 ) / DELTA( IIP1 )
00589 TEMP1 = TEMP1*TEMP1
00590 C = TEMP - DELTA( IIM1 )*( DPSI+DPHI ) -
00591 $ ( D( IIP1 )-D( IIM1 ) )*TEMP1
00592 ZZ( 1 ) = DELTA( IIM1 )*DELTA( IIM1 )*
00593 $ ( DPSI+( DPHI-TEMP1 ) )
00594 ZZ( 3 ) = Z( IIP1 )*Z( IIP1 )
00595 END IF
00596 ZZ( 2 ) = Z( II )*Z( II )
00597 CALL SLAED6( NITER, ORGATI, C, DELTA( IIM1 ), ZZ, W, ETA,
00598 $ INFO )
00599 IF( INFO.NE.0 )
00600 $ GO TO 250
00601 END IF
00602
00603
00604
00605
00606
00607
00608
00609 IF( W*ETA.GE.ZERO )
00610 $ ETA = -W / DW
00611 TEMP = TAU + ETA
00612 IF( TEMP.GT.DLTUB .OR. TEMP.LT.DLTLB ) THEN
00613 IF( W.LT.ZERO ) THEN
00614 ETA = ( DLTUB-TAU ) / TWO
00615 ELSE
00616 ETA = ( DLTLB-TAU ) / TWO
00617 END IF
00618 END IF
00619
00620 PREW = W
00621
00622 DO 180 J = 1, N
00623 DELTA( J ) = DELTA( J ) - ETA
00624 180 CONTINUE
00625
00626
00627
00628 DPSI = ZERO
00629 PSI = ZERO
00630 ERRETM = ZERO
00631 DO 190 J = 1, IIM1
00632 TEMP = Z( J ) / DELTA( J )
00633 PSI = PSI + Z( J )*TEMP
00634 DPSI = DPSI + TEMP*TEMP
00635 ERRETM = ERRETM + PSI
00636 190 CONTINUE
00637 ERRETM = ABS( ERRETM )
00638
00639
00640
00641 DPHI = ZERO
00642 PHI = ZERO
00643 DO 200 J = N, IIP1, -1
00644 TEMP = Z( J ) / DELTA( J )
00645 PHI = PHI + Z( J )*TEMP
00646 DPHI = DPHI + TEMP*TEMP
00647 ERRETM = ERRETM + PHI
00648 200 CONTINUE
00649
00650 TEMP = Z( II ) / DELTA( II )
00651 DW = DPSI + DPHI + TEMP*TEMP
00652 TEMP = Z( II )*TEMP
00653 W = RHOINV + PHI + PSI + TEMP
00654 ERRETM = EIGHT*( PHI-PSI ) + ERRETM + TWO*RHOINV +
00655 $ THREE*ABS( TEMP ) + ABS( TAU+ETA )*DW
00656
00657 SWTCH = .FALSE.
00658 IF( ORGATI ) THEN
00659 IF( -W.GT.ABS( PREW ) / TEN )
00660 $ SWTCH = .TRUE.
00661 ELSE
00662 IF( W.GT.ABS( PREW ) / TEN )
00663 $ SWTCH = .TRUE.
00664 END IF
00665
00666 TAU = TAU + ETA
00667
00668
00669
00670 ITER = NITER + 1
00671
00672 DO 240 NITER = ITER, MAXIT
00673
00674
00675
00676 IF( ABS( W ).LE.EPS*ERRETM ) THEN
00677 IF( ORGATI ) THEN
00678 DLAM = D( I ) + TAU
00679 ELSE
00680 DLAM = D( IP1 ) + TAU
00681 END IF
00682 GO TO 250
00683 END IF
00684
00685 IF( W.LE.ZERO ) THEN
00686 DLTLB = MAX( DLTLB, TAU )
00687 ELSE
00688 DLTUB = MIN( DLTUB, TAU )
00689 END IF
00690
00691
00692
00693 IF( .NOT.SWTCH3 ) THEN
00694 IF( .NOT.SWTCH ) THEN
00695 IF( ORGATI ) THEN
00696 C = W - DELTA( IP1 )*DW -
00697 $ ( D( I )-D( IP1 ) )*( Z( I ) / DELTA( I ) )**2
00698 ELSE
00699 C = W - DELTA( I )*DW - ( D( IP1 )-D( I ) )*
00700 $ ( Z( IP1 ) / DELTA( IP1 ) )**2
00701 END IF
00702 ELSE
00703 TEMP = Z( II ) / DELTA( II )
00704 IF( ORGATI ) THEN
00705 DPSI = DPSI + TEMP*TEMP
00706 ELSE
00707 DPHI = DPHI + TEMP*TEMP
00708 END IF
00709 C = W - DELTA( I )*DPSI - DELTA( IP1 )*DPHI
00710 END IF
00711 A = ( DELTA( I )+DELTA( IP1 ) )*W -
00712 $ DELTA( I )*DELTA( IP1 )*DW
00713 B = DELTA( I )*DELTA( IP1 )*W
00714 IF( C.EQ.ZERO ) THEN
00715 IF( A.EQ.ZERO ) THEN
00716 IF( .NOT.SWTCH ) THEN
00717 IF( ORGATI ) THEN
00718 A = Z( I )*Z( I ) + DELTA( IP1 )*
00719 $ DELTA( IP1 )*( DPSI+DPHI )
00720 ELSE
00721 A = Z( IP1 )*Z( IP1 ) +
00722 $ DELTA( I )*DELTA( I )*( DPSI+DPHI )
00723 END IF
00724 ELSE
00725 A = DELTA( I )*DELTA( I )*DPSI +
00726 $ DELTA( IP1 )*DELTA( IP1 )*DPHI
00727 END IF
00728 END IF
00729 ETA = B / A
00730 ELSE IF( A.LE.ZERO ) THEN
00731 ETA = ( A-SQRT( ABS( A*A-FOUR*B*C ) ) ) / ( TWO*C )
00732 ELSE
00733 ETA = TWO*B / ( A+SQRT( ABS( A*A-FOUR*B*C ) ) )
00734 END IF
00735 ELSE
00736
00737
00738
00739 TEMP = RHOINV + PSI + PHI
00740 IF( SWTCH ) THEN
00741 C = TEMP - DELTA( IIM1 )*DPSI - DELTA( IIP1 )*DPHI
00742 ZZ( 1 ) = DELTA( IIM1 )*DELTA( IIM1 )*DPSI
00743 ZZ( 3 ) = DELTA( IIP1 )*DELTA( IIP1 )*DPHI
00744 ELSE
00745 IF( ORGATI ) THEN
00746 TEMP1 = Z( IIM1 ) / DELTA( IIM1 )
00747 TEMP1 = TEMP1*TEMP1
00748 C = TEMP - DELTA( IIP1 )*( DPSI+DPHI ) -
00749 $ ( D( IIM1 )-D( IIP1 ) )*TEMP1
00750 ZZ( 1 ) = Z( IIM1 )*Z( IIM1 )
00751 ZZ( 3 ) = DELTA( IIP1 )*DELTA( IIP1 )*
00752 $ ( ( DPSI-TEMP1 )+DPHI )
00753 ELSE
00754 TEMP1 = Z( IIP1 ) / DELTA( IIP1 )
00755 TEMP1 = TEMP1*TEMP1
00756 C = TEMP - DELTA( IIM1 )*( DPSI+DPHI ) -
00757 $ ( D( IIP1 )-D( IIM1 ) )*TEMP1
00758 ZZ( 1 ) = DELTA( IIM1 )*DELTA( IIM1 )*
00759 $ ( DPSI+( DPHI-TEMP1 ) )
00760 ZZ( 3 ) = Z( IIP1 )*Z( IIP1 )
00761 END IF
00762 END IF
00763 CALL SLAED6( NITER, ORGATI, C, DELTA( IIM1 ), ZZ, W, ETA,
00764 $ INFO )
00765 IF( INFO.NE.0 )
00766 $ GO TO 250
00767 END IF
00768
00769
00770
00771
00772
00773
00774
00775 IF( W*ETA.GE.ZERO )
00776 $ ETA = -W / DW
00777 TEMP = TAU + ETA
00778 IF( TEMP.GT.DLTUB .OR. TEMP.LT.DLTLB ) THEN
00779 IF( W.LT.ZERO ) THEN
00780 ETA = ( DLTUB-TAU ) / TWO
00781 ELSE
00782 ETA = ( DLTLB-TAU ) / TWO
00783 END IF
00784 END IF
00785
00786 DO 210 J = 1, N
00787 DELTA( J ) = DELTA( J ) - ETA
00788 210 CONTINUE
00789
00790 TAU = TAU + ETA
00791 PREW = W
00792
00793
00794
00795 DPSI = ZERO
00796 PSI = ZERO
00797 ERRETM = ZERO
00798 DO 220 J = 1, IIM1
00799 TEMP = Z( J ) / DELTA( J )
00800 PSI = PSI + Z( J )*TEMP
00801 DPSI = DPSI + TEMP*TEMP
00802 ERRETM = ERRETM + PSI
00803 220 CONTINUE
00804 ERRETM = ABS( ERRETM )
00805
00806
00807
00808 DPHI = ZERO
00809 PHI = ZERO
00810 DO 230 J = N, IIP1, -1
00811 TEMP = Z( J ) / DELTA( J )
00812 PHI = PHI + Z( J )*TEMP
00813 DPHI = DPHI + TEMP*TEMP
00814 ERRETM = ERRETM + PHI
00815 230 CONTINUE
00816
00817 TEMP = Z( II ) / DELTA( II )
00818 DW = DPSI + DPHI + TEMP*TEMP
00819 TEMP = Z( II )*TEMP
00820 W = RHOINV + PHI + PSI + TEMP
00821 ERRETM = EIGHT*( PHI-PSI ) + ERRETM + TWO*RHOINV +
00822 $ THREE*ABS( TEMP ) + ABS( TAU )*DW
00823 IF( W*PREW.GT.ZERO .AND. ABS( W ).GT.ABS( PREW ) / TEN )
00824 $ SWTCH = .NOT.SWTCH
00825
00826 240 CONTINUE
00827
00828
00829
00830 INFO = 1
00831 IF( ORGATI ) THEN
00832 DLAM = D( I ) + TAU
00833 ELSE
00834 DLAM = D( IP1 ) + TAU
00835 END IF
00836
00837 END IF
00838
00839 250 CONTINUE
00840
00841 RETURN
00842
00843
00844
00845 END