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