00001 SUBROUTINE ZLARFB( SIDE, TRANS, DIRECT, STOREV, M, N, K, V, LDV,
00002 $ T, LDT, C, LDC, WORK, LDWORK )
00003 IMPLICIT NONE
00004
00005
00006
00007
00008
00009
00010
00011 CHARACTER DIRECT, SIDE, STOREV, TRANS
00012 INTEGER K, LDC, LDT, LDV, LDWORK, M, N
00013
00014
00015 COMPLEX*16 C( LDC, * ), T( LDT, * ), V( LDV, * ),
00016 $ WORK( LDWORK, * )
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 ONE
00095 PARAMETER ( ONE = ( 1.0D+0, 0.0D+0 ) )
00096
00097
00098 CHARACTER TRANST
00099 INTEGER I, J, LASTV, LASTC
00100
00101
00102 LOGICAL LSAME
00103 INTEGER ILAZLR, ILAZLC
00104 EXTERNAL LSAME, ILAZLR, ILAZLC
00105
00106
00107 EXTERNAL ZCOPY, ZGEMM, ZLACGV, ZTRMM
00108
00109
00110 INTRINSIC DCONJG
00111
00112
00113
00114
00115
00116 IF( M.LE.0 .OR. N.LE.0 )
00117 $ RETURN
00118
00119 IF( LSAME( TRANS, 'N' ) ) THEN
00120 TRANST = 'C'
00121 ELSE
00122 TRANST = 'N'
00123 END IF
00124
00125 IF( LSAME( STOREV, 'C' ) ) THEN
00126
00127 IF( LSAME( DIRECT, 'F' ) ) THEN
00128
00129
00130
00131
00132
00133 IF( LSAME( SIDE, 'L' ) ) THEN
00134
00135
00136
00137
00138 LASTV = MAX( K, ILAZLR( M, K, V, LDV ) )
00139 LASTC = ILAZLC( LASTV, N, C, LDC )
00140
00141
00142
00143
00144
00145 DO 10 J = 1, K
00146 CALL ZCOPY( LASTC, C( J, 1 ), LDC, WORK( 1, J ), 1 )
00147 CALL ZLACGV( LASTC, WORK( 1, J ), 1 )
00148 10 CONTINUE
00149
00150
00151
00152 CALL ZTRMM( 'Right', 'Lower', 'No transpose', 'Unit',
00153 $ LASTC, K, ONE, V, LDV, WORK, LDWORK )
00154 IF( LASTV.GT.K ) THEN
00155
00156
00157
00158 CALL ZGEMM( 'Conjugate transpose', 'No transpose',
00159 $ LASTC, K, LASTV-K, ONE, C( K+1, 1 ), LDC,
00160 $ V( K+1, 1 ), LDV, ONE, WORK, LDWORK )
00161 END IF
00162
00163
00164
00165 CALL ZTRMM( 'Right', 'Upper', TRANST, 'Non-unit',
00166 $ LASTC, K, ONE, T, LDT, WORK, LDWORK )
00167
00168
00169
00170 IF( M.GT.K ) THEN
00171
00172
00173
00174 CALL ZGEMM( 'No transpose', 'Conjugate transpose',
00175 $ LASTV-K, LASTC, K,
00176 $ -ONE, V( K+1, 1 ), LDV, WORK, LDWORK,
00177 $ ONE, C( K+1, 1 ), LDC )
00178 END IF
00179
00180
00181
00182 CALL ZTRMM( 'Right', 'Lower', 'Conjugate transpose',
00183 $ 'Unit', LASTC, K, ONE, V, LDV, WORK, LDWORK )
00184
00185
00186
00187 DO 30 J = 1, K
00188 DO 20 I = 1, LASTC
00189 C( J, I ) = C( J, I ) - DCONJG( WORK( I, J ) )
00190 20 CONTINUE
00191 30 CONTINUE
00192
00193 ELSE IF( LSAME( SIDE, 'R' ) ) THEN
00194
00195
00196
00197 LASTV = MAX( K, ILAZLR( N, K, V, LDV ) )
00198 LASTC = ILAZLR( M, LASTV, C, LDC )
00199
00200
00201
00202
00203
00204 DO 40 J = 1, K
00205 CALL ZCOPY( LASTC, C( 1, J ), 1, WORK( 1, J ), 1 )
00206 40 CONTINUE
00207
00208
00209
00210 CALL ZTRMM( 'Right', 'Lower', 'No transpose', 'Unit',
00211 $ LASTC, K, ONE, V, LDV, WORK, LDWORK )
00212 IF( LASTV.GT.K ) THEN
00213
00214
00215
00216 CALL ZGEMM( 'No transpose', 'No transpose',
00217 $ LASTC, K, LASTV-K,
00218 $ ONE, C( 1, K+1 ), LDC, V( K+1, 1 ), LDV,
00219 $ ONE, WORK, LDWORK )
00220 END IF
00221
00222
00223
00224 CALL ZTRMM( 'Right', 'Upper', TRANS, 'Non-unit',
00225 $ LASTC, K, ONE, T, LDT, WORK, LDWORK )
00226
00227
00228
00229 IF( LASTV.GT.K ) THEN
00230
00231
00232
00233 CALL ZGEMM( 'No transpose', 'Conjugate transpose',
00234 $ LASTC, LASTV-K, K,
00235 $ -ONE, WORK, LDWORK, V( K+1, 1 ), LDV,
00236 $ ONE, C( 1, K+1 ), LDC )
00237 END IF
00238
00239
00240
00241 CALL ZTRMM( 'Right', 'Lower', 'Conjugate transpose',
00242 $ 'Unit', LASTC, K, ONE, V, LDV, WORK, LDWORK )
00243
00244
00245
00246 DO 60 J = 1, K
00247 DO 50 I = 1, LASTC
00248 C( I, J ) = C( I, J ) - WORK( I, J )
00249 50 CONTINUE
00250 60 CONTINUE
00251 END IF
00252
00253 ELSE
00254
00255
00256
00257
00258
00259 IF( LSAME( SIDE, 'L' ) ) THEN
00260
00261
00262
00263
00264 LASTV = MAX( K, ILAZLR( M, K, V, LDV ) )
00265 LASTC = ILAZLC( LASTV, N, C, LDC )
00266
00267
00268
00269
00270
00271 DO 70 J = 1, K
00272 CALL ZCOPY( LASTC, C( LASTV-K+J, 1 ), LDC,
00273 $ WORK( 1, J ), 1 )
00274 CALL ZLACGV( LASTC, WORK( 1, J ), 1 )
00275 70 CONTINUE
00276
00277
00278
00279 CALL ZTRMM( 'Right', 'Upper', 'No transpose', 'Unit',
00280 $ LASTC, K, ONE, V( LASTV-K+1, 1 ), LDV,
00281 $ WORK, LDWORK )
00282 IF( LASTV.GT.K ) THEN
00283
00284
00285
00286 CALL ZGEMM( 'Conjugate transpose', 'No transpose',
00287 $ LASTC, K, LASTV-K,
00288 $ ONE, C, LDC, V, LDV,
00289 $ ONE, WORK, LDWORK )
00290 END IF
00291
00292
00293
00294 CALL ZTRMM( 'Right', 'Lower', TRANST, 'Non-unit',
00295 $ LASTC, K, ONE, T, LDT, WORK, LDWORK )
00296
00297
00298
00299 IF( LASTV.GT.K ) THEN
00300
00301
00302
00303 CALL ZGEMM( 'No transpose', 'Conjugate transpose',
00304 $ LASTV-K, LASTC, K,
00305 $ -ONE, V, LDV, WORK, LDWORK,
00306 $ ONE, C, LDC )
00307 END IF
00308
00309
00310
00311 CALL ZTRMM( 'Right', 'Upper', 'Conjugate transpose',
00312 $ 'Unit', LASTC, K, ONE, V( LASTV-K+1, 1 ), LDV,
00313 $ WORK, LDWORK )
00314
00315
00316
00317 DO 90 J = 1, K
00318 DO 80 I = 1, LASTC
00319 C( LASTV-K+J, I ) = C( LASTV-K+J, I ) -
00320 $ DCONJG( WORK( I, J ) )
00321 80 CONTINUE
00322 90 CONTINUE
00323
00324 ELSE IF( LSAME( SIDE, 'R' ) ) THEN
00325
00326
00327
00328 LASTV = MAX( K, ILAZLR( N, K, V, LDV ) )
00329 LASTC = ILAZLR( M, LASTV, C, LDC )
00330
00331
00332
00333
00334
00335 DO 100 J = 1, K
00336 CALL ZCOPY( LASTC, C( 1, LASTV-K+J ), 1,
00337 $ WORK( 1, J ), 1 )
00338 100 CONTINUE
00339
00340
00341
00342 CALL ZTRMM( 'Right', 'Upper', 'No transpose', 'Unit',
00343 $ LASTC, K, ONE, V( LASTV-K+1, 1 ), LDV,
00344 $ WORK, LDWORK )
00345 IF( LASTV.GT.K ) THEN
00346
00347
00348
00349 CALL ZGEMM( 'No transpose', 'No transpose',
00350 $ LASTC, K, LASTV-K,
00351 $ ONE, C, LDC, V, LDV, ONE, WORK, LDWORK )
00352 END IF
00353
00354
00355
00356 CALL ZTRMM( 'Right', 'Lower', TRANS, 'Non-unit',
00357 $ LASTC, K, ONE, T, LDT, WORK, LDWORK )
00358
00359
00360
00361 IF( LASTV.GT.K ) THEN
00362
00363
00364
00365 CALL ZGEMM( 'No transpose', 'Conjugate transpose',
00366 $ LASTC, LASTV-K, K, -ONE, WORK, LDWORK, V, LDV,
00367 $ ONE, C, LDC )
00368 END IF
00369
00370
00371
00372 CALL ZTRMM( 'Right', 'Upper', 'Conjugate transpose',
00373 $ 'Unit', LASTC, K, ONE, V( LASTV-K+1, 1 ), LDV,
00374 $ WORK, LDWORK )
00375
00376
00377
00378 DO 120 J = 1, K
00379 DO 110 I = 1, LASTC
00380 C( I, LASTV-K+J ) = C( I, LASTV-K+J )
00381 $ - WORK( I, J )
00382 110 CONTINUE
00383 120 CONTINUE
00384 END IF
00385 END IF
00386
00387 ELSE IF( LSAME( STOREV, 'R' ) ) THEN
00388
00389 IF( LSAME( DIRECT, 'F' ) ) THEN
00390
00391
00392
00393
00394 IF( LSAME( SIDE, 'L' ) ) THEN
00395
00396
00397
00398
00399 LASTV = MAX( K, ILAZLC( K, M, V, LDV ) )
00400 LASTC = ILAZLC( LASTV, N, C, LDC )
00401
00402
00403
00404
00405
00406 DO 130 J = 1, K
00407 CALL ZCOPY( LASTC, C( J, 1 ), LDC, WORK( 1, J ), 1 )
00408 CALL ZLACGV( LASTC, WORK( 1, J ), 1 )
00409 130 CONTINUE
00410
00411
00412
00413 CALL ZTRMM( 'Right', 'Upper', 'Conjugate transpose',
00414 $ 'Unit', LASTC, K, ONE, V, LDV, WORK, LDWORK )
00415 IF( LASTV.GT.K ) THEN
00416
00417
00418
00419 CALL ZGEMM( 'Conjugate transpose',
00420 $ 'Conjugate transpose', LASTC, K, LASTV-K,
00421 $ ONE, C( K+1, 1 ), LDC, V( 1, K+1 ), LDV,
00422 $ ONE, WORK, LDWORK )
00423 END IF
00424
00425
00426
00427 CALL ZTRMM( 'Right', 'Upper', TRANST, 'Non-unit',
00428 $ LASTC, K, ONE, T, LDT, WORK, LDWORK )
00429
00430
00431
00432 IF( LASTV.GT.K ) THEN
00433
00434
00435
00436 CALL ZGEMM( 'Conjugate transpose',
00437 $ 'Conjugate transpose', LASTV-K, LASTC, K,
00438 $ -ONE, V( 1, K+1 ), LDV, WORK, LDWORK,
00439 $ ONE, C( K+1, 1 ), LDC )
00440 END IF
00441
00442
00443
00444 CALL ZTRMM( 'Right', 'Upper', 'No transpose', 'Unit',
00445 $ LASTC, K, ONE, V, LDV, WORK, LDWORK )
00446
00447
00448
00449 DO 150 J = 1, K
00450 DO 140 I = 1, LASTC
00451 C( J, I ) = C( J, I ) - DCONJG( WORK( I, J ) )
00452 140 CONTINUE
00453 150 CONTINUE
00454
00455 ELSE IF( LSAME( SIDE, 'R' ) ) THEN
00456
00457
00458
00459 LASTV = MAX( K, ILAZLC( K, N, V, LDV ) )
00460 LASTC = ILAZLR( M, LASTV, C, LDC )
00461
00462
00463
00464
00465
00466 DO 160 J = 1, K
00467 CALL ZCOPY( LASTC, C( 1, J ), 1, WORK( 1, J ), 1 )
00468 160 CONTINUE
00469
00470
00471
00472 CALL ZTRMM( 'Right', 'Upper', 'Conjugate transpose',
00473 $ 'Unit', LASTC, K, ONE, V, LDV, WORK, LDWORK )
00474 IF( LASTV.GT.K ) THEN
00475
00476
00477
00478 CALL ZGEMM( 'No transpose', 'Conjugate transpose',
00479 $ LASTC, K, LASTV-K, ONE, C( 1, K+1 ), LDC,
00480 $ V( 1, K+1 ), LDV, ONE, WORK, LDWORK )
00481 END IF
00482
00483
00484
00485 CALL ZTRMM( 'Right', 'Upper', TRANS, 'Non-unit',
00486 $ LASTC, K, ONE, T, LDT, WORK, LDWORK )
00487
00488
00489
00490 IF( LASTV.GT.K ) THEN
00491
00492
00493
00494 CALL ZGEMM( 'No transpose', 'No transpose',
00495 $ LASTC, LASTV-K, K,
00496 $ -ONE, WORK, LDWORK, V( 1, K+1 ), LDV,
00497 $ ONE, C( 1, K+1 ), LDC )
00498 END IF
00499
00500
00501
00502 CALL ZTRMM( 'Right', 'Upper', 'No transpose', 'Unit',
00503 $ LASTC, K, ONE, V, LDV, WORK, LDWORK )
00504
00505
00506
00507 DO 180 J = 1, K
00508 DO 170 I = 1, LASTC
00509 C( I, J ) = C( I, J ) - WORK( I, J )
00510 170 CONTINUE
00511 180 CONTINUE
00512
00513 END IF
00514
00515 ELSE
00516
00517
00518
00519
00520 IF( LSAME( SIDE, 'L' ) ) THEN
00521
00522
00523
00524
00525 LASTV = MAX( K, ILAZLC( K, M, V, LDV ) )
00526 LASTC = ILAZLC( LASTV, N, C, LDC )
00527
00528
00529
00530
00531
00532 DO 190 J = 1, K
00533 CALL ZCOPY( LASTC, C( LASTV-K+J, 1 ), LDC,
00534 $ WORK( 1, J ), 1 )
00535 CALL ZLACGV( LASTC, WORK( 1, J ), 1 )
00536 190 CONTINUE
00537
00538
00539
00540 CALL ZTRMM( 'Right', 'Lower', 'Conjugate transpose',
00541 $ 'Unit', LASTC, K, ONE, V( 1, LASTV-K+1 ), LDV,
00542 $ WORK, LDWORK )
00543 IF( LASTV.GT.K ) THEN
00544
00545
00546
00547 CALL ZGEMM( 'Conjugate transpose',
00548 $ 'Conjugate transpose', LASTC, K, LASTV-K,
00549 $ ONE, C, LDC, V, LDV, ONE, WORK, LDWORK )
00550 END IF
00551
00552
00553
00554 CALL ZTRMM( 'Right', 'Lower', TRANST, 'Non-unit',
00555 $ LASTC, K, ONE, T, LDT, WORK, LDWORK )
00556
00557
00558
00559 IF( LASTV.GT.K ) THEN
00560
00561
00562
00563 CALL ZGEMM( 'Conjugate transpose',
00564 $ 'Conjugate transpose', LASTV-K, LASTC, K,
00565 $ -ONE, V, LDV, WORK, LDWORK, ONE, C, LDC )
00566 END IF
00567
00568
00569
00570 CALL ZTRMM( 'Right', 'Lower', 'No transpose', 'Unit',
00571 $ LASTC, K, ONE, V( 1, LASTV-K+1 ), LDV,
00572 $ WORK, LDWORK )
00573
00574
00575
00576 DO 210 J = 1, K
00577 DO 200 I = 1, LASTC
00578 C( LASTV-K+J, I ) = C( LASTV-K+J, I ) -
00579 $ DCONJG( WORK( I, J ) )
00580 200 CONTINUE
00581 210 CONTINUE
00582
00583 ELSE IF( LSAME( SIDE, 'R' ) ) THEN
00584
00585
00586
00587 LASTV = MAX( K, ILAZLC( K, N, V, LDV ) )
00588 LASTC = ILAZLR( M, LASTV, C, LDC )
00589
00590
00591
00592
00593
00594 DO 220 J = 1, K
00595 CALL ZCOPY( LASTC, C( 1, LASTV-K+J ), 1,
00596 $ WORK( 1, J ), 1 )
00597 220 CONTINUE
00598
00599
00600
00601 CALL ZTRMM( 'Right', 'Lower', 'Conjugate transpose',
00602 $ 'Unit', LASTC, K, ONE, V( 1, LASTV-K+1 ), LDV,
00603 $ WORK, LDWORK )
00604 IF( LASTV.GT.K ) THEN
00605
00606
00607
00608 CALL ZGEMM( 'No transpose', 'Conjugate transpose',
00609 $ LASTC, K, LASTV-K, ONE, C, LDC, V, LDV, ONE,
00610 $ WORK, LDWORK )
00611 END IF
00612
00613
00614
00615 CALL ZTRMM( 'Right', 'Lower', TRANS, 'Non-unit',
00616 $ LASTC, K, ONE, T, LDT, WORK, LDWORK )
00617
00618
00619
00620 IF( LASTV.GT.K ) THEN
00621
00622
00623
00624 CALL ZGEMM( 'No transpose', 'No transpose',
00625 $ LASTC, LASTV-K, K, -ONE, WORK, LDWORK, V, LDV,
00626 $ ONE, C, LDC )
00627 END IF
00628
00629
00630
00631 CALL ZTRMM( 'Right', 'Lower', 'No transpose', 'Unit',
00632 $ LASTC, K, ONE, V( 1, LASTV-K+1 ), LDV,
00633 $ WORK, LDWORK )
00634
00635
00636
00637 DO 240 J = 1, K
00638 DO 230 I = 1, LASTC
00639 C( I, LASTV-K+J ) = C( I, LASTV-K+J )
00640 $ - WORK( I, J )
00641 230 CONTINUE
00642 240 CONTINUE
00643
00644 END IF
00645
00646 END IF
00647 END IF
00648
00649 RETURN
00650
00651
00652
00653 END