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__8 = 8;
00019 static integer c__1 = 1;
00020 static doublereal c_b27 = -1.;
00021 static doublereal c_b42 = 1.;
00022 static doublereal c_b56 = 0.;
00023
00024 int dtgsy2_(char *trans, integer *ijob, integer *m, integer *
00025 n, doublereal *a, integer *lda, doublereal *b, integer *ldb,
00026 doublereal *c__, integer *ldc, doublereal *d__, integer *ldd,
00027 doublereal *e, integer *lde, doublereal *f, integer *ldf, doublereal *
00028 scale, doublereal *rdsum, doublereal *rdscal, integer *iwork, integer
00029 *pq, integer *info)
00030 {
00031
00032 integer a_dim1, a_offset, b_dim1, b_offset, c_dim1, c_offset, d_dim1,
00033 d_offset, e_dim1, e_offset, f_dim1, f_offset, i__1, i__2, i__3;
00034
00035
00036 integer i__, j, k, p, q;
00037 doublereal z__[64] ;
00038 integer ie, je, mb, nb, ii, jj, is, js;
00039 doublereal rhs[8];
00040 integer isp1, jsp1;
00041 extern int dger_(integer *, integer *, doublereal *,
00042 doublereal *, integer *, doublereal *, integer *, doublereal *,
00043 integer *);
00044 integer ierr, zdim, ipiv[8], jpiv[8];
00045 doublereal alpha;
00046 extern int dscal_(integer *, doublereal *, doublereal *,
00047 integer *), dgemm_(char *, char *, integer *, integer *, integer *
00048 , doublereal *, doublereal *, integer *, doublereal *, integer *,
00049 doublereal *, doublereal *, integer *);
00050 extern logical lsame_(char *, char *);
00051 extern int dgemv_(char *, integer *, integer *,
00052 doublereal *, doublereal *, integer *, doublereal *, integer *,
00053 doublereal *, doublereal *, integer *), dcopy_(integer *,
00054 doublereal *, integer *, doublereal *, integer *), daxpy_(integer
00055 *, doublereal *, doublereal *, integer *, doublereal *, integer *)
00056 , dgesc2_(integer *, doublereal *, integer *, doublereal *,
00057 integer *, integer *, doublereal *), dgetc2_(integer *,
00058 doublereal *, integer *, integer *, integer *, integer *),
00059 dlatdf_(integer *, integer *, doublereal *, integer *, doublereal
00060 *, doublereal *, doublereal *, integer *, integer *);
00061 doublereal scaloc;
00062 extern int dlaset_(char *, integer *, integer *,
00063 doublereal *, doublereal *, doublereal *, integer *),
00064 xerbla_(char *, integer *);
00065 logical notran;
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
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
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
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252 a_dim1 = *lda;
00253 a_offset = 1 + a_dim1;
00254 a -= a_offset;
00255 b_dim1 = *ldb;
00256 b_offset = 1 + b_dim1;
00257 b -= b_offset;
00258 c_dim1 = *ldc;
00259 c_offset = 1 + c_dim1;
00260 c__ -= c_offset;
00261 d_dim1 = *ldd;
00262 d_offset = 1 + d_dim1;
00263 d__ -= d_offset;
00264 e_dim1 = *lde;
00265 e_offset = 1 + e_dim1;
00266 e -= e_offset;
00267 f_dim1 = *ldf;
00268 f_offset = 1 + f_dim1;
00269 f -= f_offset;
00270 --iwork;
00271
00272
00273 *info = 0;
00274 ierr = 0;
00275 notran = lsame_(trans, "N");
00276 if (! notran && ! lsame_(trans, "T")) {
00277 *info = -1;
00278 } else if (notran) {
00279 if (*ijob < 0 || *ijob > 2) {
00280 *info = -2;
00281 }
00282 }
00283 if (*info == 0) {
00284 if (*m <= 0) {
00285 *info = -3;
00286 } else if (*n <= 0) {
00287 *info = -4;
00288 } else if (*lda < max(1,*m)) {
00289 *info = -5;
00290 } else if (*ldb < max(1,*n)) {
00291 *info = -8;
00292 } else if (*ldc < max(1,*m)) {
00293 *info = -10;
00294 } else if (*ldd < max(1,*m)) {
00295 *info = -12;
00296 } else if (*lde < max(1,*n)) {
00297 *info = -14;
00298 } else if (*ldf < max(1,*m)) {
00299 *info = -16;
00300 }
00301 }
00302 if (*info != 0) {
00303 i__1 = -(*info);
00304 xerbla_("DTGSY2", &i__1);
00305 return 0;
00306 }
00307
00308
00309
00310 *pq = 0;
00311 p = 0;
00312 i__ = 1;
00313 L10:
00314 if (i__ > *m) {
00315 goto L20;
00316 }
00317 ++p;
00318 iwork[p] = i__;
00319 if (i__ == *m) {
00320 goto L20;
00321 }
00322 if (a[i__ + 1 + i__ * a_dim1] != 0.) {
00323 i__ += 2;
00324 } else {
00325 ++i__;
00326 }
00327 goto L10;
00328 L20:
00329 iwork[p + 1] = *m + 1;
00330
00331
00332
00333 q = p + 1;
00334 j = 1;
00335 L30:
00336 if (j > *n) {
00337 goto L40;
00338 }
00339 ++q;
00340 iwork[q] = j;
00341 if (j == *n) {
00342 goto L40;
00343 }
00344 if (b[j + 1 + j * b_dim1] != 0.) {
00345 j += 2;
00346 } else {
00347 ++j;
00348 }
00349 goto L30;
00350 L40:
00351 iwork[q + 1] = *n + 1;
00352 *pq = p * (q - p - 1);
00353
00354 if (notran) {
00355
00356
00357
00358
00359
00360
00361 *scale = 1.;
00362 scaloc = 1.;
00363 i__1 = q;
00364 for (j = p + 2; j <= i__1; ++j) {
00365 js = iwork[j];
00366 jsp1 = js + 1;
00367 je = iwork[j + 1] - 1;
00368 nb = je - js + 1;
00369 for (i__ = p; i__ >= 1; --i__) {
00370
00371 is = iwork[i__];
00372 isp1 = is + 1;
00373 ie = iwork[i__ + 1] - 1;
00374 mb = ie - is + 1;
00375 zdim = mb * nb << 1;
00376
00377 if (mb == 1 && nb == 1) {
00378
00379
00380
00381 z__[0] = a[is + is * a_dim1];
00382 z__[1] = d__[is + is * d_dim1];
00383 z__[8] = -b[js + js * b_dim1];
00384 z__[9] = -e[js + js * e_dim1];
00385
00386
00387
00388 rhs[0] = c__[is + js * c_dim1];
00389 rhs[1] = f[is + js * f_dim1];
00390
00391
00392
00393 dgetc2_(&zdim, z__, &c__8, ipiv, jpiv, &ierr);
00394 if (ierr > 0) {
00395 *info = ierr;
00396 }
00397
00398 if (*ijob == 0) {
00399 dgesc2_(&zdim, z__, &c__8, rhs, ipiv, jpiv, &scaloc);
00400 if (scaloc != 1.) {
00401 i__2 = *n;
00402 for (k = 1; k <= i__2; ++k) {
00403 dscal_(m, &scaloc, &c__[k * c_dim1 + 1], &
00404 c__1);
00405 dscal_(m, &scaloc, &f[k * f_dim1 + 1], &c__1);
00406
00407 }
00408 *scale *= scaloc;
00409 }
00410 } else {
00411 dlatdf_(ijob, &zdim, z__, &c__8, rhs, rdsum, rdscal,
00412 ipiv, jpiv);
00413 }
00414
00415
00416
00417 c__[is + js * c_dim1] = rhs[0];
00418 f[is + js * f_dim1] = rhs[1];
00419
00420
00421
00422
00423 if (i__ > 1) {
00424 alpha = -rhs[0];
00425 i__2 = is - 1;
00426 daxpy_(&i__2, &alpha, &a[is * a_dim1 + 1], &c__1, &
00427 c__[js * c_dim1 + 1], &c__1);
00428 i__2 = is - 1;
00429 daxpy_(&i__2, &alpha, &d__[is * d_dim1 + 1], &c__1, &
00430 f[js * f_dim1 + 1], &c__1);
00431 }
00432 if (j < q) {
00433 i__2 = *n - je;
00434 daxpy_(&i__2, &rhs[1], &b[js + (je + 1) * b_dim1],
00435 ldb, &c__[is + (je + 1) * c_dim1], ldc);
00436 i__2 = *n - je;
00437 daxpy_(&i__2, &rhs[1], &e[js + (je + 1) * e_dim1],
00438 lde, &f[is + (je + 1) * f_dim1], ldf);
00439 }
00440
00441 } else if (mb == 1 && nb == 2) {
00442
00443
00444
00445 z__[0] = a[is + is * a_dim1];
00446 z__[1] = 0.;
00447 z__[2] = d__[is + is * d_dim1];
00448 z__[3] = 0.;
00449
00450 z__[8] = 0.;
00451 z__[9] = a[is + is * a_dim1];
00452 z__[10] = 0.;
00453 z__[11] = d__[is + is * d_dim1];
00454
00455 z__[16] = -b[js + js * b_dim1];
00456 z__[17] = -b[js + jsp1 * b_dim1];
00457 z__[18] = -e[js + js * e_dim1];
00458 z__[19] = -e[js + jsp1 * e_dim1];
00459
00460 z__[24] = -b[jsp1 + js * b_dim1];
00461 z__[25] = -b[jsp1 + jsp1 * b_dim1];
00462 z__[26] = 0.;
00463 z__[27] = -e[jsp1 + jsp1 * e_dim1];
00464
00465
00466
00467 rhs[0] = c__[is + js * c_dim1];
00468 rhs[1] = c__[is + jsp1 * c_dim1];
00469 rhs[2] = f[is + js * f_dim1];
00470 rhs[3] = f[is + jsp1 * f_dim1];
00471
00472
00473
00474 dgetc2_(&zdim, z__, &c__8, ipiv, jpiv, &ierr);
00475 if (ierr > 0) {
00476 *info = ierr;
00477 }
00478
00479 if (*ijob == 0) {
00480 dgesc2_(&zdim, z__, &c__8, rhs, ipiv, jpiv, &scaloc);
00481 if (scaloc != 1.) {
00482 i__2 = *n;
00483 for (k = 1; k <= i__2; ++k) {
00484 dscal_(m, &scaloc, &c__[k * c_dim1 + 1], &
00485 c__1);
00486 dscal_(m, &scaloc, &f[k * f_dim1 + 1], &c__1);
00487
00488 }
00489 *scale *= scaloc;
00490 }
00491 } else {
00492 dlatdf_(ijob, &zdim, z__, &c__8, rhs, rdsum, rdscal,
00493 ipiv, jpiv);
00494 }
00495
00496
00497
00498 c__[is + js * c_dim1] = rhs[0];
00499 c__[is + jsp1 * c_dim1] = rhs[1];
00500 f[is + js * f_dim1] = rhs[2];
00501 f[is + jsp1 * f_dim1] = rhs[3];
00502
00503
00504
00505
00506 if (i__ > 1) {
00507 i__2 = is - 1;
00508 dger_(&i__2, &nb, &c_b27, &a[is * a_dim1 + 1], &c__1,
00509 rhs, &c__1, &c__[js * c_dim1 + 1], ldc);
00510 i__2 = is - 1;
00511 dger_(&i__2, &nb, &c_b27, &d__[is * d_dim1 + 1], &
00512 c__1, rhs, &c__1, &f[js * f_dim1 + 1], ldf);
00513 }
00514 if (j < q) {
00515 i__2 = *n - je;
00516 daxpy_(&i__2, &rhs[2], &b[js + (je + 1) * b_dim1],
00517 ldb, &c__[is + (je + 1) * c_dim1], ldc);
00518 i__2 = *n - je;
00519 daxpy_(&i__2, &rhs[2], &e[js + (je + 1) * e_dim1],
00520 lde, &f[is + (je + 1) * f_dim1], ldf);
00521 i__2 = *n - je;
00522 daxpy_(&i__2, &rhs[3], &b[jsp1 + (je + 1) * b_dim1],
00523 ldb, &c__[is + (je + 1) * c_dim1], ldc);
00524 i__2 = *n - je;
00525 daxpy_(&i__2, &rhs[3], &e[jsp1 + (je + 1) * e_dim1],
00526 lde, &f[is + (je + 1) * f_dim1], ldf);
00527 }
00528
00529 } else if (mb == 2 && nb == 1) {
00530
00531
00532
00533 z__[0] = a[is + is * a_dim1];
00534 z__[1] = a[isp1 + is * a_dim1];
00535 z__[2] = d__[is + is * d_dim1];
00536 z__[3] = 0.;
00537
00538 z__[8] = a[is + isp1 * a_dim1];
00539 z__[9] = a[isp1 + isp1 * a_dim1];
00540 z__[10] = d__[is + isp1 * d_dim1];
00541 z__[11] = d__[isp1 + isp1 * d_dim1];
00542
00543 z__[16] = -b[js + js * b_dim1];
00544 z__[17] = 0.;
00545 z__[18] = -e[js + js * e_dim1];
00546 z__[19] = 0.;
00547
00548 z__[24] = 0.;
00549 z__[25] = -b[js + js * b_dim1];
00550 z__[26] = 0.;
00551 z__[27] = -e[js + js * e_dim1];
00552
00553
00554
00555 rhs[0] = c__[is + js * c_dim1];
00556 rhs[1] = c__[isp1 + js * c_dim1];
00557 rhs[2] = f[is + js * f_dim1];
00558 rhs[3] = f[isp1 + js * f_dim1];
00559
00560
00561
00562 dgetc2_(&zdim, z__, &c__8, ipiv, jpiv, &ierr);
00563 if (ierr > 0) {
00564 *info = ierr;
00565 }
00566 if (*ijob == 0) {
00567 dgesc2_(&zdim, z__, &c__8, rhs, ipiv, jpiv, &scaloc);
00568 if (scaloc != 1.) {
00569 i__2 = *n;
00570 for (k = 1; k <= i__2; ++k) {
00571 dscal_(m, &scaloc, &c__[k * c_dim1 + 1], &
00572 c__1);
00573 dscal_(m, &scaloc, &f[k * f_dim1 + 1], &c__1);
00574
00575 }
00576 *scale *= scaloc;
00577 }
00578 } else {
00579 dlatdf_(ijob, &zdim, z__, &c__8, rhs, rdsum, rdscal,
00580 ipiv, jpiv);
00581 }
00582
00583
00584
00585 c__[is + js * c_dim1] = rhs[0];
00586 c__[isp1 + js * c_dim1] = rhs[1];
00587 f[is + js * f_dim1] = rhs[2];
00588 f[isp1 + js * f_dim1] = rhs[3];
00589
00590
00591
00592
00593 if (i__ > 1) {
00594 i__2 = is - 1;
00595 dgemv_("N", &i__2, &mb, &c_b27, &a[is * a_dim1 + 1],
00596 lda, rhs, &c__1, &c_b42, &c__[js * c_dim1 + 1]
00597 , &c__1);
00598 i__2 = is - 1;
00599 dgemv_("N", &i__2, &mb, &c_b27, &d__[is * d_dim1 + 1],
00600 ldd, rhs, &c__1, &c_b42, &f[js * f_dim1 + 1],
00601 &c__1);
00602 }
00603 if (j < q) {
00604 i__2 = *n - je;
00605 dger_(&mb, &i__2, &c_b42, &rhs[2], &c__1, &b[js + (je
00606 + 1) * b_dim1], ldb, &c__[is + (je + 1) *
00607 c_dim1], ldc);
00608 i__2 = *n - je;
00609 dger_(&mb, &i__2, &c_b42, &rhs[2], &c__1, &e[js + (je
00610 + 1) * e_dim1], lde, &f[is + (je + 1) *
00611 f_dim1], ldf);
00612 }
00613
00614 } else if (mb == 2 && nb == 2) {
00615
00616
00617
00618 dlaset_("F", &c__8, &c__8, &c_b56, &c_b56, z__, &c__8);
00619
00620 z__[0] = a[is + is * a_dim1];
00621 z__[1] = a[isp1 + is * a_dim1];
00622 z__[4] = d__[is + is * d_dim1];
00623
00624 z__[8] = a[is + isp1 * a_dim1];
00625 z__[9] = a[isp1 + isp1 * a_dim1];
00626 z__[12] = d__[is + isp1 * d_dim1];
00627 z__[13] = d__[isp1 + isp1 * d_dim1];
00628
00629 z__[18] = a[is + is * a_dim1];
00630 z__[19] = a[isp1 + is * a_dim1];
00631 z__[22] = d__[is + is * d_dim1];
00632
00633 z__[26] = a[is + isp1 * a_dim1];
00634 z__[27] = a[isp1 + isp1 * a_dim1];
00635 z__[30] = d__[is + isp1 * d_dim1];
00636 z__[31] = d__[isp1 + isp1 * d_dim1];
00637
00638 z__[32] = -b[js + js * b_dim1];
00639 z__[34] = -b[js + jsp1 * b_dim1];
00640 z__[36] = -e[js + js * e_dim1];
00641 z__[38] = -e[js + jsp1 * e_dim1];
00642
00643 z__[41] = -b[js + js * b_dim1];
00644 z__[43] = -b[js + jsp1 * b_dim1];
00645 z__[45] = -e[js + js * e_dim1];
00646 z__[47] = -e[js + jsp1 * e_dim1];
00647
00648 z__[48] = -b[jsp1 + js * b_dim1];
00649 z__[50] = -b[jsp1 + jsp1 * b_dim1];
00650 z__[54] = -e[jsp1 + jsp1 * e_dim1];
00651
00652 z__[57] = -b[jsp1 + js * b_dim1];
00653 z__[59] = -b[jsp1 + jsp1 * b_dim1];
00654 z__[63] = -e[jsp1 + jsp1 * e_dim1];
00655
00656
00657
00658 k = 1;
00659 ii = mb * nb + 1;
00660 i__2 = nb - 1;
00661 for (jj = 0; jj <= i__2; ++jj) {
00662 dcopy_(&mb, &c__[is + (js + jj) * c_dim1], &c__1, &
00663 rhs[k - 1], &c__1);
00664 dcopy_(&mb, &f[is + (js + jj) * f_dim1], &c__1, &rhs[
00665 ii - 1], &c__1);
00666 k += mb;
00667 ii += mb;
00668
00669 }
00670
00671
00672
00673 dgetc2_(&zdim, z__, &c__8, ipiv, jpiv, &ierr);
00674 if (ierr > 0) {
00675 *info = ierr;
00676 }
00677 if (*ijob == 0) {
00678 dgesc2_(&zdim, z__, &c__8, rhs, ipiv, jpiv, &scaloc);
00679 if (scaloc != 1.) {
00680 i__2 = *n;
00681 for (k = 1; k <= i__2; ++k) {
00682 dscal_(m, &scaloc, &c__[k * c_dim1 + 1], &
00683 c__1);
00684 dscal_(m, &scaloc, &f[k * f_dim1 + 1], &c__1);
00685
00686 }
00687 *scale *= scaloc;
00688 }
00689 } else {
00690 dlatdf_(ijob, &zdim, z__, &c__8, rhs, rdsum, rdscal,
00691 ipiv, jpiv);
00692 }
00693
00694
00695
00696 k = 1;
00697 ii = mb * nb + 1;
00698 i__2 = nb - 1;
00699 for (jj = 0; jj <= i__2; ++jj) {
00700 dcopy_(&mb, &rhs[k - 1], &c__1, &c__[is + (js + jj) *
00701 c_dim1], &c__1);
00702 dcopy_(&mb, &rhs[ii - 1], &c__1, &f[is + (js + jj) *
00703 f_dim1], &c__1);
00704 k += mb;
00705 ii += mb;
00706
00707 }
00708
00709
00710
00711
00712 if (i__ > 1) {
00713 i__2 = is - 1;
00714 dgemm_("N", "N", &i__2, &nb, &mb, &c_b27, &a[is *
00715 a_dim1 + 1], lda, rhs, &mb, &c_b42, &c__[js *
00716 c_dim1 + 1], ldc);
00717 i__2 = is - 1;
00718 dgemm_("N", "N", &i__2, &nb, &mb, &c_b27, &d__[is *
00719 d_dim1 + 1], ldd, rhs, &mb, &c_b42, &f[js *
00720 f_dim1 + 1], ldf);
00721 }
00722 if (j < q) {
00723 k = mb * nb + 1;
00724 i__2 = *n - je;
00725 dgemm_("N", "N", &mb, &i__2, &nb, &c_b42, &rhs[k - 1],
00726 &mb, &b[js + (je + 1) * b_dim1], ldb, &c_b42,
00727 &c__[is + (je + 1) * c_dim1], ldc);
00728 i__2 = *n - je;
00729 dgemm_("N", "N", &mb, &i__2, &nb, &c_b42, &rhs[k - 1],
00730 &mb, &e[js + (je + 1) * e_dim1], lde, &c_b42,
00731 &f[is + (je + 1) * f_dim1], ldf);
00732 }
00733
00734 }
00735
00736
00737 }
00738
00739 }
00740 } else {
00741
00742
00743
00744
00745
00746
00747 *scale = 1.;
00748 scaloc = 1.;
00749 i__1 = p;
00750 for (i__ = 1; i__ <= i__1; ++i__) {
00751
00752 is = iwork[i__];
00753 isp1 = is + 1;
00754 ie = i__;
00755 mb = ie - is + 1;
00756 i__2 = p + 2;
00757 for (j = q; j >= i__2; --j) {
00758
00759 js = iwork[j];
00760 jsp1 = js + 1;
00761 je = iwork[j + 1] - 1;
00762 nb = je - js + 1;
00763 zdim = mb * nb << 1;
00764 if (mb == 1 && nb == 1) {
00765
00766
00767
00768 z__[0] = a[is + is * a_dim1];
00769 z__[1] = -b[js + js * b_dim1];
00770 z__[8] = d__[is + is * d_dim1];
00771 z__[9] = -e[js + js * e_dim1];
00772
00773
00774
00775 rhs[0] = c__[is + js * c_dim1];
00776 rhs[1] = f[is + js * f_dim1];
00777
00778
00779
00780 dgetc2_(&zdim, z__, &c__8, ipiv, jpiv, &ierr);
00781 if (ierr > 0) {
00782 *info = ierr;
00783 }
00784
00785 dgesc2_(&zdim, z__, &c__8, rhs, ipiv, jpiv, &scaloc);
00786 if (scaloc != 1.) {
00787 i__3 = *n;
00788 for (k = 1; k <= i__3; ++k) {
00789 dscal_(m, &scaloc, &c__[k * c_dim1 + 1], &c__1);
00790 dscal_(m, &scaloc, &f[k * f_dim1 + 1], &c__1);
00791
00792 }
00793 *scale *= scaloc;
00794 }
00795
00796
00797
00798 c__[is + js * c_dim1] = rhs[0];
00799 f[is + js * f_dim1] = rhs[1];
00800
00801
00802
00803
00804 if (j > p + 2) {
00805 alpha = rhs[0];
00806 i__3 = js - 1;
00807 daxpy_(&i__3, &alpha, &b[js * b_dim1 + 1], &c__1, &f[
00808 is + f_dim1], ldf);
00809 alpha = rhs[1];
00810 i__3 = js - 1;
00811 daxpy_(&i__3, &alpha, &e[js * e_dim1 + 1], &c__1, &f[
00812 is + f_dim1], ldf);
00813 }
00814 if (i__ < p) {
00815 alpha = -rhs[0];
00816 i__3 = *m - ie;
00817 daxpy_(&i__3, &alpha, &a[is + (ie + 1) * a_dim1], lda,
00818 &c__[ie + 1 + js * c_dim1], &c__1);
00819 alpha = -rhs[1];
00820 i__3 = *m - ie;
00821 daxpy_(&i__3, &alpha, &d__[is + (ie + 1) * d_dim1],
00822 ldd, &c__[ie + 1 + js * c_dim1], &c__1);
00823 }
00824
00825 } else if (mb == 1 && nb == 2) {
00826
00827
00828
00829 z__[0] = a[is + is * a_dim1];
00830 z__[1] = 0.;
00831 z__[2] = -b[js + js * b_dim1];
00832 z__[3] = -b[jsp1 + js * b_dim1];
00833
00834 z__[8] = 0.;
00835 z__[9] = a[is + is * a_dim1];
00836 z__[10] = -b[js + jsp1 * b_dim1];
00837 z__[11] = -b[jsp1 + jsp1 * b_dim1];
00838
00839 z__[16] = d__[is + is * d_dim1];
00840 z__[17] = 0.;
00841 z__[18] = -e[js + js * e_dim1];
00842 z__[19] = 0.;
00843
00844 z__[24] = 0.;
00845 z__[25] = d__[is + is * d_dim1];
00846 z__[26] = -e[js + jsp1 * e_dim1];
00847 z__[27] = -e[jsp1 + jsp1 * e_dim1];
00848
00849
00850
00851 rhs[0] = c__[is + js * c_dim1];
00852 rhs[1] = c__[is + jsp1 * c_dim1];
00853 rhs[2] = f[is + js * f_dim1];
00854 rhs[3] = f[is + jsp1 * f_dim1];
00855
00856
00857
00858 dgetc2_(&zdim, z__, &c__8, ipiv, jpiv, &ierr);
00859 if (ierr > 0) {
00860 *info = ierr;
00861 }
00862 dgesc2_(&zdim, z__, &c__8, rhs, ipiv, jpiv, &scaloc);
00863 if (scaloc != 1.) {
00864 i__3 = *n;
00865 for (k = 1; k <= i__3; ++k) {
00866 dscal_(m, &scaloc, &c__[k * c_dim1 + 1], &c__1);
00867 dscal_(m, &scaloc, &f[k * f_dim1 + 1], &c__1);
00868
00869 }
00870 *scale *= scaloc;
00871 }
00872
00873
00874
00875 c__[is + js * c_dim1] = rhs[0];
00876 c__[is + jsp1 * c_dim1] = rhs[1];
00877 f[is + js * f_dim1] = rhs[2];
00878 f[is + jsp1 * f_dim1] = rhs[3];
00879
00880
00881
00882
00883 if (j > p + 2) {
00884 i__3 = js - 1;
00885 daxpy_(&i__3, rhs, &b[js * b_dim1 + 1], &c__1, &f[is
00886 + f_dim1], ldf);
00887 i__3 = js - 1;
00888 daxpy_(&i__3, &rhs[1], &b[jsp1 * b_dim1 + 1], &c__1, &
00889 f[is + f_dim1], ldf);
00890 i__3 = js - 1;
00891 daxpy_(&i__3, &rhs[2], &e[js * e_dim1 + 1], &c__1, &f[
00892 is + f_dim1], ldf);
00893 i__3 = js - 1;
00894 daxpy_(&i__3, &rhs[3], &e[jsp1 * e_dim1 + 1], &c__1, &
00895 f[is + f_dim1], ldf);
00896 }
00897 if (i__ < p) {
00898 i__3 = *m - ie;
00899 dger_(&i__3, &nb, &c_b27, &a[is + (ie + 1) * a_dim1],
00900 lda, rhs, &c__1, &c__[ie + 1 + js * c_dim1],
00901 ldc);
00902 i__3 = *m - ie;
00903 dger_(&i__3, &nb, &c_b27, &d__[is + (ie + 1) * d_dim1]
00904 , ldd, &rhs[2], &c__1, &c__[ie + 1 + js *
00905 c_dim1], ldc);
00906 }
00907
00908 } else if (mb == 2 && nb == 1) {
00909
00910
00911
00912 z__[0] = a[is + is * a_dim1];
00913 z__[1] = a[is + isp1 * a_dim1];
00914 z__[2] = -b[js + js * b_dim1];
00915 z__[3] = 0.;
00916
00917 z__[8] = a[isp1 + is * a_dim1];
00918 z__[9] = a[isp1 + isp1 * a_dim1];
00919 z__[10] = 0.;
00920 z__[11] = -b[js + js * b_dim1];
00921
00922 z__[16] = d__[is + is * d_dim1];
00923 z__[17] = d__[is + isp1 * d_dim1];
00924 z__[18] = -e[js + js * e_dim1];
00925 z__[19] = 0.;
00926
00927 z__[24] = 0.;
00928 z__[25] = d__[isp1 + isp1 * d_dim1];
00929 z__[26] = 0.;
00930 z__[27] = -e[js + js * e_dim1];
00931
00932
00933
00934 rhs[0] = c__[is + js * c_dim1];
00935 rhs[1] = c__[isp1 + js * c_dim1];
00936 rhs[2] = f[is + js * f_dim1];
00937 rhs[3] = f[isp1 + js * f_dim1];
00938
00939
00940
00941 dgetc2_(&zdim, z__, &c__8, ipiv, jpiv, &ierr);
00942 if (ierr > 0) {
00943 *info = ierr;
00944 }
00945
00946 dgesc2_(&zdim, z__, &c__8, rhs, ipiv, jpiv, &scaloc);
00947 if (scaloc != 1.) {
00948 i__3 = *n;
00949 for (k = 1; k <= i__3; ++k) {
00950 dscal_(m, &scaloc, &c__[k * c_dim1 + 1], &c__1);
00951 dscal_(m, &scaloc, &f[k * f_dim1 + 1], &c__1);
00952
00953 }
00954 *scale *= scaloc;
00955 }
00956
00957
00958
00959 c__[is + js * c_dim1] = rhs[0];
00960 c__[isp1 + js * c_dim1] = rhs[1];
00961 f[is + js * f_dim1] = rhs[2];
00962 f[isp1 + js * f_dim1] = rhs[3];
00963
00964
00965
00966
00967 if (j > p + 2) {
00968 i__3 = js - 1;
00969 dger_(&mb, &i__3, &c_b42, rhs, &c__1, &b[js * b_dim1
00970 + 1], &c__1, &f[is + f_dim1], ldf);
00971 i__3 = js - 1;
00972 dger_(&mb, &i__3, &c_b42, &rhs[2], &c__1, &e[js *
00973 e_dim1 + 1], &c__1, &f[is + f_dim1], ldf);
00974 }
00975 if (i__ < p) {
00976 i__3 = *m - ie;
00977 dgemv_("T", &mb, &i__3, &c_b27, &a[is + (ie + 1) *
00978 a_dim1], lda, rhs, &c__1, &c_b42, &c__[ie + 1
00979 + js * c_dim1], &c__1);
00980 i__3 = *m - ie;
00981 dgemv_("T", &mb, &i__3, &c_b27, &d__[is + (ie + 1) *
00982 d_dim1], ldd, &rhs[2], &c__1, &c_b42, &c__[ie
00983 + 1 + js * c_dim1], &c__1);
00984 }
00985
00986 } else if (mb == 2 && nb == 2) {
00987
00988
00989
00990 dlaset_("F", &c__8, &c__8, &c_b56, &c_b56, z__, &c__8);
00991
00992 z__[0] = a[is + is * a_dim1];
00993 z__[1] = a[is + isp1 * a_dim1];
00994 z__[4] = -b[js + js * b_dim1];
00995 z__[6] = -b[jsp1 + js * b_dim1];
00996
00997 z__[8] = a[isp1 + is * a_dim1];
00998 z__[9] = a[isp1 + isp1 * a_dim1];
00999 z__[13] = -b[js + js * b_dim1];
01000 z__[15] = -b[jsp1 + js * b_dim1];
01001
01002 z__[18] = a[is + is * a_dim1];
01003 z__[19] = a[is + isp1 * a_dim1];
01004 z__[20] = -b[js + jsp1 * b_dim1];
01005 z__[22] = -b[jsp1 + jsp1 * b_dim1];
01006
01007 z__[26] = a[isp1 + is * a_dim1];
01008 z__[27] = a[isp1 + isp1 * a_dim1];
01009 z__[29] = -b[js + jsp1 * b_dim1];
01010 z__[31] = -b[jsp1 + jsp1 * b_dim1];
01011
01012 z__[32] = d__[is + is * d_dim1];
01013 z__[33] = d__[is + isp1 * d_dim1];
01014 z__[36] = -e[js + js * e_dim1];
01015
01016 z__[41] = d__[isp1 + isp1 * d_dim1];
01017 z__[45] = -e[js + js * e_dim1];
01018
01019 z__[50] = d__[is + is * d_dim1];
01020 z__[51] = d__[is + isp1 * d_dim1];
01021 z__[52] = -e[js + jsp1 * e_dim1];
01022 z__[54] = -e[jsp1 + jsp1 * e_dim1];
01023
01024 z__[59] = d__[isp1 + isp1 * d_dim1];
01025 z__[61] = -e[js + jsp1 * e_dim1];
01026 z__[63] = -e[jsp1 + jsp1 * e_dim1];
01027
01028
01029
01030 k = 1;
01031 ii = mb * nb + 1;
01032 i__3 = nb - 1;
01033 for (jj = 0; jj <= i__3; ++jj) {
01034 dcopy_(&mb, &c__[is + (js + jj) * c_dim1], &c__1, &
01035 rhs[k - 1], &c__1);
01036 dcopy_(&mb, &f[is + (js + jj) * f_dim1], &c__1, &rhs[
01037 ii - 1], &c__1);
01038 k += mb;
01039 ii += mb;
01040
01041 }
01042
01043
01044
01045
01046 dgetc2_(&zdim, z__, &c__8, ipiv, jpiv, &ierr);
01047 if (ierr > 0) {
01048 *info = ierr;
01049 }
01050
01051 dgesc2_(&zdim, z__, &c__8, rhs, ipiv, jpiv, &scaloc);
01052 if (scaloc != 1.) {
01053 i__3 = *n;
01054 for (k = 1; k <= i__3; ++k) {
01055 dscal_(m, &scaloc, &c__[k * c_dim1 + 1], &c__1);
01056 dscal_(m, &scaloc, &f[k * f_dim1 + 1], &c__1);
01057
01058 }
01059 *scale *= scaloc;
01060 }
01061
01062
01063
01064 k = 1;
01065 ii = mb * nb + 1;
01066 i__3 = nb - 1;
01067 for (jj = 0; jj <= i__3; ++jj) {
01068 dcopy_(&mb, &rhs[k - 1], &c__1, &c__[is + (js + jj) *
01069 c_dim1], &c__1);
01070 dcopy_(&mb, &rhs[ii - 1], &c__1, &f[is + (js + jj) *
01071 f_dim1], &c__1);
01072 k += mb;
01073 ii += mb;
01074
01075 }
01076
01077
01078
01079
01080 if (j > p + 2) {
01081 i__3 = js - 1;
01082 dgemm_("N", "T", &mb, &i__3, &nb, &c_b42, &c__[is +
01083 js * c_dim1], ldc, &b[js * b_dim1 + 1], ldb, &
01084 c_b42, &f[is + f_dim1], ldf);
01085 i__3 = js - 1;
01086 dgemm_("N", "T", &mb, &i__3, &nb, &c_b42, &f[is + js *
01087 f_dim1], ldf, &e[js * e_dim1 + 1], lde, &
01088 c_b42, &f[is + f_dim1], ldf);
01089 }
01090 if (i__ < p) {
01091 i__3 = *m - ie;
01092 dgemm_("T", "N", &i__3, &nb, &mb, &c_b27, &a[is + (ie
01093 + 1) * a_dim1], lda, &c__[is + js * c_dim1],
01094 ldc, &c_b42, &c__[ie + 1 + js * c_dim1], ldc);
01095 i__3 = *m - ie;
01096 dgemm_("T", "N", &i__3, &nb, &mb, &c_b27, &d__[is + (
01097 ie + 1) * d_dim1], ldd, &f[is + js * f_dim1],
01098 ldf, &c_b42, &c__[ie + 1 + js * c_dim1], ldc);
01099 }
01100
01101 }
01102
01103
01104 }
01105
01106 }
01107
01108 }
01109 return 0;
01110
01111
01112
01113 }