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 doublereal c_b7 = 0.;
00019 static doublereal c_b8 = 1.;
00020 static integer c__3 = 3;
00021 static integer c__1 = 1;
00022 static integer c__2 = 2;
00023
00024 int dlaqr5_(logical *wantt, logical *wantz, integer *kacc22,
00025 integer *n, integer *ktop, integer *kbot, integer *nshfts, doublereal
00026 *sr, doublereal *si, doublereal *h__, integer *ldh, integer *iloz,
00027 integer *ihiz, doublereal *z__, integer *ldz, doublereal *v, integer *
00028 ldv, doublereal *u, integer *ldu, integer *nv, doublereal *wv,
00029 integer *ldwv, integer *nh, doublereal *wh, integer *ldwh)
00030 {
00031
00032 integer h_dim1, h_offset, u_dim1, u_offset, v_dim1, v_offset, wh_dim1,
00033 wh_offset, wv_dim1, wv_offset, z_dim1, z_offset, i__1, i__2, i__3,
00034 i__4, i__5, i__6, i__7;
00035 doublereal d__1, d__2, d__3, d__4, d__5;
00036
00037
00038 integer i__, j, k, m, i2, j2, i4, j4, k1;
00039 doublereal h11, h12, h21, h22;
00040 integer m22, ns, nu;
00041 doublereal vt[3], scl;
00042 integer kdu, kms;
00043 doublereal ulp;
00044 integer knz, kzs;
00045 doublereal tst1, tst2, beta;
00046 logical blk22, bmp22;
00047 integer mend, jcol, jlen, jbot, mbot;
00048 doublereal swap;
00049 integer jtop, jrow, mtop;
00050 doublereal alpha;
00051 logical accum;
00052 extern int dgemm_(char *, char *, integer *, integer *,
00053 integer *, doublereal *, doublereal *, integer *, doublereal *,
00054 integer *, doublereal *, doublereal *, integer *);
00055 integer ndcol, incol, krcol, nbmps;
00056 extern int dtrmm_(char *, char *, char *, char *,
00057 integer *, integer *, doublereal *, doublereal *, integer *,
00058 doublereal *, integer *), dlaqr1_(
00059 integer *, doublereal *, integer *, doublereal *, doublereal *,
00060 doublereal *, doublereal *, doublereal *), dlabad_(doublereal *,
00061 doublereal *);
00062 extern doublereal dlamch_(char *);
00063 extern int dlarfg_(integer *, doublereal *, doublereal *,
00064 integer *, doublereal *), dlacpy_(char *, integer *, integer *,
00065 doublereal *, integer *, doublereal *, integer *);
00066 doublereal safmin;
00067 extern int dlaset_(char *, integer *, integer *,
00068 doublereal *, doublereal *, doublereal *, integer *);
00069 doublereal safmax, refsum;
00070 integer mstart;
00071 doublereal smlnum;
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 --sr;
00223 --si;
00224 h_dim1 = *ldh;
00225 h_offset = 1 + h_dim1;
00226 h__ -= h_offset;
00227 z_dim1 = *ldz;
00228 z_offset = 1 + z_dim1;
00229 z__ -= z_offset;
00230 v_dim1 = *ldv;
00231 v_offset = 1 + v_dim1;
00232 v -= v_offset;
00233 u_dim1 = *ldu;
00234 u_offset = 1 + u_dim1;
00235 u -= u_offset;
00236 wv_dim1 = *ldwv;
00237 wv_offset = 1 + wv_dim1;
00238 wv -= wv_offset;
00239 wh_dim1 = *ldwh;
00240 wh_offset = 1 + wh_dim1;
00241 wh -= wh_offset;
00242
00243
00244 if (*nshfts < 2) {
00245 return 0;
00246 }
00247
00248
00249
00250
00251 if (*ktop >= *kbot) {
00252 return 0;
00253 }
00254
00255
00256
00257
00258
00259
00260 i__1 = *nshfts - 2;
00261 for (i__ = 1; i__ <= i__1; i__ += 2) {
00262 if (si[i__] != -si[i__ + 1]) {
00263
00264 swap = sr[i__];
00265 sr[i__] = sr[i__ + 1];
00266 sr[i__ + 1] = sr[i__ + 2];
00267 sr[i__ + 2] = swap;
00268
00269 swap = si[i__];
00270 si[i__] = si[i__ + 1];
00271 si[i__ + 1] = si[i__ + 2];
00272 si[i__ + 2] = swap;
00273 }
00274
00275 }
00276
00277
00278
00279
00280
00281
00282 ns = *nshfts - *nshfts % 2;
00283
00284
00285
00286 safmin = dlamch_("SAFE MINIMUM");
00287 safmax = 1. / safmin;
00288 dlabad_(&safmin, &safmax);
00289 ulp = dlamch_("PRECISION");
00290 smlnum = safmin * ((doublereal) (*n) / ulp);
00291
00292
00293
00294
00295 accum = *kacc22 == 1 || *kacc22 == 2;
00296
00297
00298
00299 blk22 = ns > 2 && *kacc22 == 2;
00300
00301
00302
00303 if (*ktop + 2 <= *kbot) {
00304 h__[*ktop + 2 + *ktop * h_dim1] = 0.;
00305 }
00306
00307
00308
00309 nbmps = ns / 2;
00310
00311
00312
00313 kdu = nbmps * 6 - 3;
00314
00315
00316
00317 i__1 = *kbot - 2;
00318 i__2 = nbmps * 3 - 2;
00319 for (incol = (1 - nbmps) * 3 + *ktop - 1; i__2 < 0 ? incol >= i__1 :
00320 incol <= i__1; incol += i__2) {
00321 ndcol = incol + kdu;
00322 if (accum) {
00323 dlaset_("ALL", &kdu, &kdu, &c_b7, &c_b8, &u[u_offset], ldu);
00324 }
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339 i__4 = incol + nbmps * 3 - 3, i__5 = *kbot - 2;
00340 i__3 = min(i__4,i__5);
00341 for (krcol = incol; krcol <= i__3; ++krcol) {
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351 i__4 = 1, i__5 = (*ktop - 1 - krcol + 2) / 3 + 1;
00352 mtop = max(i__4,i__5);
00353
00354 i__4 = nbmps, i__5 = (*kbot - krcol) / 3;
00355 mbot = min(i__4,i__5);
00356 m22 = mbot + 1;
00357 bmp22 = mbot < nbmps && krcol + (m22 - 1) * 3 == *kbot - 2;
00358
00359
00360
00361
00362 i__4 = mbot;
00363 for (m = mtop; m <= i__4; ++m) {
00364 k = krcol + (m - 1) * 3;
00365 if (k == *ktop - 1) {
00366 dlaqr1_(&c__3, &h__[*ktop + *ktop * h_dim1], ldh, &sr[(m
00367 << 1) - 1], &si[(m << 1) - 1], &sr[m * 2], &si[m *
00368 2], &v[m * v_dim1 + 1]);
00369 alpha = v[m * v_dim1 + 1];
00370 dlarfg_(&c__3, &alpha, &v[m * v_dim1 + 2], &c__1, &v[m *
00371 v_dim1 + 1]);
00372 } else {
00373 beta = h__[k + 1 + k * h_dim1];
00374 v[m * v_dim1 + 2] = h__[k + 2 + k * h_dim1];
00375 v[m * v_dim1 + 3] = h__[k + 3 + k * h_dim1];
00376 dlarfg_(&c__3, &beta, &v[m * v_dim1 + 2], &c__1, &v[m *
00377 v_dim1 + 1]);
00378
00379
00380
00381
00382
00383
00384 if (h__[k + 3 + k * h_dim1] != 0. || h__[k + 3 + (k + 1) *
00385 h_dim1] != 0. || h__[k + 3 + (k + 2) * h_dim1] ==
00386 0.) {
00387
00388
00389
00390 h__[k + 1 + k * h_dim1] = beta;
00391 h__[k + 2 + k * h_dim1] = 0.;
00392 h__[k + 3 + k * h_dim1] = 0.;
00393 } else {
00394
00395
00396
00397
00398
00399
00400
00401 dlaqr1_(&c__3, &h__[k + 1 + (k + 1) * h_dim1], ldh, &
00402 sr[(m << 1) - 1], &si[(m << 1) - 1], &sr[m *
00403 2], &si[m * 2], vt);
00404 alpha = vt[0];
00405 dlarfg_(&c__3, &alpha, &vt[1], &c__1, vt);
00406 refsum = vt[0] * (h__[k + 1 + k * h_dim1] + vt[1] *
00407 h__[k + 2 + k * h_dim1]);
00408
00409 if ((d__1 = h__[k + 2 + k * h_dim1] - refsum * vt[1],
00410 abs(d__1)) + (d__2 = refsum * vt[2], abs(d__2)
00411 ) > ulp * ((d__3 = h__[k + k * h_dim1], abs(
00412 d__3)) + (d__4 = h__[k + 1 + (k + 1) * h_dim1]
00413 , abs(d__4)) + (d__5 = h__[k + 2 + (k + 2) *
00414 h_dim1], abs(d__5)))) {
00415
00416
00417
00418
00419
00420 h__[k + 1 + k * h_dim1] = beta;
00421 h__[k + 2 + k * h_dim1] = 0.;
00422 h__[k + 3 + k * h_dim1] = 0.;
00423 } else {
00424
00425
00426
00427
00428
00429
00430 h__[k + 1 + k * h_dim1] -= refsum;
00431 h__[k + 2 + k * h_dim1] = 0.;
00432 h__[k + 3 + k * h_dim1] = 0.;
00433 v[m * v_dim1 + 1] = vt[0];
00434 v[m * v_dim1 + 2] = vt[1];
00435 v[m * v_dim1 + 3] = vt[2];
00436 }
00437 }
00438 }
00439
00440 }
00441
00442
00443
00444 k = krcol + (m22 - 1) * 3;
00445 if (bmp22) {
00446 if (k == *ktop - 1) {
00447 dlaqr1_(&c__2, &h__[k + 1 + (k + 1) * h_dim1], ldh, &sr[(
00448 m22 << 1) - 1], &si[(m22 << 1) - 1], &sr[m22 * 2],
00449 &si[m22 * 2], &v[m22 * v_dim1 + 1]);
00450 beta = v[m22 * v_dim1 + 1];
00451 dlarfg_(&c__2, &beta, &v[m22 * v_dim1 + 2], &c__1, &v[m22
00452 * v_dim1 + 1]);
00453 } else {
00454 beta = h__[k + 1 + k * h_dim1];
00455 v[m22 * v_dim1 + 2] = h__[k + 2 + k * h_dim1];
00456 dlarfg_(&c__2, &beta, &v[m22 * v_dim1 + 2], &c__1, &v[m22
00457 * v_dim1 + 1]);
00458 h__[k + 1 + k * h_dim1] = beta;
00459 h__[k + 2 + k * h_dim1] = 0.;
00460 }
00461 }
00462
00463
00464
00465 if (accum) {
00466 jbot = min(ndcol,*kbot);
00467 } else if (*wantt) {
00468 jbot = *n;
00469 } else {
00470 jbot = *kbot;
00471 }
00472 i__4 = jbot;
00473 for (j = max(*ktop,krcol); j <= i__4; ++j) {
00474
00475 i__5 = mbot, i__6 = (j - krcol + 2) / 3;
00476 mend = min(i__5,i__6);
00477 i__5 = mend;
00478 for (m = mtop; m <= i__5; ++m) {
00479 k = krcol + (m - 1) * 3;
00480 refsum = v[m * v_dim1 + 1] * (h__[k + 1 + j * h_dim1] + v[
00481 m * v_dim1 + 2] * h__[k + 2 + j * h_dim1] + v[m *
00482 v_dim1 + 3] * h__[k + 3 + j * h_dim1]);
00483 h__[k + 1 + j * h_dim1] -= refsum;
00484 h__[k + 2 + j * h_dim1] -= refsum * v[m * v_dim1 + 2];
00485 h__[k + 3 + j * h_dim1] -= refsum * v[m * v_dim1 + 3];
00486
00487 }
00488
00489 }
00490 if (bmp22) {
00491 k = krcol + (m22 - 1) * 3;
00492
00493 i__4 = k + 1;
00494 i__5 = jbot;
00495 for (j = max(i__4,*ktop); j <= i__5; ++j) {
00496 refsum = v[m22 * v_dim1 + 1] * (h__[k + 1 + j * h_dim1] +
00497 v[m22 * v_dim1 + 2] * h__[k + 2 + j * h_dim1]);
00498 h__[k + 1 + j * h_dim1] -= refsum;
00499 h__[k + 2 + j * h_dim1] -= refsum * v[m22 * v_dim1 + 2];
00500
00501 }
00502 }
00503
00504
00505
00506
00507
00508 if (accum) {
00509 jtop = max(*ktop,incol);
00510 } else if (*wantt) {
00511 jtop = 1;
00512 } else {
00513 jtop = *ktop;
00514 }
00515 i__5 = mbot;
00516 for (m = mtop; m <= i__5; ++m) {
00517 if (v[m * v_dim1 + 1] != 0.) {
00518 k = krcol + (m - 1) * 3;
00519
00520 i__6 = *kbot, i__7 = k + 3;
00521 i__4 = min(i__6,i__7);
00522 for (j = jtop; j <= i__4; ++j) {
00523 refsum = v[m * v_dim1 + 1] * (h__[j + (k + 1) *
00524 h_dim1] + v[m * v_dim1 + 2] * h__[j + (k + 2)
00525 * h_dim1] + v[m * v_dim1 + 3] * h__[j + (k +
00526 3) * h_dim1]);
00527 h__[j + (k + 1) * h_dim1] -= refsum;
00528 h__[j + (k + 2) * h_dim1] -= refsum * v[m * v_dim1 +
00529 2];
00530 h__[j + (k + 3) * h_dim1] -= refsum * v[m * v_dim1 +
00531 3];
00532
00533 }
00534
00535 if (accum) {
00536
00537
00538
00539
00540
00541 kms = k - incol;
00542
00543 i__4 = 1, i__6 = *ktop - incol;
00544 i__7 = kdu;
00545 for (j = max(i__4,i__6); j <= i__7; ++j) {
00546 refsum = v[m * v_dim1 + 1] * (u[j + (kms + 1) *
00547 u_dim1] + v[m * v_dim1 + 2] * u[j + (kms
00548 + 2) * u_dim1] + v[m * v_dim1 + 3] * u[j
00549 + (kms + 3) * u_dim1]);
00550 u[j + (kms + 1) * u_dim1] -= refsum;
00551 u[j + (kms + 2) * u_dim1] -= refsum * v[m *
00552 v_dim1 + 2];
00553 u[j + (kms + 3) * u_dim1] -= refsum * v[m *
00554 v_dim1 + 3];
00555
00556 }
00557 } else if (*wantz) {
00558
00559
00560
00561
00562
00563 i__7 = *ihiz;
00564 for (j = *iloz; j <= i__7; ++j) {
00565 refsum = v[m * v_dim1 + 1] * (z__[j + (k + 1) *
00566 z_dim1] + v[m * v_dim1 + 2] * z__[j + (k
00567 + 2) * z_dim1] + v[m * v_dim1 + 3] * z__[
00568 j + (k + 3) * z_dim1]);
00569 z__[j + (k + 1) * z_dim1] -= refsum;
00570 z__[j + (k + 2) * z_dim1] -= refsum * v[m *
00571 v_dim1 + 2];
00572 z__[j + (k + 3) * z_dim1] -= refsum * v[m *
00573 v_dim1 + 3];
00574
00575 }
00576 }
00577 }
00578
00579 }
00580
00581
00582
00583 k = krcol + (m22 - 1) * 3;
00584 if (bmp22 && v[m22 * v_dim1 + 1] != 0.) {
00585
00586 i__7 = *kbot, i__4 = k + 3;
00587 i__5 = min(i__7,i__4);
00588 for (j = jtop; j <= i__5; ++j) {
00589 refsum = v[m22 * v_dim1 + 1] * (h__[j + (k + 1) * h_dim1]
00590 + v[m22 * v_dim1 + 2] * h__[j + (k + 2) * h_dim1])
00591 ;
00592 h__[j + (k + 1) * h_dim1] -= refsum;
00593 h__[j + (k + 2) * h_dim1] -= refsum * v[m22 * v_dim1 + 2];
00594
00595 }
00596
00597 if (accum) {
00598 kms = k - incol;
00599
00600 i__5 = 1, i__7 = *ktop - incol;
00601 i__4 = kdu;
00602 for (j = max(i__5,i__7); j <= i__4; ++j) {
00603 refsum = v[m22 * v_dim1 + 1] * (u[j + (kms + 1) *
00604 u_dim1] + v[m22 * v_dim1 + 2] * u[j + (kms +
00605 2) * u_dim1]);
00606 u[j + (kms + 1) * u_dim1] -= refsum;
00607 u[j + (kms + 2) * u_dim1] -= refsum * v[m22 * v_dim1
00608 + 2];
00609
00610 }
00611 } else if (*wantz) {
00612 i__4 = *ihiz;
00613 for (j = *iloz; j <= i__4; ++j) {
00614 refsum = v[m22 * v_dim1 + 1] * (z__[j + (k + 1) *
00615 z_dim1] + v[m22 * v_dim1 + 2] * z__[j + (k +
00616 2) * z_dim1]);
00617 z__[j + (k + 1) * z_dim1] -= refsum;
00618 z__[j + (k + 2) * z_dim1] -= refsum * v[m22 * v_dim1
00619 + 2];
00620
00621 }
00622 }
00623 }
00624
00625
00626
00627 mstart = mtop;
00628 if (krcol + (mstart - 1) * 3 < *ktop) {
00629 ++mstart;
00630 }
00631 mend = mbot;
00632 if (bmp22) {
00633 ++mend;
00634 }
00635 if (krcol == *kbot - 2) {
00636 ++mend;
00637 }
00638 i__4 = mend;
00639 for (m = mstart; m <= i__4; ++m) {
00640
00641 i__5 = *kbot - 1, i__7 = krcol + (m - 1) * 3;
00642 k = min(i__5,i__7);
00643
00644
00645
00646
00647
00648
00649
00650
00651
00652
00653 if (h__[k + 1 + k * h_dim1] != 0.) {
00654 tst1 = (d__1 = h__[k + k * h_dim1], abs(d__1)) + (d__2 =
00655 h__[k + 1 + (k + 1) * h_dim1], abs(d__2));
00656 if (tst1 == 0.) {
00657 if (k >= *ktop + 1) {
00658 tst1 += (d__1 = h__[k + (k - 1) * h_dim1], abs(
00659 d__1));
00660 }
00661 if (k >= *ktop + 2) {
00662 tst1 += (d__1 = h__[k + (k - 2) * h_dim1], abs(
00663 d__1));
00664 }
00665 if (k >= *ktop + 3) {
00666 tst1 += (d__1 = h__[k + (k - 3) * h_dim1], abs(
00667 d__1));
00668 }
00669 if (k <= *kbot - 2) {
00670 tst1 += (d__1 = h__[k + 2 + (k + 1) * h_dim1],
00671 abs(d__1));
00672 }
00673 if (k <= *kbot - 3) {
00674 tst1 += (d__1 = h__[k + 3 + (k + 1) * h_dim1],
00675 abs(d__1));
00676 }
00677 if (k <= *kbot - 4) {
00678 tst1 += (d__1 = h__[k + 4 + (k + 1) * h_dim1],
00679 abs(d__1));
00680 }
00681 }
00682
00683 d__2 = smlnum, d__3 = ulp * tst1;
00684 if ((d__1 = h__[k + 1 + k * h_dim1], abs(d__1)) <= max(
00685 d__2,d__3)) {
00686
00687 d__3 = (d__1 = h__[k + 1 + k * h_dim1], abs(d__1)),
00688 d__4 = (d__2 = h__[k + (k + 1) * h_dim1], abs(
00689 d__2));
00690 h12 = max(d__3,d__4);
00691
00692 d__3 = (d__1 = h__[k + 1 + k * h_dim1], abs(d__1)),
00693 d__4 = (d__2 = h__[k + (k + 1) * h_dim1], abs(
00694 d__2));
00695 h21 = min(d__3,d__4);
00696
00697 d__3 = (d__1 = h__[k + 1 + (k + 1) * h_dim1], abs(
00698 d__1)), d__4 = (d__2 = h__[k + k * h_dim1] -
00699 h__[k + 1 + (k + 1) * h_dim1], abs(d__2));
00700 h11 = max(d__3,d__4);
00701
00702 d__3 = (d__1 = h__[k + 1 + (k + 1) * h_dim1], abs(
00703 d__1)), d__4 = (d__2 = h__[k + k * h_dim1] -
00704 h__[k + 1 + (k + 1) * h_dim1], abs(d__2));
00705 h22 = min(d__3,d__4);
00706 scl = h11 + h12;
00707 tst2 = h22 * (h11 / scl);
00708
00709
00710 d__1 = smlnum, d__2 = ulp * tst2;
00711 if (tst2 == 0. || h21 * (h12 / scl) <= max(d__1,d__2))
00712 {
00713 h__[k + 1 + k * h_dim1] = 0.;
00714 }
00715 }
00716 }
00717
00718 }
00719
00720
00721
00722
00723 i__4 = nbmps, i__5 = (*kbot - krcol - 1) / 3;
00724 mend = min(i__4,i__5);
00725 i__4 = mend;
00726 for (m = mtop; m <= i__4; ++m) {
00727 k = krcol + (m - 1) * 3;
00728 refsum = v[m * v_dim1 + 1] * v[m * v_dim1 + 3] * h__[k + 4 + (
00729 k + 3) * h_dim1];
00730 h__[k + 4 + (k + 1) * h_dim1] = -refsum;
00731 h__[k + 4 + (k + 2) * h_dim1] = -refsum * v[m * v_dim1 + 2];
00732 h__[k + 4 + (k + 3) * h_dim1] -= refsum * v[m * v_dim1 + 3];
00733
00734 }
00735
00736
00737
00738
00739 }
00740
00741
00742
00743
00744
00745 if (accum) {
00746 if (*wantt) {
00747 jtop = 1;
00748 jbot = *n;
00749 } else {
00750 jtop = *ktop;
00751 jbot = *kbot;
00752 }
00753 if (! blk22 || incol < *ktop || ndcol > *kbot || ns <= 2) {
00754
00755
00756
00757
00758
00759
00760
00761
00762
00763
00764
00765 i__3 = 1, i__4 = *ktop - incol;
00766 k1 = max(i__3,i__4);
00767
00768 i__3 = 0, i__4 = ndcol - *kbot;
00769 nu = kdu - max(i__3,i__4) - k1 + 1;
00770
00771
00772
00773 i__3 = jbot;
00774 i__4 = *nh;
00775 for (jcol = min(ndcol,*kbot) + 1; i__4 < 0 ? jcol >= i__3 :
00776 jcol <= i__3; jcol += i__4) {
00777
00778 i__5 = *nh, i__7 = jbot - jcol + 1;
00779 jlen = min(i__5,i__7);
00780 dgemm_("C", "N", &nu, &jlen, &nu, &c_b8, &u[k1 + k1 *
00781 u_dim1], ldu, &h__[incol + k1 + jcol * h_dim1],
00782 ldh, &c_b7, &wh[wh_offset], ldwh);
00783 dlacpy_("ALL", &nu, &jlen, &wh[wh_offset], ldwh, &h__[
00784 incol + k1 + jcol * h_dim1], ldh);
00785
00786 }
00787
00788
00789
00790 i__4 = max(*ktop,incol) - 1;
00791 i__3 = *nv;
00792 for (jrow = jtop; i__3 < 0 ? jrow >= i__4 : jrow <= i__4;
00793 jrow += i__3) {
00794
00795 i__5 = *nv, i__7 = max(*ktop,incol) - jrow;
00796 jlen = min(i__5,i__7);
00797 dgemm_("N", "N", &jlen, &nu, &nu, &c_b8, &h__[jrow + (
00798 incol + k1) * h_dim1], ldh, &u[k1 + k1 * u_dim1],
00799 ldu, &c_b7, &wv[wv_offset], ldwv);
00800 dlacpy_("ALL", &jlen, &nu, &wv[wv_offset], ldwv, &h__[
00801 jrow + (incol + k1) * h_dim1], ldh);
00802
00803 }
00804
00805
00806
00807 if (*wantz) {
00808 i__3 = *ihiz;
00809 i__4 = *nv;
00810 for (jrow = *iloz; i__4 < 0 ? jrow >= i__3 : jrow <= i__3;
00811 jrow += i__4) {
00812
00813 i__5 = *nv, i__7 = *ihiz - jrow + 1;
00814 jlen = min(i__5,i__7);
00815 dgemm_("N", "N", &jlen, &nu, &nu, &c_b8, &z__[jrow + (
00816 incol + k1) * z_dim1], ldz, &u[k1 + k1 *
00817 u_dim1], ldu, &c_b7, &wv[wv_offset], ldwv);
00818 dlacpy_("ALL", &jlen, &nu, &wv[wv_offset], ldwv, &z__[
00819 jrow + (incol + k1) * z_dim1], ldz)
00820 ;
00821
00822 }
00823 }
00824 } else {
00825
00826
00827
00828
00829
00830 i2 = (kdu + 1) / 2;
00831 i4 = kdu;
00832 j2 = i4 - i2;
00833 j4 = kdu;
00834
00835
00836
00837
00838
00839 kzs = j4 - j2 - (ns + 1);
00840 knz = ns + 1;
00841
00842
00843
00844 i__4 = jbot;
00845 i__3 = *nh;
00846 for (jcol = min(ndcol,*kbot) + 1; i__3 < 0 ? jcol >= i__4 :
00847 jcol <= i__4; jcol += i__3) {
00848
00849 i__5 = *nh, i__7 = jbot - jcol + 1;
00850 jlen = min(i__5,i__7);
00851
00852
00853
00854
00855 dlacpy_("ALL", &knz, &jlen, &h__[incol + 1 + j2 + jcol *
00856 h_dim1], ldh, &wh[kzs + 1 + wh_dim1], ldwh);
00857
00858
00859
00860 dlaset_("ALL", &kzs, &jlen, &c_b7, &c_b7, &wh[wh_offset],
00861 ldwh);
00862 dtrmm_("L", "U", "C", "N", &knz, &jlen, &c_b8, &u[j2 + 1
00863 + (kzs + 1) * u_dim1], ldu, &wh[kzs + 1 + wh_dim1]
00864 , ldwh);
00865
00866
00867
00868 dgemm_("C", "N", &i2, &jlen, &j2, &c_b8, &u[u_offset],
00869 ldu, &h__[incol + 1 + jcol * h_dim1], ldh, &c_b8,
00870 &wh[wh_offset], ldwh);
00871
00872
00873
00874 dlacpy_("ALL", &j2, &jlen, &h__[incol + 1 + jcol * h_dim1]
00875 , ldh, &wh[i2 + 1 + wh_dim1], ldwh);
00876
00877
00878
00879 dtrmm_("L", "L", "C", "N", &j2, &jlen, &c_b8, &u[(i2 + 1)
00880 * u_dim1 + 1], ldu, &wh[i2 + 1 + wh_dim1], ldwh);
00881
00882
00883
00884 i__5 = i4 - i2;
00885 i__7 = j4 - j2;
00886 dgemm_("C", "N", &i__5, &jlen, &i__7, &c_b8, &u[j2 + 1 + (
00887 i2 + 1) * u_dim1], ldu, &h__[incol + 1 + j2 +
00888 jcol * h_dim1], ldh, &c_b8, &wh[i2 + 1 + wh_dim1],
00889 ldwh);
00890
00891
00892
00893 dlacpy_("ALL", &kdu, &jlen, &wh[wh_offset], ldwh, &h__[
00894 incol + 1 + jcol * h_dim1], ldh);
00895
00896 }
00897
00898
00899
00900 i__3 = max(incol,*ktop) - 1;
00901 i__4 = *nv;
00902 for (jrow = jtop; i__4 < 0 ? jrow >= i__3 : jrow <= i__3;
00903 jrow += i__4) {
00904
00905 i__5 = *nv, i__7 = max(incol,*ktop) - jrow;
00906 jlen = min(i__5,i__7);
00907
00908
00909
00910
00911 dlacpy_("ALL", &jlen, &knz, &h__[jrow + (incol + 1 + j2) *
00912 h_dim1], ldh, &wv[(kzs + 1) * wv_dim1 + 1], ldwv);
00913
00914
00915
00916 dlaset_("ALL", &jlen, &kzs, &c_b7, &c_b7, &wv[wv_offset],
00917 ldwv);
00918 dtrmm_("R", "U", "N", "N", &jlen, &knz, &c_b8, &u[j2 + 1
00919 + (kzs + 1) * u_dim1], ldu, &wv[(kzs + 1) *
00920 wv_dim1 + 1], ldwv);
00921
00922
00923
00924 dgemm_("N", "N", &jlen, &i2, &j2, &c_b8, &h__[jrow + (
00925 incol + 1) * h_dim1], ldh, &u[u_offset], ldu, &
00926 c_b8, &wv[wv_offset], ldwv);
00927
00928
00929
00930 dlacpy_("ALL", &jlen, &j2, &h__[jrow + (incol + 1) *
00931 h_dim1], ldh, &wv[(i2 + 1) * wv_dim1 + 1], ldwv);
00932
00933
00934
00935 i__5 = i4 - i2;
00936 dtrmm_("R", "L", "N", "N", &jlen, &i__5, &c_b8, &u[(i2 +
00937 1) * u_dim1 + 1], ldu, &wv[(i2 + 1) * wv_dim1 + 1]
00938 , ldwv);
00939
00940
00941
00942 i__5 = i4 - i2;
00943 i__7 = j4 - j2;
00944 dgemm_("N", "N", &jlen, &i__5, &i__7, &c_b8, &h__[jrow + (
00945 incol + 1 + j2) * h_dim1], ldh, &u[j2 + 1 + (i2 +
00946 1) * u_dim1], ldu, &c_b8, &wv[(i2 + 1) * wv_dim1
00947 + 1], ldwv);
00948
00949
00950
00951 dlacpy_("ALL", &jlen, &kdu, &wv[wv_offset], ldwv, &h__[
00952 jrow + (incol + 1) * h_dim1], ldh);
00953
00954 }
00955
00956
00957
00958 if (*wantz) {
00959 i__4 = *ihiz;
00960 i__3 = *nv;
00961 for (jrow = *iloz; i__3 < 0 ? jrow >= i__4 : jrow <= i__4;
00962 jrow += i__3) {
00963
00964 i__5 = *nv, i__7 = *ihiz - jrow + 1;
00965 jlen = min(i__5,i__7);
00966
00967
00968
00969
00970 dlacpy_("ALL", &jlen, &knz, &z__[jrow + (incol + 1 +
00971 j2) * z_dim1], ldz, &wv[(kzs + 1) * wv_dim1 +
00972 1], ldwv);
00973
00974
00975
00976 dlaset_("ALL", &jlen, &kzs, &c_b7, &c_b7, &wv[
00977 wv_offset], ldwv);
00978 dtrmm_("R", "U", "N", "N", &jlen, &knz, &c_b8, &u[j2
00979 + 1 + (kzs + 1) * u_dim1], ldu, &wv[(kzs + 1)
00980 * wv_dim1 + 1], ldwv);
00981
00982
00983
00984 dgemm_("N", "N", &jlen, &i2, &j2, &c_b8, &z__[jrow + (
00985 incol + 1) * z_dim1], ldz, &u[u_offset], ldu,
00986 &c_b8, &wv[wv_offset], ldwv);
00987
00988
00989
00990 dlacpy_("ALL", &jlen, &j2, &z__[jrow + (incol + 1) *
00991 z_dim1], ldz, &wv[(i2 + 1) * wv_dim1 + 1],
00992 ldwv);
00993
00994
00995
00996 i__5 = i4 - i2;
00997 dtrmm_("R", "L", "N", "N", &jlen, &i__5, &c_b8, &u[(
00998 i2 + 1) * u_dim1 + 1], ldu, &wv[(i2 + 1) *
00999 wv_dim1 + 1], ldwv);
01000
01001
01002
01003 i__5 = i4 - i2;
01004 i__7 = j4 - j2;
01005 dgemm_("N", "N", &jlen, &i__5, &i__7, &c_b8, &z__[
01006 jrow + (incol + 1 + j2) * z_dim1], ldz, &u[j2
01007 + 1 + (i2 + 1) * u_dim1], ldu, &c_b8, &wv[(i2
01008 + 1) * wv_dim1 + 1], ldwv);
01009
01010
01011
01012 dlacpy_("ALL", &jlen, &kdu, &wv[wv_offset], ldwv, &
01013 z__[jrow + (incol + 1) * z_dim1], ldz);
01014
01015 }
01016 }
01017 }
01018 }
01019
01020 }
01021
01022
01023
01024 return 0;
01025 }