00001 SUBROUTINE ZHBGST( VECT, UPLO, N, KA, KB, AB, LDAB, BB, LDBB, X,
00002 $ LDX, WORK, RWORK, INFO )
00003
00004
00005
00006
00007
00008
00009
00010 CHARACTER UPLO, VECT
00011 INTEGER INFO, KA, KB, LDAB, LDBB, LDX, N
00012
00013
00014 DOUBLE PRECISION RWORK( * )
00015 COMPLEX*16 AB( LDAB, * ), BB( LDBB, * ), WORK( * ),
00016 $ X( LDX, * )
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
00093
00094 COMPLEX*16 CZERO, CONE
00095 DOUBLE PRECISION ONE
00096 PARAMETER ( CZERO = ( 0.0D+0, 0.0D+0 ),
00097 $ CONE = ( 1.0D+0, 0.0D+0 ), ONE = 1.0D+0 )
00098
00099
00100 LOGICAL UPDATE, UPPER, WANTX
00101 INTEGER I, I0, I1, I2, INCA, J, J1, J1T, J2, J2T, K,
00102 $ KA1, KB1, KBT, L, M, NR, NRT, NX
00103 DOUBLE PRECISION BII
00104 COMPLEX*16 RA, RA1, T
00105
00106
00107 LOGICAL LSAME
00108 EXTERNAL LSAME
00109
00110
00111 EXTERNAL XERBLA, ZDSCAL, ZGERC, ZGERU, ZLACGV, ZLAR2V,
00112 $ ZLARGV, ZLARTG, ZLARTV, ZLASET, ZROT
00113
00114
00115 INTRINSIC DBLE, DCONJG, MAX, MIN
00116
00117
00118
00119
00120
00121 WANTX = LSAME( VECT, 'V' )
00122 UPPER = LSAME( UPLO, 'U' )
00123 KA1 = KA + 1
00124 KB1 = KB + 1
00125 INFO = 0
00126 IF( .NOT.WANTX .AND. .NOT.LSAME( VECT, 'N' ) ) THEN
00127 INFO = -1
00128 ELSE IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
00129 INFO = -2
00130 ELSE IF( N.LT.0 ) THEN
00131 INFO = -3
00132 ELSE IF( KA.LT.0 ) THEN
00133 INFO = -4
00134 ELSE IF( KB.LT.0 .OR. KB.GT.KA ) THEN
00135 INFO = -5
00136 ELSE IF( LDAB.LT.KA+1 ) THEN
00137 INFO = -7
00138 ELSE IF( LDBB.LT.KB+1 ) THEN
00139 INFO = -9
00140 ELSE IF( LDX.LT.1 .OR. WANTX .AND. LDX.LT.MAX( 1, N ) ) THEN
00141 INFO = -11
00142 END IF
00143 IF( INFO.NE.0 ) THEN
00144 CALL XERBLA( 'ZHBGST', -INFO )
00145 RETURN
00146 END IF
00147
00148
00149
00150 IF( N.EQ.0 )
00151 $ RETURN
00152
00153 INCA = LDAB*KA1
00154
00155
00156
00157 IF( WANTX )
00158 $ CALL ZLASET( 'Full', N, N, CZERO, CONE, X, LDX )
00159
00160
00161
00162
00163
00164 M = ( N+KB ) / 2
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225 UPDATE = .TRUE.
00226 I = N + 1
00227 10 CONTINUE
00228 IF( UPDATE ) THEN
00229 I = I - 1
00230 KBT = MIN( KB, I-1 )
00231 I0 = I - 1
00232 I1 = MIN( N, I+KA )
00233 I2 = I - KBT + KA1
00234 IF( I.LT.M+1 ) THEN
00235 UPDATE = .FALSE.
00236 I = I + 1
00237 I0 = M
00238 IF( KA.EQ.0 )
00239 $ GO TO 480
00240 GO TO 10
00241 END IF
00242 ELSE
00243 I = I + KA
00244 IF( I.GT.N-1 )
00245 $ GO TO 480
00246 END IF
00247
00248 IF( UPPER ) THEN
00249
00250
00251
00252 IF( UPDATE ) THEN
00253
00254
00255
00256 BII = DBLE( BB( KB1, I ) )
00257 AB( KA1, I ) = ( DBLE( AB( KA1, I ) ) / BII ) / BII
00258 DO 20 J = I + 1, I1
00259 AB( I-J+KA1, J ) = AB( I-J+KA1, J ) / BII
00260 20 CONTINUE
00261 DO 30 J = MAX( 1, I-KA ), I - 1
00262 AB( J-I+KA1, I ) = AB( J-I+KA1, I ) / BII
00263 30 CONTINUE
00264 DO 60 K = I - KBT, I - 1
00265 DO 40 J = I - KBT, K
00266 AB( J-K+KA1, K ) = AB( J-K+KA1, K ) -
00267 $ BB( J-I+KB1, I )*
00268 $ DCONJG( AB( K-I+KA1, I ) ) -
00269 $ DCONJG( BB( K-I+KB1, I ) )*
00270 $ AB( J-I+KA1, I ) +
00271 $ DBLE( AB( KA1, I ) )*
00272 $ BB( J-I+KB1, I )*
00273 $ DCONJG( BB( K-I+KB1, I ) )
00274 40 CONTINUE
00275 DO 50 J = MAX( 1, I-KA ), I - KBT - 1
00276 AB( J-K+KA1, K ) = AB( J-K+KA1, K ) -
00277 $ DCONJG( BB( K-I+KB1, I ) )*
00278 $ AB( J-I+KA1, I )
00279 50 CONTINUE
00280 60 CONTINUE
00281 DO 80 J = I, I1
00282 DO 70 K = MAX( J-KA, I-KBT ), I - 1
00283 AB( K-J+KA1, J ) = AB( K-J+KA1, J ) -
00284 $ BB( K-I+KB1, I )*AB( I-J+KA1, J )
00285 70 CONTINUE
00286 80 CONTINUE
00287
00288 IF( WANTX ) THEN
00289
00290
00291
00292 CALL ZDSCAL( N-M, ONE / BII, X( M+1, I ), 1 )
00293 IF( KBT.GT.0 )
00294 $ CALL ZGERC( N-M, KBT, -CONE, X( M+1, I ), 1,
00295 $ BB( KB1-KBT, I ), 1, X( M+1, I-KBT ),
00296 $ LDX )
00297 END IF
00298
00299
00300
00301 RA1 = AB( I-I1+KA1, I1 )
00302 END IF
00303
00304
00305
00306
00307
00308 DO 130 K = 1, KB - 1
00309 IF( UPDATE ) THEN
00310
00311
00312
00313
00314 IF( I-K+KA.LT.N .AND. I-K.GT.1 ) THEN
00315
00316
00317
00318 CALL ZLARTG( AB( K+1, I-K+KA ), RA1,
00319 $ RWORK( I-K+KA-M ), WORK( I-K+KA-M ), RA )
00320
00321
00322
00323
00324 T = -BB( KB1-K, I )*RA1
00325 WORK( I-K ) = RWORK( I-K+KA-M )*T -
00326 $ DCONJG( WORK( I-K+KA-M ) )*
00327 $ AB( 1, I-K+KA )
00328 AB( 1, I-K+KA ) = WORK( I-K+KA-M )*T +
00329 $ RWORK( I-K+KA-M )*AB( 1, I-K+KA )
00330 RA1 = RA
00331 END IF
00332 END IF
00333 J2 = I - K - 1 + MAX( 1, K-I0+2 )*KA1
00334 NR = ( N-J2+KA ) / KA1
00335 J1 = J2 + ( NR-1 )*KA1
00336 IF( UPDATE ) THEN
00337 J2T = MAX( J2, I+2*KA-K+1 )
00338 ELSE
00339 J2T = J2
00340 END IF
00341 NRT = ( N-J2T+KA ) / KA1
00342 DO 90 J = J2T, J1, KA1
00343
00344
00345
00346
00347 WORK( J-M ) = WORK( J-M )*AB( 1, J+1 )
00348 AB( 1, J+1 ) = RWORK( J-M )*AB( 1, J+1 )
00349 90 CONTINUE
00350
00351
00352
00353
00354 IF( NRT.GT.0 )
00355 $ CALL ZLARGV( NRT, AB( 1, J2T ), INCA, WORK( J2T-M ), KA1,
00356 $ RWORK( J2T-M ), KA1 )
00357 IF( NR.GT.0 ) THEN
00358
00359
00360
00361 DO 100 L = 1, KA - 1
00362 CALL ZLARTV( NR, AB( KA1-L, J2 ), INCA,
00363 $ AB( KA-L, J2+1 ), INCA, RWORK( J2-M ),
00364 $ WORK( J2-M ), KA1 )
00365 100 CONTINUE
00366
00367
00368
00369
00370 CALL ZLAR2V( NR, AB( KA1, J2 ), AB( KA1, J2+1 ),
00371 $ AB( KA, J2+1 ), INCA, RWORK( J2-M ),
00372 $ WORK( J2-M ), KA1 )
00373
00374 CALL ZLACGV( NR, WORK( J2-M ), KA1 )
00375 END IF
00376
00377
00378
00379 DO 110 L = KA - 1, KB - K + 1, -1
00380 NRT = ( N-J2+L ) / KA1
00381 IF( NRT.GT.0 )
00382 $ CALL ZLARTV( NRT, AB( L, J2+KA1-L ), INCA,
00383 $ AB( L+1, J2+KA1-L ), INCA, RWORK( J2-M ),
00384 $ WORK( J2-M ), KA1 )
00385 110 CONTINUE
00386
00387 IF( WANTX ) THEN
00388
00389
00390
00391 DO 120 J = J2, J1, KA1
00392 CALL ZROT( N-M, X( M+1, J ), 1, X( M+1, J+1 ), 1,
00393 $ RWORK( J-M ), DCONJG( WORK( J-M ) ) )
00394 120 CONTINUE
00395 END IF
00396 130 CONTINUE
00397
00398 IF( UPDATE ) THEN
00399 IF( I2.LE.N .AND. KBT.GT.0 ) THEN
00400
00401
00402
00403
00404 WORK( I-KBT ) = -BB( KB1-KBT, I )*RA1
00405 END IF
00406 END IF
00407
00408 DO 170 K = KB, 1, -1
00409 IF( UPDATE ) THEN
00410 J2 = I - K - 1 + MAX( 2, K-I0+1 )*KA1
00411 ELSE
00412 J2 = I - K - 1 + MAX( 1, K-I0+1 )*KA1
00413 END IF
00414
00415
00416
00417 DO 140 L = KB - K, 1, -1
00418 NRT = ( N-J2+KA+L ) / KA1
00419 IF( NRT.GT.0 )
00420 $ CALL ZLARTV( NRT, AB( L, J2-L+1 ), INCA,
00421 $ AB( L+1, J2-L+1 ), INCA, RWORK( J2-KA ),
00422 $ WORK( J2-KA ), KA1 )
00423 140 CONTINUE
00424 NR = ( N-J2+KA ) / KA1
00425 J1 = J2 + ( NR-1 )*KA1
00426 DO 150 J = J1, J2, -KA1
00427 WORK( J ) = WORK( J-KA )
00428 RWORK( J ) = RWORK( J-KA )
00429 150 CONTINUE
00430 DO 160 J = J2, J1, KA1
00431
00432
00433
00434
00435 WORK( J ) = WORK( J )*AB( 1, J+1 )
00436 AB( 1, J+1 ) = RWORK( J )*AB( 1, J+1 )
00437 160 CONTINUE
00438 IF( UPDATE ) THEN
00439 IF( I-K.LT.N-KA .AND. K.LE.KBT )
00440 $ WORK( I-K+KA ) = WORK( I-K )
00441 END IF
00442 170 CONTINUE
00443
00444 DO 210 K = KB, 1, -1
00445 J2 = I - K - 1 + MAX( 1, K-I0+1 )*KA1
00446 NR = ( N-J2+KA ) / KA1
00447 J1 = J2 + ( NR-1 )*KA1
00448 IF( NR.GT.0 ) THEN
00449
00450
00451
00452
00453 CALL ZLARGV( NR, AB( 1, J2 ), INCA, WORK( J2 ), KA1,
00454 $ RWORK( J2 ), KA1 )
00455
00456
00457
00458 DO 180 L = 1, KA - 1
00459 CALL ZLARTV( NR, AB( KA1-L, J2 ), INCA,
00460 $ AB( KA-L, J2+1 ), INCA, RWORK( J2 ),
00461 $ WORK( J2 ), KA1 )
00462 180 CONTINUE
00463
00464
00465
00466
00467 CALL ZLAR2V( NR, AB( KA1, J2 ), AB( KA1, J2+1 ),
00468 $ AB( KA, J2+1 ), INCA, RWORK( J2 ),
00469 $ WORK( J2 ), KA1 )
00470
00471 CALL ZLACGV( NR, WORK( J2 ), KA1 )
00472 END IF
00473
00474
00475
00476 DO 190 L = KA - 1, KB - K + 1, -1
00477 NRT = ( N-J2+L ) / KA1
00478 IF( NRT.GT.0 )
00479 $ CALL ZLARTV( NRT, AB( L, J2+KA1-L ), INCA,
00480 $ AB( L+1, J2+KA1-L ), INCA, RWORK( J2 ),
00481 $ WORK( J2 ), KA1 )
00482 190 CONTINUE
00483
00484 IF( WANTX ) THEN
00485
00486
00487
00488 DO 200 J = J2, J1, KA1
00489 CALL ZROT( N-M, X( M+1, J ), 1, X( M+1, J+1 ), 1,
00490 $ RWORK( J ), DCONJG( WORK( J ) ) )
00491 200 CONTINUE
00492 END IF
00493 210 CONTINUE
00494
00495 DO 230 K = 1, KB - 1
00496 J2 = I - K - 1 + MAX( 1, K-I0+2 )*KA1
00497
00498
00499
00500 DO 220 L = KB - K, 1, -1
00501 NRT = ( N-J2+L ) / KA1
00502 IF( NRT.GT.0 )
00503 $ CALL ZLARTV( NRT, AB( L, J2+KA1-L ), INCA,
00504 $ AB( L+1, J2+KA1-L ), INCA, RWORK( J2-M ),
00505 $ WORK( J2-M ), KA1 )
00506 220 CONTINUE
00507 230 CONTINUE
00508
00509 IF( KB.GT.1 ) THEN
00510 DO 240 J = N - 1, J2 + KA, -1
00511 RWORK( J-M ) = RWORK( J-KA-M )
00512 WORK( J-M ) = WORK( J-KA-M )
00513 240 CONTINUE
00514 END IF
00515
00516 ELSE
00517
00518
00519
00520 IF( UPDATE ) THEN
00521
00522
00523
00524 BII = DBLE( BB( 1, I ) )
00525 AB( 1, I ) = ( DBLE( AB( 1, I ) ) / BII ) / BII
00526 DO 250 J = I + 1, I1
00527 AB( J-I+1, I ) = AB( J-I+1, I ) / BII
00528 250 CONTINUE
00529 DO 260 J = MAX( 1, I-KA ), I - 1
00530 AB( I-J+1, J ) = AB( I-J+1, J ) / BII
00531 260 CONTINUE
00532 DO 290 K = I - KBT, I - 1
00533 DO 270 J = I - KBT, K
00534 AB( K-J+1, J ) = AB( K-J+1, J ) -
00535 $ BB( I-J+1, J )*DCONJG( AB( I-K+1,
00536 $ K ) ) - DCONJG( BB( I-K+1, K ) )*
00537 $ AB( I-J+1, J ) + DBLE( AB( 1, I ) )*
00538 $ BB( I-J+1, J )*DCONJG( BB( I-K+1,
00539 $ K ) )
00540 270 CONTINUE
00541 DO 280 J = MAX( 1, I-KA ), I - KBT - 1
00542 AB( K-J+1, J ) = AB( K-J+1, J ) -
00543 $ DCONJG( BB( I-K+1, K ) )*
00544 $ AB( I-J+1, J )
00545 280 CONTINUE
00546 290 CONTINUE
00547 DO 310 J = I, I1
00548 DO 300 K = MAX( J-KA, I-KBT ), I - 1
00549 AB( J-K+1, K ) = AB( J-K+1, K ) -
00550 $ BB( I-K+1, K )*AB( J-I+1, I )
00551 300 CONTINUE
00552 310 CONTINUE
00553
00554 IF( WANTX ) THEN
00555
00556
00557
00558 CALL ZDSCAL( N-M, ONE / BII, X( M+1, I ), 1 )
00559 IF( KBT.GT.0 )
00560 $ CALL ZGERU( N-M, KBT, -CONE, X( M+1, I ), 1,
00561 $ BB( KBT+1, I-KBT ), LDBB-1,
00562 $ X( M+1, I-KBT ), LDX )
00563 END IF
00564
00565
00566
00567 RA1 = AB( I1-I+1, I )
00568 END IF
00569
00570
00571
00572
00573
00574 DO 360 K = 1, KB - 1
00575 IF( UPDATE ) THEN
00576
00577
00578
00579
00580 IF( I-K+KA.LT.N .AND. I-K.GT.1 ) THEN
00581
00582
00583
00584 CALL ZLARTG( AB( KA1-K, I ), RA1, RWORK( I-K+KA-M ),
00585 $ WORK( I-K+KA-M ), RA )
00586
00587
00588
00589
00590 T = -BB( K+1, I-K )*RA1
00591 WORK( I-K ) = RWORK( I-K+KA-M )*T -
00592 $ DCONJG( WORK( I-K+KA-M ) )*
00593 $ AB( KA1, I-K )
00594 AB( KA1, I-K ) = WORK( I-K+KA-M )*T +
00595 $ RWORK( I-K+KA-M )*AB( KA1, I-K )
00596 RA1 = RA
00597 END IF
00598 END IF
00599 J2 = I - K - 1 + MAX( 1, K-I0+2 )*KA1
00600 NR = ( N-J2+KA ) / KA1
00601 J1 = J2 + ( NR-1 )*KA1
00602 IF( UPDATE ) THEN
00603 J2T = MAX( J2, I+2*KA-K+1 )
00604 ELSE
00605 J2T = J2
00606 END IF
00607 NRT = ( N-J2T+KA ) / KA1
00608 DO 320 J = J2T, J1, KA1
00609
00610
00611
00612
00613 WORK( J-M ) = WORK( J-M )*AB( KA1, J-KA+1 )
00614 AB( KA1, J-KA+1 ) = RWORK( J-M )*AB( KA1, J-KA+1 )
00615 320 CONTINUE
00616
00617
00618
00619
00620 IF( NRT.GT.0 )
00621 $ CALL ZLARGV( NRT, AB( KA1, J2T-KA ), INCA, WORK( J2T-M ),
00622 $ KA1, RWORK( J2T-M ), KA1 )
00623 IF( NR.GT.0 ) THEN
00624
00625
00626
00627 DO 330 L = 1, KA - 1
00628 CALL ZLARTV( NR, AB( L+1, J2-L ), INCA,
00629 $ AB( L+2, J2-L ), INCA, RWORK( J2-M ),
00630 $ WORK( J2-M ), KA1 )
00631 330 CONTINUE
00632
00633
00634
00635
00636 CALL ZLAR2V( NR, AB( 1, J2 ), AB( 1, J2+1 ), AB( 2, J2 ),
00637 $ INCA, RWORK( J2-M ), WORK( J2-M ), KA1 )
00638
00639 CALL ZLACGV( NR, WORK( J2-M ), KA1 )
00640 END IF
00641
00642
00643
00644 DO 340 L = KA - 1, KB - K + 1, -1
00645 NRT = ( N-J2+L ) / KA1
00646 IF( NRT.GT.0 )
00647 $ CALL ZLARTV( NRT, AB( KA1-L+1, J2 ), INCA,
00648 $ AB( KA1-L, J2+1 ), INCA, RWORK( J2-M ),
00649 $ WORK( J2-M ), KA1 )
00650 340 CONTINUE
00651
00652 IF( WANTX ) THEN
00653
00654
00655
00656 DO 350 J = J2, J1, KA1
00657 CALL ZROT( N-M, X( M+1, J ), 1, X( M+1, J+1 ), 1,
00658 $ RWORK( J-M ), WORK( J-M ) )
00659 350 CONTINUE
00660 END IF
00661 360 CONTINUE
00662
00663 IF( UPDATE ) THEN
00664 IF( I2.LE.N .AND. KBT.GT.0 ) THEN
00665
00666
00667
00668
00669 WORK( I-KBT ) = -BB( KBT+1, I-KBT )*RA1
00670 END IF
00671 END IF
00672
00673 DO 400 K = KB, 1, -1
00674 IF( UPDATE ) THEN
00675 J2 = I - K - 1 + MAX( 2, K-I0+1 )*KA1
00676 ELSE
00677 J2 = I - K - 1 + MAX( 1, K-I0+1 )*KA1
00678 END IF
00679
00680
00681
00682 DO 370 L = KB - K, 1, -1
00683 NRT = ( N-J2+KA+L ) / KA1
00684 IF( NRT.GT.0 )
00685 $ CALL ZLARTV( NRT, AB( KA1-L+1, J2-KA ), INCA,
00686 $ AB( KA1-L, J2-KA+1 ), INCA,
00687 $ RWORK( J2-KA ), WORK( J2-KA ), KA1 )
00688 370 CONTINUE
00689 NR = ( N-J2+KA ) / KA1
00690 J1 = J2 + ( NR-1 )*KA1
00691 DO 380 J = J1, J2, -KA1
00692 WORK( J ) = WORK( J-KA )
00693 RWORK( J ) = RWORK( J-KA )
00694 380 CONTINUE
00695 DO 390 J = J2, J1, KA1
00696
00697
00698
00699
00700 WORK( J ) = WORK( J )*AB( KA1, J-KA+1 )
00701 AB( KA1, J-KA+1 ) = RWORK( J )*AB( KA1, J-KA+1 )
00702 390 CONTINUE
00703 IF( UPDATE ) THEN
00704 IF( I-K.LT.N-KA .AND. K.LE.KBT )
00705 $ WORK( I-K+KA ) = WORK( I-K )
00706 END IF
00707 400 CONTINUE
00708
00709 DO 440 K = KB, 1, -1
00710 J2 = I - K - 1 + MAX( 1, K-I0+1 )*KA1
00711 NR = ( N-J2+KA ) / KA1
00712 J1 = J2 + ( NR-1 )*KA1
00713 IF( NR.GT.0 ) THEN
00714
00715
00716
00717
00718 CALL ZLARGV( NR, AB( KA1, J2-KA ), INCA, WORK( J2 ), KA1,
00719 $ RWORK( J2 ), KA1 )
00720
00721
00722
00723 DO 410 L = 1, KA - 1
00724 CALL ZLARTV( NR, AB( L+1, J2-L ), INCA,
00725 $ AB( L+2, J2-L ), INCA, RWORK( J2 ),
00726 $ WORK( J2 ), KA1 )
00727 410 CONTINUE
00728
00729
00730
00731
00732 CALL ZLAR2V( NR, AB( 1, J2 ), AB( 1, J2+1 ), AB( 2, J2 ),
00733 $ INCA, RWORK( J2 ), WORK( J2 ), KA1 )
00734
00735 CALL ZLACGV( NR, WORK( J2 ), KA1 )
00736 END IF
00737
00738
00739
00740 DO 420 L = KA - 1, KB - K + 1, -1
00741 NRT = ( N-J2+L ) / KA1
00742 IF( NRT.GT.0 )
00743 $ CALL ZLARTV( NRT, AB( KA1-L+1, J2 ), INCA,
00744 $ AB( KA1-L, J2+1 ), INCA, RWORK( J2 ),
00745 $ WORK( J2 ), KA1 )
00746 420 CONTINUE
00747
00748 IF( WANTX ) THEN
00749
00750
00751
00752 DO 430 J = J2, J1, KA1
00753 CALL ZROT( N-M, X( M+1, J ), 1, X( M+1, J+1 ), 1,
00754 $ RWORK( J ), WORK( J ) )
00755 430 CONTINUE
00756 END IF
00757 440 CONTINUE
00758
00759 DO 460 K = 1, KB - 1
00760 J2 = I - K - 1 + MAX( 1, K-I0+2 )*KA1
00761
00762
00763
00764 DO 450 L = KB - K, 1, -1
00765 NRT = ( N-J2+L ) / KA1
00766 IF( NRT.GT.0 )
00767 $ CALL ZLARTV( NRT, AB( KA1-L+1, J2 ), INCA,
00768 $ AB( KA1-L, J2+1 ), INCA, RWORK( J2-M ),
00769 $ WORK( J2-M ), KA1 )
00770 450 CONTINUE
00771 460 CONTINUE
00772
00773 IF( KB.GT.1 ) THEN
00774 DO 470 J = N - 1, J2 + KA, -1
00775 RWORK( J-M ) = RWORK( J-KA-M )
00776 WORK( J-M ) = WORK( J-KA-M )
00777 470 CONTINUE
00778 END IF
00779
00780 END IF
00781
00782 GO TO 10
00783
00784 480 CONTINUE
00785
00786
00787
00788
00789
00790
00791
00792
00793
00794
00795
00796
00797
00798
00799
00800
00801
00802 UPDATE = .TRUE.
00803 I = 0
00804 490 CONTINUE
00805 IF( UPDATE ) THEN
00806 I = I + 1
00807 KBT = MIN( KB, M-I )
00808 I0 = I + 1
00809 I1 = MAX( 1, I-KA )
00810 I2 = I + KBT - KA1
00811 IF( I.GT.M ) THEN
00812 UPDATE = .FALSE.
00813 I = I - 1
00814 I0 = M + 1
00815 IF( KA.EQ.0 )
00816 $ RETURN
00817 GO TO 490
00818 END IF
00819 ELSE
00820 I = I - KA
00821 IF( I.LT.2 )
00822 $ RETURN
00823 END IF
00824
00825 IF( I.LT.M-KBT ) THEN
00826 NX = M
00827 ELSE
00828 NX = N
00829 END IF
00830
00831 IF( UPPER ) THEN
00832
00833
00834
00835 IF( UPDATE ) THEN
00836
00837
00838
00839 BII = DBLE( BB( KB1, I ) )
00840 AB( KA1, I ) = ( DBLE( AB( KA1, I ) ) / BII ) / BII
00841 DO 500 J = I1, I - 1
00842 AB( J-I+KA1, I ) = AB( J-I+KA1, I ) / BII
00843 500 CONTINUE
00844 DO 510 J = I + 1, MIN( N, I+KA )
00845 AB( I-J+KA1, J ) = AB( I-J+KA1, J ) / BII
00846 510 CONTINUE
00847 DO 540 K = I + 1, I + KBT
00848 DO 520 J = K, I + KBT
00849 AB( K-J+KA1, J ) = AB( K-J+KA1, J ) -
00850 $ BB( I-J+KB1, J )*
00851 $ DCONJG( AB( I-K+KA1, K ) ) -
00852 $ DCONJG( BB( I-K+KB1, K ) )*
00853 $ AB( I-J+KA1, J ) +
00854 $ DBLE( AB( KA1, I ) )*
00855 $ BB( I-J+KB1, J )*
00856 $ DCONJG( BB( I-K+KB1, K ) )
00857 520 CONTINUE
00858 DO 530 J = I + KBT + 1, MIN( N, I+KA )
00859 AB( K-J+KA1, J ) = AB( K-J+KA1, J ) -
00860 $ DCONJG( BB( I-K+KB1, K ) )*
00861 $ AB( I-J+KA1, J )
00862 530 CONTINUE
00863 540 CONTINUE
00864 DO 560 J = I1, I
00865 DO 550 K = I + 1, MIN( J+KA, I+KBT )
00866 AB( J-K+KA1, K ) = AB( J-K+KA1, K ) -
00867 $ BB( I-K+KB1, K )*AB( J-I+KA1, I )
00868 550 CONTINUE
00869 560 CONTINUE
00870
00871 IF( WANTX ) THEN
00872
00873
00874
00875 CALL ZDSCAL( NX, ONE / BII, X( 1, I ), 1 )
00876 IF( KBT.GT.0 )
00877 $ CALL ZGERU( NX, KBT, -CONE, X( 1, I ), 1,
00878 $ BB( KB, I+1 ), LDBB-1, X( 1, I+1 ), LDX )
00879 END IF
00880
00881
00882
00883 RA1 = AB( I1-I+KA1, I )
00884 END IF
00885
00886
00887
00888
00889 DO 610 K = 1, KB - 1
00890 IF( UPDATE ) THEN
00891
00892
00893
00894
00895 IF( I+K-KA1.GT.0 .AND. I+K.LT.M ) THEN
00896
00897
00898
00899 CALL ZLARTG( AB( K+1, I ), RA1, RWORK( I+K-KA ),
00900 $ WORK( I+K-KA ), RA )
00901
00902
00903
00904
00905 T = -BB( KB1-K, I+K )*RA1
00906 WORK( M-KB+I+K ) = RWORK( I+K-KA )*T -
00907 $ DCONJG( WORK( I+K-KA ) )*
00908 $ AB( 1, I+K )
00909 AB( 1, I+K ) = WORK( I+K-KA )*T +
00910 $ RWORK( I+K-KA )*AB( 1, I+K )
00911 RA1 = RA
00912 END IF
00913 END IF
00914 J2 = I + K + 1 - MAX( 1, K+I0-M+1 )*KA1
00915 NR = ( J2+KA-1 ) / KA1
00916 J1 = J2 - ( NR-1 )*KA1
00917 IF( UPDATE ) THEN
00918 J2T = MIN( J2, I-2*KA+K-1 )
00919 ELSE
00920 J2T = J2
00921 END IF
00922 NRT = ( J2T+KA-1 ) / KA1
00923 DO 570 J = J1, J2T, KA1
00924
00925
00926
00927
00928 WORK( J ) = WORK( J )*AB( 1, J+KA-1 )
00929 AB( 1, J+KA-1 ) = RWORK( J )*AB( 1, J+KA-1 )
00930 570 CONTINUE
00931
00932
00933
00934
00935 IF( NRT.GT.0 )
00936 $ CALL ZLARGV( NRT, AB( 1, J1+KA ), INCA, WORK( J1 ), KA1,
00937 $ RWORK( J1 ), KA1 )
00938 IF( NR.GT.0 ) THEN
00939
00940
00941
00942 DO 580 L = 1, KA - 1
00943 CALL ZLARTV( NR, AB( KA1-L, J1+L ), INCA,
00944 $ AB( KA-L, J1+L ), INCA, RWORK( J1 ),
00945 $ WORK( J1 ), KA1 )
00946 580 CONTINUE
00947
00948
00949
00950
00951 CALL ZLAR2V( NR, AB( KA1, J1 ), AB( KA1, J1-1 ),
00952 $ AB( KA, J1 ), INCA, RWORK( J1 ), WORK( J1 ),
00953 $ KA1 )
00954
00955 CALL ZLACGV( NR, WORK( J1 ), KA1 )
00956 END IF
00957
00958
00959
00960 DO 590 L = KA - 1, KB - K + 1, -1
00961 NRT = ( J2+L-1 ) / KA1
00962 J1T = J2 - ( NRT-1 )*KA1
00963 IF( NRT.GT.0 )
00964 $ CALL ZLARTV( NRT, AB( L, J1T ), INCA,
00965 $ AB( L+1, J1T-1 ), INCA, RWORK( J1T ),
00966 $ WORK( J1T ), KA1 )
00967 590 CONTINUE
00968
00969 IF( WANTX ) THEN
00970
00971
00972
00973 DO 600 J = J1, J2, KA1
00974 CALL ZROT( NX, X( 1, J ), 1, X( 1, J-1 ), 1,
00975 $ RWORK( J ), WORK( J ) )
00976 600 CONTINUE
00977 END IF
00978 610 CONTINUE
00979
00980 IF( UPDATE ) THEN
00981 IF( I2.GT.0 .AND. KBT.GT.0 ) THEN
00982
00983
00984
00985
00986 WORK( M-KB+I+KBT ) = -BB( KB1-KBT, I+KBT )*RA1
00987 END IF
00988 END IF
00989
00990 DO 650 K = KB, 1, -1
00991 IF( UPDATE ) THEN
00992 J2 = I + K + 1 - MAX( 2, K+I0-M )*KA1
00993 ELSE
00994 J2 = I + K + 1 - MAX( 1, K+I0-M )*KA1
00995 END IF
00996
00997
00998
00999 DO 620 L = KB - K, 1, -1
01000 NRT = ( J2+KA+L-1 ) / KA1
01001 J1T = J2 - ( NRT-1 )*KA1
01002 IF( NRT.GT.0 )
01003 $ CALL ZLARTV( NRT, AB( L, J1T+KA ), INCA,
01004 $ AB( L+1, J1T+KA-1 ), INCA,
01005 $ RWORK( M-KB+J1T+KA ),
01006 $ WORK( M-KB+J1T+KA ), KA1 )
01007 620 CONTINUE
01008 NR = ( J2+KA-1 ) / KA1
01009 J1 = J2 - ( NR-1 )*KA1
01010 DO 630 J = J1, J2, KA1
01011 WORK( M-KB+J ) = WORK( M-KB+J+KA )
01012 RWORK( M-KB+J ) = RWORK( M-KB+J+KA )
01013 630 CONTINUE
01014 DO 640 J = J1, J2, KA1
01015
01016
01017
01018
01019 WORK( M-KB+J ) = WORK( M-KB+J )*AB( 1, J+KA-1 )
01020 AB( 1, J+KA-1 ) = RWORK( M-KB+J )*AB( 1, J+KA-1 )
01021 640 CONTINUE
01022 IF( UPDATE ) THEN
01023 IF( I+K.GT.KA1 .AND. K.LE.KBT )
01024 $ WORK( M-KB+I+K-KA ) = WORK( M-KB+I+K )
01025 END IF
01026 650 CONTINUE
01027
01028 DO 690 K = KB, 1, -1
01029 J2 = I + K + 1 - MAX( 1, K+I0-M )*KA1
01030 NR = ( J2+KA-1 ) / KA1
01031 J1 = J2 - ( NR-1 )*KA1
01032 IF( NR.GT.0 ) THEN
01033
01034
01035
01036
01037 CALL ZLARGV( NR, AB( 1, J1+KA ), INCA, WORK( M-KB+J1 ),
01038 $ KA1, RWORK( M-KB+J1 ), KA1 )
01039
01040
01041
01042 DO 660 L = 1, KA - 1
01043 CALL ZLARTV( NR, AB( KA1-L, J1+L ), INCA,
01044 $ AB( KA-L, J1+L ), INCA, RWORK( M-KB+J1 ),
01045 $ WORK( M-KB+J1 ), KA1 )
01046 660 CONTINUE
01047
01048
01049
01050
01051 CALL ZLAR2V( NR, AB( KA1, J1 ), AB( KA1, J1-1 ),
01052 $ AB( KA, J1 ), INCA, RWORK( M-KB+J1 ),
01053 $ WORK( M-KB+J1 ), KA1 )
01054
01055 CALL ZLACGV( NR, WORK( M-KB+J1 ), KA1 )
01056 END IF
01057
01058
01059
01060 DO 670 L = KA - 1, KB - K + 1, -1
01061 NRT = ( J2+L-1 ) / KA1
01062 J1T = J2 - ( NRT-1 )*KA1
01063 IF( NRT.GT.0 )
01064 $ CALL ZLARTV( NRT, AB( L, J1T ), INCA,
01065 $ AB( L+1, J1T-1 ), INCA,
01066 $ RWORK( M-KB+J1T ), WORK( M-KB+J1T ),
01067 $ KA1 )
01068 670 CONTINUE
01069
01070 IF( WANTX ) THEN
01071
01072
01073
01074 DO 680 J = J1, J2, KA1
01075 CALL ZROT( NX, X( 1, J ), 1, X( 1, J-1 ), 1,
01076 $ RWORK( M-KB+J ), WORK( M-KB+J ) )
01077 680 CONTINUE
01078 END IF
01079 690 CONTINUE
01080
01081 DO 710 K = 1, KB - 1
01082 J2 = I + K + 1 - MAX( 1, K+I0-M+1 )*KA1
01083
01084
01085
01086 DO 700 L = KB - K, 1, -1
01087 NRT = ( J2+L-1 ) / KA1
01088 J1T = J2 - ( NRT-1 )*KA1
01089 IF( NRT.GT.0 )
01090 $ CALL ZLARTV( NRT, AB( L, J1T ), INCA,
01091 $ AB( L+1, J1T-1 ), INCA, RWORK( J1T ),
01092 $ WORK( J1T ), KA1 )
01093 700 CONTINUE
01094 710 CONTINUE
01095
01096 IF( KB.GT.1 ) THEN
01097 DO 720 J = 2, I2 - KA
01098 RWORK( J ) = RWORK( J+KA )
01099 WORK( J ) = WORK( J+KA )
01100 720 CONTINUE
01101 END IF
01102
01103 ELSE
01104
01105
01106
01107 IF( UPDATE ) THEN
01108
01109
01110
01111 BII = DBLE( BB( 1, I ) )
01112 AB( 1, I ) = ( DBLE( AB( 1, I ) ) / BII ) / BII
01113 DO 730 J = I1, I - 1
01114 AB( I-J+1, J ) = AB( I-J+1, J ) / BII
01115 730 CONTINUE
01116 DO 740 J = I + 1, MIN( N, I+KA )
01117 AB( J-I+1, I ) = AB( J-I+1, I ) / BII
01118 740 CONTINUE
01119 DO 770 K = I + 1, I + KBT
01120 DO 750 J = K, I + KBT
01121 AB( J-K+1, K ) = AB( J-K+1, K ) -
01122 $ BB( J-I+1, I )*DCONJG( AB( K-I+1,
01123 $ I ) ) - DCONJG( BB( K-I+1, I ) )*
01124 $ AB( J-I+1, I ) + DBLE( AB( 1, I ) )*
01125 $ BB( J-I+1, I )*DCONJG( BB( K-I+1,
01126 $ I ) )
01127 750 CONTINUE
01128 DO 760 J = I + KBT + 1, MIN( N, I+KA )
01129 AB( J-K+1, K ) = AB( J-K+1, K ) -
01130 $ DCONJG( BB( K-I+1, I ) )*
01131 $ AB( J-I+1, I )
01132 760 CONTINUE
01133 770 CONTINUE
01134 DO 790 J = I1, I
01135 DO 780 K = I + 1, MIN( J+KA, I+KBT )
01136 AB( K-J+1, J ) = AB( K-J+1, J ) -
01137 $ BB( K-I+1, I )*AB( I-J+1, J )
01138 780 CONTINUE
01139 790 CONTINUE
01140
01141 IF( WANTX ) THEN
01142
01143
01144
01145 CALL ZDSCAL( NX, ONE / BII, X( 1, I ), 1 )
01146 IF( KBT.GT.0 )
01147 $ CALL ZGERC( NX, KBT, -CONE, X( 1, I ), 1, BB( 2, I ),
01148 $ 1, X( 1, I+1 ), LDX )
01149 END IF
01150
01151
01152
01153 RA1 = AB( I-I1+1, I1 )
01154 END IF
01155
01156
01157
01158
01159 DO 840 K = 1, KB - 1
01160 IF( UPDATE ) THEN
01161
01162
01163
01164
01165 IF( I+K-KA1.GT.0 .AND. I+K.LT.M ) THEN
01166
01167
01168
01169 CALL ZLARTG( AB( KA1-K, I+K-KA ), RA1,
01170 $ RWORK( I+K-KA ), WORK( I+K-KA ), RA )
01171
01172
01173
01174
01175 T = -BB( K+1, I )*RA1
01176 WORK( M-KB+I+K ) = RWORK( I+K-KA )*T -
01177 $ DCONJG( WORK( I+K-KA ) )*
01178 $ AB( KA1, I+K-KA )
01179 AB( KA1, I+K-KA ) = WORK( I+K-KA )*T +
01180 $ RWORK( I+K-KA )*AB( KA1, I+K-KA )
01181 RA1 = RA
01182 END IF
01183 END IF
01184 J2 = I + K + 1 - MAX( 1, K+I0-M+1 )*KA1
01185 NR = ( J2+KA-1 ) / KA1
01186 J1 = J2 - ( NR-1 )*KA1
01187 IF( UPDATE ) THEN
01188 J2T = MIN( J2, I-2*KA+K-1 )
01189 ELSE
01190 J2T = J2
01191 END IF
01192 NRT = ( J2T+KA-1 ) / KA1
01193 DO 800 J = J1, J2T, KA1
01194
01195
01196
01197
01198 WORK( J ) = WORK( J )*AB( KA1, J-1 )
01199 AB( KA1, J-1 ) = RWORK( J )*AB( KA1, J-1 )
01200 800 CONTINUE
01201
01202
01203
01204
01205 IF( NRT.GT.0 )
01206 $ CALL ZLARGV( NRT, AB( KA1, J1 ), INCA, WORK( J1 ), KA1,
01207 $ RWORK( J1 ), KA1 )
01208 IF( NR.GT.0 ) THEN
01209
01210
01211
01212 DO 810 L = 1, KA - 1
01213 CALL ZLARTV( NR, AB( L+1, J1 ), INCA, AB( L+2, J1-1 ),
01214 $ INCA, RWORK( J1 ), WORK( J1 ), KA1 )
01215 810 CONTINUE
01216
01217
01218
01219
01220 CALL ZLAR2V( NR, AB( 1, J1 ), AB( 1, J1-1 ),
01221 $ AB( 2, J1-1 ), INCA, RWORK( J1 ),
01222 $ WORK( J1 ), KA1 )
01223
01224 CALL ZLACGV( NR, WORK( J1 ), KA1 )
01225 END IF
01226
01227
01228
01229 DO 820 L = KA - 1, KB - K + 1, -1
01230 NRT = ( J2+L-1 ) / KA1
01231 J1T = J2 - ( NRT-1 )*KA1
01232 IF( NRT.GT.0 )
01233 $ CALL ZLARTV( NRT, AB( KA1-L+1, J1T-KA1+L ), INCA,
01234 $ AB( KA1-L, J1T-KA1+L ), INCA,
01235 $ RWORK( J1T ), WORK( J1T ), KA1 )
01236 820 CONTINUE
01237
01238 IF( WANTX ) THEN
01239
01240
01241
01242 DO 830 J = J1, J2, KA1
01243 CALL ZROT( NX, X( 1, J ), 1, X( 1, J-1 ), 1,
01244 $ RWORK( J ), DCONJG( WORK( J ) ) )
01245 830 CONTINUE
01246 END IF
01247 840 CONTINUE
01248
01249 IF( UPDATE ) THEN
01250 IF( I2.GT.0 .AND. KBT.GT.0 ) THEN
01251
01252
01253
01254
01255 WORK( M-KB+I+KBT ) = -BB( KBT+1, I )*RA1
01256 END IF
01257 END IF
01258
01259 DO 880 K = KB, 1, -1
01260 IF( UPDATE ) THEN
01261 J2 = I + K + 1 - MAX( 2, K+I0-M )*KA1
01262 ELSE
01263 J2 = I + K + 1 - MAX( 1, K+I0-M )*KA1
01264 END IF
01265
01266
01267
01268 DO 850 L = KB - K, 1, -1
01269 NRT = ( J2+KA+L-1 ) / KA1
01270 J1T = J2 - ( NRT-1 )*KA1
01271 IF( NRT.GT.0 )
01272 $ CALL ZLARTV( NRT, AB( KA1-L+1, J1T+L-1 ), INCA,
01273 $ AB( KA1-L, J1T+L-1 ), INCA,
01274 $ RWORK( M-KB+J1T+KA ),
01275 $ WORK( M-KB+J1T+KA ), KA1 )
01276 850 CONTINUE
01277 NR = ( J2+KA-1 ) / KA1
01278 J1 = J2 - ( NR-1 )*KA1
01279 DO 860 J = J1, J2, KA1
01280 WORK( M-KB+J ) = WORK( M-KB+J+KA )
01281 RWORK( M-KB+J ) = RWORK( M-KB+J+KA )
01282 860 CONTINUE
01283 DO 870 J = J1, J2, KA1
01284
01285
01286
01287
01288 WORK( M-KB+J ) = WORK( M-KB+J )*AB( KA1, J-1 )
01289 AB( KA1, J-1 ) = RWORK( M-KB+J )*AB( KA1, J-1 )
01290 870 CONTINUE
01291 IF( UPDATE ) THEN
01292 IF( I+K.GT.KA1 .AND. K.LE.KBT )
01293 $ WORK( M-KB+I+K-KA ) = WORK( M-KB+I+K )
01294 END IF
01295 880 CONTINUE
01296
01297 DO 920 K = KB, 1, -1
01298 J2 = I + K + 1 - MAX( 1, K+I0-M )*KA1
01299 NR = ( J2+KA-1 ) / KA1
01300 J1 = J2 - ( NR-1 )*KA1
01301 IF( NR.GT.0 ) THEN
01302
01303
01304
01305
01306 CALL ZLARGV( NR, AB( KA1, J1 ), INCA, WORK( M-KB+J1 ),
01307 $ KA1, RWORK( M-KB+J1 ), KA1 )
01308
01309
01310
01311 DO 890 L = 1, KA - 1
01312 CALL ZLARTV( NR, AB( L+1, J1 ), INCA, AB( L+2, J1-1 ),
01313 $ INCA, RWORK( M-KB+J1 ), WORK( M-KB+J1 ),
01314 $ KA1 )
01315 890 CONTINUE
01316
01317
01318
01319
01320 CALL ZLAR2V( NR, AB( 1, J1 ), AB( 1, J1-1 ),
01321 $ AB( 2, J1-1 ), INCA, RWORK( M-KB+J1 ),
01322 $ WORK( M-KB+J1 ), KA1 )
01323
01324 CALL ZLACGV( NR, WORK( M-KB+J1 ), KA1 )
01325 END IF
01326
01327
01328
01329 DO 900 L = KA - 1, KB - K + 1, -1
01330 NRT = ( J2+L-1 ) / KA1
01331 J1T = J2 - ( NRT-1 )*KA1
01332 IF( NRT.GT.0 )
01333 $ CALL ZLARTV( NRT, AB( KA1-L+1, J1T-KA1+L ), INCA,
01334 $ AB( KA1-L, J1T-KA1+L ), INCA,
01335 $ RWORK( M-KB+J1T ), WORK( M-KB+J1T ),
01336 $ KA1 )
01337 900 CONTINUE
01338
01339 IF( WANTX ) THEN
01340
01341
01342
01343 DO 910 J = J1, J2, KA1
01344 CALL ZROT( NX, X( 1, J ), 1, X( 1, J-1 ), 1,
01345 $ RWORK( M-KB+J ), DCONJG( WORK( M-KB+J ) ) )
01346 910 CONTINUE
01347 END IF
01348 920 CONTINUE
01349
01350 DO 940 K = 1, KB - 1
01351 J2 = I + K + 1 - MAX( 1, K+I0-M+1 )*KA1
01352
01353
01354
01355 DO 930 L = KB - K, 1, -1
01356 NRT = ( J2+L-1 ) / KA1
01357 J1T = J2 - ( NRT-1 )*KA1
01358 IF( NRT.GT.0 )
01359 $ CALL ZLARTV( NRT, AB( KA1-L+1, J1T-KA1+L ), INCA,
01360 $ AB( KA1-L, J1T-KA1+L ), INCA,
01361 $ RWORK( J1T ), WORK( J1T ), KA1 )
01362 930 CONTINUE
01363 940 CONTINUE
01364
01365 IF( KB.GT.1 ) THEN
01366 DO 950 J = 2, I2 - KA
01367 RWORK( J ) = RWORK( J+KA )
01368 WORK( J ) = WORK( J+KA )
01369 950 CONTINUE
01370 END IF
01371
01372 END IF
01373
01374 GO TO 490
01375
01376
01377
01378 END