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