00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015
00016
00017
00018 static integer c__1 = 1;
00019 static real c_b14 = 1.f;
00020 static real c_b25 = -1.f;
00021
00022 int slarfb_(char *side, char *trans, char *direct, char *
00023 storev, integer *m, integer *n, integer *k, real *v, integer *ldv,
00024 real *t, integer *ldt, real *c__, integer *ldc, real *work, integer *
00025 ldwork)
00026 {
00027
00028 integer c_dim1, c_offset, t_dim1, t_offset, v_dim1, v_offset, work_dim1,
00029 work_offset, i__1, i__2;
00030
00031
00032 integer i__, j;
00033 extern logical lsame_(char *, char *);
00034 integer lastc;
00035 extern int sgemm_(char *, char *, integer *, integer *,
00036 integer *, real *, real *, integer *, real *, integer *, real *,
00037 real *, integer *);
00038 integer lastv;
00039 extern int scopy_(integer *, real *, integer *, real *,
00040 integer *), strmm_(char *, char *, char *, char *, integer *,
00041 integer *, real *, real *, integer *, real *, integer *);
00042 extern integer ilaslc_(integer *, integer *, real *, integer *), ilaslr_(
00043 integer *, integer *, real *, integer *);
00044 char transt[1];
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
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143 v_dim1 = *ldv;
00144 v_offset = 1 + v_dim1;
00145 v -= v_offset;
00146 t_dim1 = *ldt;
00147 t_offset = 1 + t_dim1;
00148 t -= t_offset;
00149 c_dim1 = *ldc;
00150 c_offset = 1 + c_dim1;
00151 c__ -= c_offset;
00152 work_dim1 = *ldwork;
00153 work_offset = 1 + work_dim1;
00154 work -= work_offset;
00155
00156
00157 if (*m <= 0 || *n <= 0) {
00158 return 0;
00159 }
00160
00161 if (lsame_(trans, "N")) {
00162 *(unsigned char *)transt = 'T';
00163 } else {
00164 *(unsigned char *)transt = 'N';
00165 }
00166
00167 if (lsame_(storev, "C")) {
00168
00169 if (lsame_(direct, "F")) {
00170
00171
00172
00173
00174
00175 if (lsame_(side, "L")) {
00176
00177
00178
00179
00180
00181 i__1 = *k, i__2 = ilaslr_(m, k, &v[v_offset], ldv);
00182 lastv = max(i__1,i__2);
00183 lastc = ilaslc_(&lastv, n, &c__[c_offset], ldc);
00184
00185
00186
00187
00188
00189 i__1 = *k;
00190 for (j = 1; j <= i__1; ++j) {
00191 scopy_(&lastc, &c__[j + c_dim1], ldc, &work[j * work_dim1
00192 + 1], &c__1);
00193
00194 }
00195
00196
00197
00198 strmm_("Right", "Lower", "No transpose", "Unit", &lastc, k, &
00199 c_b14, &v[v_offset], ldv, &work[work_offset], ldwork);
00200 if (lastv > *k) {
00201
00202
00203
00204 i__1 = lastv - *k;
00205 sgemm_("Transpose", "No transpose", &lastc, k, &i__1, &
00206 c_b14, &c__[*k + 1 + c_dim1], ldc, &v[*k + 1 +
00207 v_dim1], ldv, &c_b14, &work[work_offset], ldwork);
00208 }
00209
00210
00211
00212 strmm_("Right", "Upper", transt, "Non-unit", &lastc, k, &
00213 c_b14, &t[t_offset], ldt, &work[work_offset], ldwork);
00214
00215
00216
00217 if (lastv > *k) {
00218
00219
00220
00221 i__1 = lastv - *k;
00222 sgemm_("No transpose", "Transpose", &i__1, &lastc, k, &
00223 c_b25, &v[*k + 1 + v_dim1], ldv, &work[
00224 work_offset], ldwork, &c_b14, &c__[*k + 1 +
00225 c_dim1], ldc);
00226 }
00227
00228
00229
00230 strmm_("Right", "Lower", "Transpose", "Unit", &lastc, k, &
00231 c_b14, &v[v_offset], ldv, &work[work_offset], ldwork);
00232
00233
00234
00235 i__1 = *k;
00236 for (j = 1; j <= i__1; ++j) {
00237 i__2 = lastc;
00238 for (i__ = 1; i__ <= i__2; ++i__) {
00239 c__[j + i__ * c_dim1] -= work[i__ + j * work_dim1];
00240
00241 }
00242
00243 }
00244
00245 } else if (lsame_(side, "R")) {
00246
00247
00248
00249
00250 i__1 = *k, i__2 = ilaslr_(n, k, &v[v_offset], ldv);
00251 lastv = max(i__1,i__2);
00252 lastc = ilaslr_(m, &lastv, &c__[c_offset], ldc);
00253
00254
00255
00256
00257
00258 i__1 = *k;
00259 for (j = 1; j <= i__1; ++j) {
00260 scopy_(&lastc, &c__[j * c_dim1 + 1], &c__1, &work[j *
00261 work_dim1 + 1], &c__1);
00262
00263 }
00264
00265
00266
00267 strmm_("Right", "Lower", "No transpose", "Unit", &lastc, k, &
00268 c_b14, &v[v_offset], ldv, &work[work_offset], ldwork);
00269 if (lastv > *k) {
00270
00271
00272
00273 i__1 = lastv - *k;
00274 sgemm_("No transpose", "No transpose", &lastc, k, &i__1, &
00275 c_b14, &c__[(*k + 1) * c_dim1 + 1], ldc, &v[*k +
00276 1 + v_dim1], ldv, &c_b14, &work[work_offset],
00277 ldwork);
00278 }
00279
00280
00281
00282 strmm_("Right", "Upper", trans, "Non-unit", &lastc, k, &c_b14,
00283 &t[t_offset], ldt, &work[work_offset], ldwork);
00284
00285
00286
00287 if (lastv > *k) {
00288
00289
00290
00291 i__1 = lastv - *k;
00292 sgemm_("No transpose", "Transpose", &lastc, &i__1, k, &
00293 c_b25, &work[work_offset], ldwork, &v[*k + 1 +
00294 v_dim1], ldv, &c_b14, &c__[(*k + 1) * c_dim1 + 1],
00295 ldc);
00296 }
00297
00298
00299
00300 strmm_("Right", "Lower", "Transpose", "Unit", &lastc, k, &
00301 c_b14, &v[v_offset], ldv, &work[work_offset], ldwork);
00302
00303
00304
00305 i__1 = *k;
00306 for (j = 1; j <= i__1; ++j) {
00307 i__2 = lastc;
00308 for (i__ = 1; i__ <= i__2; ++i__) {
00309 c__[i__ + j * c_dim1] -= work[i__ + j * work_dim1];
00310
00311 }
00312
00313 }
00314 }
00315
00316 } else {
00317
00318
00319
00320
00321
00322 if (lsame_(side, "L")) {
00323
00324
00325
00326
00327
00328 i__1 = *k, i__2 = ilaslr_(m, k, &v[v_offset], ldv);
00329 lastv = max(i__1,i__2);
00330 lastc = ilaslc_(&lastv, n, &c__[c_offset], ldc);
00331
00332
00333
00334
00335
00336 i__1 = *k;
00337 for (j = 1; j <= i__1; ++j) {
00338 scopy_(&lastc, &c__[lastv - *k + j + c_dim1], ldc, &work[
00339 j * work_dim1 + 1], &c__1);
00340
00341 }
00342
00343
00344
00345 strmm_("Right", "Upper", "No transpose", "Unit", &lastc, k, &
00346 c_b14, &v[lastv - *k + 1 + v_dim1], ldv, &work[
00347 work_offset], ldwork);
00348 if (lastv > *k) {
00349
00350
00351
00352 i__1 = lastv - *k;
00353 sgemm_("Transpose", "No transpose", &lastc, k, &i__1, &
00354 c_b14, &c__[c_offset], ldc, &v[v_offset], ldv, &
00355 c_b14, &work[work_offset], ldwork);
00356 }
00357
00358
00359
00360 strmm_("Right", "Lower", transt, "Non-unit", &lastc, k, &
00361 c_b14, &t[t_offset], ldt, &work[work_offset], ldwork);
00362
00363
00364
00365 if (lastv > *k) {
00366
00367
00368
00369 i__1 = lastv - *k;
00370 sgemm_("No transpose", "Transpose", &i__1, &lastc, k, &
00371 c_b25, &v[v_offset], ldv, &work[work_offset],
00372 ldwork, &c_b14, &c__[c_offset], ldc);
00373 }
00374
00375
00376
00377 strmm_("Right", "Upper", "Transpose", "Unit", &lastc, k, &
00378 c_b14, &v[lastv - *k + 1 + v_dim1], ldv, &work[
00379 work_offset], ldwork);
00380
00381
00382
00383 i__1 = *k;
00384 for (j = 1; j <= i__1; ++j) {
00385 i__2 = lastc;
00386 for (i__ = 1; i__ <= i__2; ++i__) {
00387 c__[lastv - *k + j + i__ * c_dim1] -= work[i__ + j *
00388 work_dim1];
00389
00390 }
00391
00392 }
00393
00394 } else if (lsame_(side, "R")) {
00395
00396
00397
00398
00399 i__1 = *k, i__2 = ilaslr_(n, k, &v[v_offset], ldv);
00400 lastv = max(i__1,i__2);
00401 lastc = ilaslr_(m, &lastv, &c__[c_offset], ldc);
00402
00403
00404
00405
00406
00407 i__1 = *k;
00408 for (j = 1; j <= i__1; ++j) {
00409 scopy_(&lastc, &c__[(*n - *k + j) * c_dim1 + 1], &c__1, &
00410 work[j * work_dim1 + 1], &c__1);
00411
00412 }
00413
00414
00415
00416 strmm_("Right", "Upper", "No transpose", "Unit", &lastc, k, &
00417 c_b14, &v[lastv - *k + 1 + v_dim1], ldv, &work[
00418 work_offset], ldwork);
00419 if (lastv > *k) {
00420
00421
00422
00423 i__1 = lastv - *k;
00424 sgemm_("No transpose", "No transpose", &lastc, k, &i__1, &
00425 c_b14, &c__[c_offset], ldc, &v[v_offset], ldv, &
00426 c_b14, &work[work_offset], ldwork);
00427 }
00428
00429
00430
00431 strmm_("Right", "Lower", trans, "Non-unit", &lastc, k, &c_b14,
00432 &t[t_offset], ldt, &work[work_offset], ldwork);
00433
00434
00435
00436 if (lastv > *k) {
00437
00438
00439
00440 i__1 = lastv - *k;
00441 sgemm_("No transpose", "Transpose", &lastc, &i__1, k, &
00442 c_b25, &work[work_offset], ldwork, &v[v_offset],
00443 ldv, &c_b14, &c__[c_offset], ldc);
00444 }
00445
00446
00447
00448 strmm_("Right", "Upper", "Transpose", "Unit", &lastc, k, &
00449 c_b14, &v[lastv - *k + 1 + v_dim1], ldv, &work[
00450 work_offset], ldwork);
00451
00452
00453
00454 i__1 = *k;
00455 for (j = 1; j <= i__1; ++j) {
00456 i__2 = lastc;
00457 for (i__ = 1; i__ <= i__2; ++i__) {
00458 c__[i__ + (lastv - *k + j) * c_dim1] -= work[i__ + j *
00459 work_dim1];
00460
00461 }
00462
00463 }
00464 }
00465 }
00466
00467 } else if (lsame_(storev, "R")) {
00468
00469 if (lsame_(direct, "F")) {
00470
00471
00472
00473
00474 if (lsame_(side, "L")) {
00475
00476
00477
00478
00479
00480 i__1 = *k, i__2 = ilaslc_(k, m, &v[v_offset], ldv);
00481 lastv = max(i__1,i__2);
00482 lastc = ilaslc_(&lastv, n, &c__[c_offset], ldc);
00483
00484
00485
00486
00487
00488 i__1 = *k;
00489 for (j = 1; j <= i__1; ++j) {
00490 scopy_(&lastc, &c__[j + c_dim1], ldc, &work[j * work_dim1
00491 + 1], &c__1);
00492
00493 }
00494
00495
00496
00497 strmm_("Right", "Upper", "Transpose", "Unit", &lastc, k, &
00498 c_b14, &v[v_offset], ldv, &work[work_offset], ldwork);
00499 if (lastv > *k) {
00500
00501
00502
00503 i__1 = lastv - *k;
00504 sgemm_("Transpose", "Transpose", &lastc, k, &i__1, &c_b14,
00505 &c__[*k + 1 + c_dim1], ldc, &v[(*k + 1) * v_dim1
00506 + 1], ldv, &c_b14, &work[work_offset], ldwork);
00507 }
00508
00509
00510
00511 strmm_("Right", "Upper", transt, "Non-unit", &lastc, k, &
00512 c_b14, &t[t_offset], ldt, &work[work_offset], ldwork);
00513
00514
00515
00516 if (lastv > *k) {
00517
00518
00519
00520 i__1 = lastv - *k;
00521 sgemm_("Transpose", "Transpose", &i__1, &lastc, k, &c_b25,
00522 &v[(*k + 1) * v_dim1 + 1], ldv, &work[
00523 work_offset], ldwork, &c_b14, &c__[*k + 1 +
00524 c_dim1], ldc);
00525 }
00526
00527
00528
00529 strmm_("Right", "Upper", "No transpose", "Unit", &lastc, k, &
00530 c_b14, &v[v_offset], ldv, &work[work_offset], ldwork);
00531
00532
00533
00534 i__1 = *k;
00535 for (j = 1; j <= i__1; ++j) {
00536 i__2 = lastc;
00537 for (i__ = 1; i__ <= i__2; ++i__) {
00538 c__[j + i__ * c_dim1] -= work[i__ + j * work_dim1];
00539
00540 }
00541
00542 }
00543
00544 } else if (lsame_(side, "R")) {
00545
00546
00547
00548
00549 i__1 = *k, i__2 = ilaslc_(k, n, &v[v_offset], ldv);
00550 lastv = max(i__1,i__2);
00551 lastc = ilaslr_(m, &lastv, &c__[c_offset], ldc);
00552
00553
00554
00555
00556
00557 i__1 = *k;
00558 for (j = 1; j <= i__1; ++j) {
00559 scopy_(&lastc, &c__[j * c_dim1 + 1], &c__1, &work[j *
00560 work_dim1 + 1], &c__1);
00561
00562 }
00563
00564
00565
00566 strmm_("Right", "Upper", "Transpose", "Unit", &lastc, k, &
00567 c_b14, &v[v_offset], ldv, &work[work_offset], ldwork);
00568 if (lastv > *k) {
00569
00570
00571
00572 i__1 = lastv - *k;
00573 sgemm_("No transpose", "Transpose", &lastc, k, &i__1, &
00574 c_b14, &c__[(*k + 1) * c_dim1 + 1], ldc, &v[(*k +
00575 1) * v_dim1 + 1], ldv, &c_b14, &work[work_offset],
00576 ldwork);
00577 }
00578
00579
00580
00581 strmm_("Right", "Upper", trans, "Non-unit", &lastc, k, &c_b14,
00582 &t[t_offset], ldt, &work[work_offset], ldwork);
00583
00584
00585
00586 if (lastv > *k) {
00587
00588
00589
00590 i__1 = lastv - *k;
00591 sgemm_("No transpose", "No transpose", &lastc, &i__1, k, &
00592 c_b25, &work[work_offset], ldwork, &v[(*k + 1) *
00593 v_dim1 + 1], ldv, &c_b14, &c__[(*k + 1) * c_dim1
00594 + 1], ldc);
00595 }
00596
00597
00598
00599 strmm_("Right", "Upper", "No transpose", "Unit", &lastc, k, &
00600 c_b14, &v[v_offset], ldv, &work[work_offset], ldwork);
00601
00602
00603
00604 i__1 = *k;
00605 for (j = 1; j <= i__1; ++j) {
00606 i__2 = lastc;
00607 for (i__ = 1; i__ <= i__2; ++i__) {
00608 c__[i__ + j * c_dim1] -= work[i__ + j * work_dim1];
00609
00610 }
00611
00612 }
00613
00614 }
00615
00616 } else {
00617
00618
00619
00620
00621 if (lsame_(side, "L")) {
00622
00623
00624
00625
00626
00627 i__1 = *k, i__2 = ilaslc_(k, m, &v[v_offset], ldv);
00628 lastv = max(i__1,i__2);
00629 lastc = ilaslc_(&lastv, n, &c__[c_offset], ldc);
00630
00631
00632
00633
00634
00635 i__1 = *k;
00636 for (j = 1; j <= i__1; ++j) {
00637 scopy_(&lastc, &c__[lastv - *k + j + c_dim1], ldc, &work[
00638 j * work_dim1 + 1], &c__1);
00639
00640 }
00641
00642
00643
00644 strmm_("Right", "Lower", "Transpose", "Unit", &lastc, k, &
00645 c_b14, &v[(lastv - *k + 1) * v_dim1 + 1], ldv, &work[
00646 work_offset], ldwork);
00647 if (lastv > *k) {
00648
00649
00650
00651 i__1 = lastv - *k;
00652 sgemm_("Transpose", "Transpose", &lastc, k, &i__1, &c_b14,
00653 &c__[c_offset], ldc, &v[v_offset], ldv, &c_b14, &
00654 work[work_offset], ldwork);
00655 }
00656
00657
00658
00659 strmm_("Right", "Lower", transt, "Non-unit", &lastc, k, &
00660 c_b14, &t[t_offset], ldt, &work[work_offset], ldwork);
00661
00662
00663
00664 if (lastv > *k) {
00665
00666
00667
00668 i__1 = lastv - *k;
00669 sgemm_("Transpose", "Transpose", &i__1, &lastc, k, &c_b25,
00670 &v[v_offset], ldv, &work[work_offset], ldwork, &
00671 c_b14, &c__[c_offset], ldc);
00672 }
00673
00674
00675
00676 strmm_("Right", "Lower", "No transpose", "Unit", &lastc, k, &
00677 c_b14, &v[(lastv - *k + 1) * v_dim1 + 1], ldv, &work[
00678 work_offset], ldwork);
00679
00680
00681
00682 i__1 = *k;
00683 for (j = 1; j <= i__1; ++j) {
00684 i__2 = lastc;
00685 for (i__ = 1; i__ <= i__2; ++i__) {
00686 c__[lastv - *k + j + i__ * c_dim1] -= work[i__ + j *
00687 work_dim1];
00688
00689 }
00690
00691 }
00692
00693 } else if (lsame_(side, "R")) {
00694
00695
00696
00697
00698 i__1 = *k, i__2 = ilaslc_(k, n, &v[v_offset], ldv);
00699 lastv = max(i__1,i__2);
00700 lastc = ilaslr_(m, &lastv, &c__[c_offset], ldc);
00701
00702
00703
00704
00705
00706 i__1 = *k;
00707 for (j = 1; j <= i__1; ++j) {
00708 scopy_(&lastc, &c__[(lastv - *k + j) * c_dim1 + 1], &c__1,
00709 &work[j * work_dim1 + 1], &c__1);
00710
00711 }
00712
00713
00714
00715 strmm_("Right", "Lower", "Transpose", "Unit", &lastc, k, &
00716 c_b14, &v[(lastv - *k + 1) * v_dim1 + 1], ldv, &work[
00717 work_offset], ldwork);
00718 if (lastv > *k) {
00719
00720
00721
00722 i__1 = lastv - *k;
00723 sgemm_("No transpose", "Transpose", &lastc, k, &i__1, &
00724 c_b14, &c__[c_offset], ldc, &v[v_offset], ldv, &
00725 c_b14, &work[work_offset], ldwork);
00726 }
00727
00728
00729
00730 strmm_("Right", "Lower", trans, "Non-unit", &lastc, k, &c_b14,
00731 &t[t_offset], ldt, &work[work_offset], ldwork);
00732
00733
00734
00735 if (lastv > *k) {
00736
00737
00738
00739 i__1 = lastv - *k;
00740 sgemm_("No transpose", "No transpose", &lastc, &i__1, k, &
00741 c_b25, &work[work_offset], ldwork, &v[v_offset],
00742 ldv, &c_b14, &c__[c_offset], ldc);
00743 }
00744
00745
00746
00747 strmm_("Right", "Lower", "No transpose", "Unit", &lastc, k, &
00748 c_b14, &v[(lastv - *k + 1) * v_dim1 + 1], ldv, &work[
00749 work_offset], ldwork);
00750
00751
00752
00753 i__1 = *k;
00754 for (j = 1; j <= i__1; ++j) {
00755 i__2 = lastc;
00756 for (i__ = 1; i__ <= i__2; ++i__) {
00757 c__[i__ + (lastv - *k + j) * c_dim1] -= work[i__ + j *
00758 work_dim1];
00759
00760 }
00761
00762 }
00763
00764 }
00765
00766 }
00767 }
00768
00769 return 0;
00770
00771
00772
00773 }