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 integer c__2 = 2;
00020
00021 int zlahqr_(logical *wantt, logical *wantz, integer *n,
00022 integer *ilo, integer *ihi, doublecomplex *h__, integer *ldh,
00023 doublecomplex *w, integer *iloz, integer *ihiz, doublecomplex *z__,
00024 integer *ldz, integer *info)
00025 {
00026
00027 integer h_dim1, h_offset, z_dim1, z_offset, i__1, i__2, i__3, i__4;
00028 doublereal d__1, d__2, d__3, d__4, d__5, d__6;
00029 doublecomplex z__1, z__2, z__3, z__4, z__5, z__6, z__7;
00030
00031
00032 double d_imag(doublecomplex *);
00033 void d_cnjg(doublecomplex *, doublecomplex *);
00034 double z_abs(doublecomplex *);
00035 void z_sqrt(doublecomplex *, doublecomplex *), pow_zi(doublecomplex *,
00036 doublecomplex *, integer *);
00037
00038
00039 integer i__, j, k, l, m;
00040 doublereal s;
00041 doublecomplex t, u, v[2], x, y;
00042 integer i1, i2;
00043 doublecomplex t1;
00044 doublereal t2;
00045 doublecomplex v2;
00046 doublereal aa, ab, ba, bb, h10;
00047 doublecomplex h11;
00048 doublereal h21;
00049 doublecomplex h22, sc;
00050 integer nh, nz;
00051 doublereal sx;
00052 integer jhi;
00053 doublecomplex h11s;
00054 integer jlo, its;
00055 doublereal ulp;
00056 doublecomplex sum;
00057 doublereal tst;
00058 doublecomplex temp;
00059 extern int zscal_(integer *, doublecomplex *,
00060 doublecomplex *, integer *);
00061 doublereal rtemp;
00062 extern int zcopy_(integer *, doublecomplex *, integer *,
00063 doublecomplex *, integer *), dlabad_(doublereal *, doublereal *);
00064 extern doublereal dlamch_(char *);
00065 doublereal safmin, safmax;
00066 extern int zlarfg_(integer *, doublecomplex *,
00067 doublecomplex *, integer *, doublecomplex *);
00068 extern VOID zladiv_(doublecomplex *, doublecomplex *,
00069 doublecomplex *);
00070 doublereal smlnum;
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 h_dim1 = *ldh;
00206 h_offset = 1 + h_dim1;
00207 h__ -= h_offset;
00208 --w;
00209 z_dim1 = *ldz;
00210 z_offset = 1 + z_dim1;
00211 z__ -= z_offset;
00212
00213
00214 *info = 0;
00215
00216
00217
00218 if (*n == 0) {
00219 return 0;
00220 }
00221 if (*ilo == *ihi) {
00222 i__1 = *ilo;
00223 i__2 = *ilo + *ilo * h_dim1;
00224 w[i__1].r = h__[i__2].r, w[i__1].i = h__[i__2].i;
00225 return 0;
00226 }
00227
00228
00229 i__1 = *ihi - 3;
00230 for (j = *ilo; j <= i__1; ++j) {
00231 i__2 = j + 2 + j * h_dim1;
00232 h__[i__2].r = 0., h__[i__2].i = 0.;
00233 i__2 = j + 3 + j * h_dim1;
00234 h__[i__2].r = 0., h__[i__2].i = 0.;
00235
00236 }
00237 if (*ilo <= *ihi - 2) {
00238 i__1 = *ihi + (*ihi - 2) * h_dim1;
00239 h__[i__1].r = 0., h__[i__1].i = 0.;
00240 }
00241
00242 if (*wantt) {
00243 jlo = 1;
00244 jhi = *n;
00245 } else {
00246 jlo = *ilo;
00247 jhi = *ihi;
00248 }
00249 i__1 = *ihi;
00250 for (i__ = *ilo + 1; i__ <= i__1; ++i__) {
00251 if (d_imag(&h__[i__ + (i__ - 1) * h_dim1]) != 0.) {
00252
00253
00254
00255 i__2 = i__ + (i__ - 1) * h_dim1;
00256 i__3 = i__ + (i__ - 1) * h_dim1;
00257 d__3 = (d__1 = h__[i__3].r, abs(d__1)) + (d__2 = d_imag(&h__[i__
00258 + (i__ - 1) * h_dim1]), abs(d__2));
00259 z__1.r = h__[i__2].r / d__3, z__1.i = h__[i__2].i / d__3;
00260 sc.r = z__1.r, sc.i = z__1.i;
00261 d_cnjg(&z__2, &sc);
00262 d__1 = z_abs(&sc);
00263 z__1.r = z__2.r / d__1, z__1.i = z__2.i / d__1;
00264 sc.r = z__1.r, sc.i = z__1.i;
00265 i__2 = i__ + (i__ - 1) * h_dim1;
00266 d__1 = z_abs(&h__[i__ + (i__ - 1) * h_dim1]);
00267 h__[i__2].r = d__1, h__[i__2].i = 0.;
00268 i__2 = jhi - i__ + 1;
00269 zscal_(&i__2, &sc, &h__[i__ + i__ * h_dim1], ldh);
00270
00271 i__3 = jhi, i__4 = i__ + 1;
00272 i__2 = min(i__3,i__4) - jlo + 1;
00273 d_cnjg(&z__1, &sc);
00274 zscal_(&i__2, &z__1, &h__[jlo + i__ * h_dim1], &c__1);
00275 if (*wantz) {
00276 i__2 = *ihiz - *iloz + 1;
00277 d_cnjg(&z__1, &sc);
00278 zscal_(&i__2, &z__1, &z__[*iloz + i__ * z_dim1], &c__1);
00279 }
00280 }
00281
00282 }
00283
00284 nh = *ihi - *ilo + 1;
00285 nz = *ihiz - *iloz + 1;
00286
00287
00288
00289 safmin = dlamch_("SAFE MINIMUM");
00290 safmax = 1. / safmin;
00291 dlabad_(&safmin, &safmax);
00292 ulp = dlamch_("PRECISION");
00293 smlnum = safmin * ((doublereal) nh / ulp);
00294
00295
00296
00297
00298
00299 if (*wantt) {
00300 i1 = 1;
00301 i2 = *n;
00302 }
00303
00304
00305
00306
00307
00308
00309
00310 i__ = *ihi;
00311 L30:
00312 if (i__ < *ilo) {
00313 goto L150;
00314 }
00315
00316
00317
00318
00319
00320 l = *ilo;
00321 for (its = 0; its <= 30; ++its) {
00322
00323
00324
00325 i__1 = l + 1;
00326 for (k = i__; k >= i__1; --k) {
00327 i__2 = k + (k - 1) * h_dim1;
00328 if ((d__1 = h__[i__2].r, abs(d__1)) + (d__2 = d_imag(&h__[k + (k
00329 - 1) * h_dim1]), abs(d__2)) <= smlnum) {
00330 goto L50;
00331 }
00332 i__2 = k - 1 + (k - 1) * h_dim1;
00333 i__3 = k + k * h_dim1;
00334 tst = (d__1 = h__[i__2].r, abs(d__1)) + (d__2 = d_imag(&h__[k - 1
00335 + (k - 1) * h_dim1]), abs(d__2)) + ((d__3 = h__[i__3].r,
00336 abs(d__3)) + (d__4 = d_imag(&h__[k + k * h_dim1]), abs(
00337 d__4)));
00338 if (tst == 0.) {
00339 if (k - 2 >= *ilo) {
00340 i__2 = k - 1 + (k - 2) * h_dim1;
00341 tst += (d__1 = h__[i__2].r, abs(d__1));
00342 }
00343 if (k + 1 <= *ihi) {
00344 i__2 = k + 1 + k * h_dim1;
00345 tst += (d__1 = h__[i__2].r, abs(d__1));
00346 }
00347 }
00348
00349
00350
00351
00352 i__2 = k + (k - 1) * h_dim1;
00353 if ((d__1 = h__[i__2].r, abs(d__1)) <= ulp * tst) {
00354
00355 i__2 = k + (k - 1) * h_dim1;
00356 i__3 = k - 1 + k * h_dim1;
00357 d__5 = (d__1 = h__[i__2].r, abs(d__1)) + (d__2 = d_imag(&h__[
00358 k + (k - 1) * h_dim1]), abs(d__2)), d__6 = (d__3 =
00359 h__[i__3].r, abs(d__3)) + (d__4 = d_imag(&h__[k - 1 +
00360 k * h_dim1]), abs(d__4));
00361 ab = max(d__5,d__6);
00362
00363 i__2 = k + (k - 1) * h_dim1;
00364 i__3 = k - 1 + k * h_dim1;
00365 d__5 = (d__1 = h__[i__2].r, abs(d__1)) + (d__2 = d_imag(&h__[
00366 k + (k - 1) * h_dim1]), abs(d__2)), d__6 = (d__3 =
00367 h__[i__3].r, abs(d__3)) + (d__4 = d_imag(&h__[k - 1 +
00368 k * h_dim1]), abs(d__4));
00369 ba = min(d__5,d__6);
00370 i__2 = k - 1 + (k - 1) * h_dim1;
00371 i__3 = k + k * h_dim1;
00372 z__2.r = h__[i__2].r - h__[i__3].r, z__2.i = h__[i__2].i -
00373 h__[i__3].i;
00374 z__1.r = z__2.r, z__1.i = z__2.i;
00375
00376 i__4 = k + k * h_dim1;
00377 d__5 = (d__1 = h__[i__4].r, abs(d__1)) + (d__2 = d_imag(&h__[
00378 k + k * h_dim1]), abs(d__2)), d__6 = (d__3 = z__1.r,
00379 abs(d__3)) + (d__4 = d_imag(&z__1), abs(d__4));
00380 aa = max(d__5,d__6);
00381 i__2 = k - 1 + (k - 1) * h_dim1;
00382 i__3 = k + k * h_dim1;
00383 z__2.r = h__[i__2].r - h__[i__3].r, z__2.i = h__[i__2].i -
00384 h__[i__3].i;
00385 z__1.r = z__2.r, z__1.i = z__2.i;
00386
00387 i__4 = k + k * h_dim1;
00388 d__5 = (d__1 = h__[i__4].r, abs(d__1)) + (d__2 = d_imag(&h__[
00389 k + k * h_dim1]), abs(d__2)), d__6 = (d__3 = z__1.r,
00390 abs(d__3)) + (d__4 = d_imag(&z__1), abs(d__4));
00391 bb = min(d__5,d__6);
00392 s = aa + ab;
00393
00394 d__1 = smlnum, d__2 = ulp * (bb * (aa / s));
00395 if (ba * (ab / s) <= max(d__1,d__2)) {
00396 goto L50;
00397 }
00398 }
00399
00400 }
00401 L50:
00402 l = k;
00403 if (l > *ilo) {
00404
00405
00406
00407 i__1 = l + (l - 1) * h_dim1;
00408 h__[i__1].r = 0., h__[i__1].i = 0.;
00409 }
00410
00411
00412
00413 if (l >= i__) {
00414 goto L140;
00415 }
00416
00417
00418
00419
00420
00421 if (! (*wantt)) {
00422 i1 = l;
00423 i2 = i__;
00424 }
00425
00426 if (its == 10) {
00427
00428
00429
00430 i__1 = l + 1 + l * h_dim1;
00431 s = (d__1 = h__[i__1].r, abs(d__1)) * .75;
00432 i__1 = l + l * h_dim1;
00433 z__1.r = s + h__[i__1].r, z__1.i = h__[i__1].i;
00434 t.r = z__1.r, t.i = z__1.i;
00435 } else if (its == 20) {
00436
00437
00438
00439 i__1 = i__ + (i__ - 1) * h_dim1;
00440 s = (d__1 = h__[i__1].r, abs(d__1)) * .75;
00441 i__1 = i__ + i__ * h_dim1;
00442 z__1.r = s + h__[i__1].r, z__1.i = h__[i__1].i;
00443 t.r = z__1.r, t.i = z__1.i;
00444 } else {
00445
00446
00447
00448 i__1 = i__ + i__ * h_dim1;
00449 t.r = h__[i__1].r, t.i = h__[i__1].i;
00450 z_sqrt(&z__2, &h__[i__ - 1 + i__ * h_dim1]);
00451 z_sqrt(&z__3, &h__[i__ + (i__ - 1) * h_dim1]);
00452 z__1.r = z__2.r * z__3.r - z__2.i * z__3.i, z__1.i = z__2.r *
00453 z__3.i + z__2.i * z__3.r;
00454 u.r = z__1.r, u.i = z__1.i;
00455 s = (d__1 = u.r, abs(d__1)) + (d__2 = d_imag(&u), abs(d__2));
00456 if (s != 0.) {
00457 i__1 = i__ - 1 + (i__ - 1) * h_dim1;
00458 z__2.r = h__[i__1].r - t.r, z__2.i = h__[i__1].i - t.i;
00459 z__1.r = z__2.r * .5, z__1.i = z__2.i * .5;
00460 x.r = z__1.r, x.i = z__1.i;
00461 sx = (d__1 = x.r, abs(d__1)) + (d__2 = d_imag(&x), abs(d__2));
00462
00463 d__3 = s, d__4 = (d__1 = x.r, abs(d__1)) + (d__2 = d_imag(&x),
00464 abs(d__2));
00465 s = max(d__3,d__4);
00466 z__5.r = x.r / s, z__5.i = x.i / s;
00467 pow_zi(&z__4, &z__5, &c__2);
00468 z__7.r = u.r / s, z__7.i = u.i / s;
00469 pow_zi(&z__6, &z__7, &c__2);
00470 z__3.r = z__4.r + z__6.r, z__3.i = z__4.i + z__6.i;
00471 z_sqrt(&z__2, &z__3);
00472 z__1.r = s * z__2.r, z__1.i = s * z__2.i;
00473 y.r = z__1.r, y.i = z__1.i;
00474 if (sx > 0.) {
00475 z__1.r = x.r / sx, z__1.i = x.i / sx;
00476 z__2.r = x.r / sx, z__2.i = x.i / sx;
00477 if (z__1.r * y.r + d_imag(&z__2) * d_imag(&y) < 0.) {
00478 z__3.r = -y.r, z__3.i = -y.i;
00479 y.r = z__3.r, y.i = z__3.i;
00480 }
00481 }
00482 z__4.r = x.r + y.r, z__4.i = x.i + y.i;
00483 zladiv_(&z__3, &u, &z__4);
00484 z__2.r = u.r * z__3.r - u.i * z__3.i, z__2.i = u.r * z__3.i +
00485 u.i * z__3.r;
00486 z__1.r = t.r - z__2.r, z__1.i = t.i - z__2.i;
00487 t.r = z__1.r, t.i = z__1.i;
00488 }
00489 }
00490
00491
00492
00493 i__1 = l + 1;
00494 for (m = i__ - 1; m >= i__1; --m) {
00495
00496
00497
00498
00499
00500 i__2 = m + m * h_dim1;
00501 h11.r = h__[i__2].r, h11.i = h__[i__2].i;
00502 i__2 = m + 1 + (m + 1) * h_dim1;
00503 h22.r = h__[i__2].r, h22.i = h__[i__2].i;
00504 z__1.r = h11.r - t.r, z__1.i = h11.i - t.i;
00505 h11s.r = z__1.r, h11s.i = z__1.i;
00506 i__2 = m + 1 + m * h_dim1;
00507 h21 = h__[i__2].r;
00508 s = (d__1 = h11s.r, abs(d__1)) + (d__2 = d_imag(&h11s), abs(d__2))
00509 + abs(h21);
00510 z__1.r = h11s.r / s, z__1.i = h11s.i / s;
00511 h11s.r = z__1.r, h11s.i = z__1.i;
00512 h21 /= s;
00513 v[0].r = h11s.r, v[0].i = h11s.i;
00514 v[1].r = h21, v[1].i = 0.;
00515 i__2 = m + (m - 1) * h_dim1;
00516 h10 = h__[i__2].r;
00517 if (abs(h10) * abs(h21) <= ulp * (((d__1 = h11s.r, abs(d__1)) + (
00518 d__2 = d_imag(&h11s), abs(d__2))) * ((d__3 = h11.r, abs(
00519 d__3)) + (d__4 = d_imag(&h11), abs(d__4)) + ((d__5 =
00520 h22.r, abs(d__5)) + (d__6 = d_imag(&h22), abs(d__6)))))) {
00521 goto L70;
00522 }
00523
00524 }
00525 i__1 = l + l * h_dim1;
00526 h11.r = h__[i__1].r, h11.i = h__[i__1].i;
00527 i__1 = l + 1 + (l + 1) * h_dim1;
00528 h22.r = h__[i__1].r, h22.i = h__[i__1].i;
00529 z__1.r = h11.r - t.r, z__1.i = h11.i - t.i;
00530 h11s.r = z__1.r, h11s.i = z__1.i;
00531 i__1 = l + 1 + l * h_dim1;
00532 h21 = h__[i__1].r;
00533 s = (d__1 = h11s.r, abs(d__1)) + (d__2 = d_imag(&h11s), abs(d__2)) +
00534 abs(h21);
00535 z__1.r = h11s.r / s, z__1.i = h11s.i / s;
00536 h11s.r = z__1.r, h11s.i = z__1.i;
00537 h21 /= s;
00538 v[0].r = h11s.r, v[0].i = h11s.i;
00539 v[1].r = h21, v[1].i = 0.;
00540 L70:
00541
00542
00543
00544 i__1 = i__ - 1;
00545 for (k = m; k <= i__1; ++k) {
00546
00547
00548
00549
00550
00551
00552
00553
00554
00555
00556
00557
00558
00559 if (k > m) {
00560 zcopy_(&c__2, &h__[k + (k - 1) * h_dim1], &c__1, v, &c__1);
00561 }
00562 zlarfg_(&c__2, v, &v[1], &c__1, &t1);
00563 if (k > m) {
00564 i__2 = k + (k - 1) * h_dim1;
00565 h__[i__2].r = v[0].r, h__[i__2].i = v[0].i;
00566 i__2 = k + 1 + (k - 1) * h_dim1;
00567 h__[i__2].r = 0., h__[i__2].i = 0.;
00568 }
00569 v2.r = v[1].r, v2.i = v[1].i;
00570 z__1.r = t1.r * v2.r - t1.i * v2.i, z__1.i = t1.r * v2.i + t1.i *
00571 v2.r;
00572 t2 = z__1.r;
00573
00574
00575
00576
00577 i__2 = i2;
00578 for (j = k; j <= i__2; ++j) {
00579 d_cnjg(&z__3, &t1);
00580 i__3 = k + j * h_dim1;
00581 z__2.r = z__3.r * h__[i__3].r - z__3.i * h__[i__3].i, z__2.i =
00582 z__3.r * h__[i__3].i + z__3.i * h__[i__3].r;
00583 i__4 = k + 1 + j * h_dim1;
00584 z__4.r = t2 * h__[i__4].r, z__4.i = t2 * h__[i__4].i;
00585 z__1.r = z__2.r + z__4.r, z__1.i = z__2.i + z__4.i;
00586 sum.r = z__1.r, sum.i = z__1.i;
00587 i__3 = k + j * h_dim1;
00588 i__4 = k + j * h_dim1;
00589 z__1.r = h__[i__4].r - sum.r, z__1.i = h__[i__4].i - sum.i;
00590 h__[i__3].r = z__1.r, h__[i__3].i = z__1.i;
00591 i__3 = k + 1 + j * h_dim1;
00592 i__4 = k + 1 + j * h_dim1;
00593 z__2.r = sum.r * v2.r - sum.i * v2.i, z__2.i = sum.r * v2.i +
00594 sum.i * v2.r;
00595 z__1.r = h__[i__4].r - z__2.r, z__1.i = h__[i__4].i - z__2.i;
00596 h__[i__3].r = z__1.r, h__[i__3].i = z__1.i;
00597
00598 }
00599
00600
00601
00602
00603
00604 i__3 = k + 2;
00605 i__2 = min(i__3,i__);
00606 for (j = i1; j <= i__2; ++j) {
00607 i__3 = j + k * h_dim1;
00608 z__2.r = t1.r * h__[i__3].r - t1.i * h__[i__3].i, z__2.i =
00609 t1.r * h__[i__3].i + t1.i * h__[i__3].r;
00610 i__4 = j + (k + 1) * h_dim1;
00611 z__3.r = t2 * h__[i__4].r, z__3.i = t2 * h__[i__4].i;
00612 z__1.r = z__2.r + z__3.r, z__1.i = z__2.i + z__3.i;
00613 sum.r = z__1.r, sum.i = z__1.i;
00614 i__3 = j + k * h_dim1;
00615 i__4 = j + k * h_dim1;
00616 z__1.r = h__[i__4].r - sum.r, z__1.i = h__[i__4].i - sum.i;
00617 h__[i__3].r = z__1.r, h__[i__3].i = z__1.i;
00618 i__3 = j + (k + 1) * h_dim1;
00619 i__4 = j + (k + 1) * h_dim1;
00620 d_cnjg(&z__3, &v2);
00621 z__2.r = sum.r * z__3.r - sum.i * z__3.i, z__2.i = sum.r *
00622 z__3.i + sum.i * z__3.r;
00623 z__1.r = h__[i__4].r - z__2.r, z__1.i = h__[i__4].i - z__2.i;
00624 h__[i__3].r = z__1.r, h__[i__3].i = z__1.i;
00625
00626 }
00627
00628 if (*wantz) {
00629
00630
00631
00632 i__2 = *ihiz;
00633 for (j = *iloz; j <= i__2; ++j) {
00634 i__3 = j + k * z_dim1;
00635 z__2.r = t1.r * z__[i__3].r - t1.i * z__[i__3].i, z__2.i =
00636 t1.r * z__[i__3].i + t1.i * z__[i__3].r;
00637 i__4 = j + (k + 1) * z_dim1;
00638 z__3.r = t2 * z__[i__4].r, z__3.i = t2 * z__[i__4].i;
00639 z__1.r = z__2.r + z__3.r, z__1.i = z__2.i + z__3.i;
00640 sum.r = z__1.r, sum.i = z__1.i;
00641 i__3 = j + k * z_dim1;
00642 i__4 = j + k * z_dim1;
00643 z__1.r = z__[i__4].r - sum.r, z__1.i = z__[i__4].i -
00644 sum.i;
00645 z__[i__3].r = z__1.r, z__[i__3].i = z__1.i;
00646 i__3 = j + (k + 1) * z_dim1;
00647 i__4 = j + (k + 1) * z_dim1;
00648 d_cnjg(&z__3, &v2);
00649 z__2.r = sum.r * z__3.r - sum.i * z__3.i, z__2.i = sum.r *
00650 z__3.i + sum.i * z__3.r;
00651 z__1.r = z__[i__4].r - z__2.r, z__1.i = z__[i__4].i -
00652 z__2.i;
00653 z__[i__3].r = z__1.r, z__[i__3].i = z__1.i;
00654
00655 }
00656 }
00657
00658 if (k == m && m > l) {
00659
00660
00661
00662
00663
00664
00665 z__1.r = 1. - t1.r, z__1.i = 0. - t1.i;
00666 temp.r = z__1.r, temp.i = z__1.i;
00667 d__1 = z_abs(&temp);
00668 z__1.r = temp.r / d__1, z__1.i = temp.i / d__1;
00669 temp.r = z__1.r, temp.i = z__1.i;
00670 i__2 = m + 1 + m * h_dim1;
00671 i__3 = m + 1 + m * h_dim1;
00672 d_cnjg(&z__2, &temp);
00673 z__1.r = h__[i__3].r * z__2.r - h__[i__3].i * z__2.i, z__1.i =
00674 h__[i__3].r * z__2.i + h__[i__3].i * z__2.r;
00675 h__[i__2].r = z__1.r, h__[i__2].i = z__1.i;
00676 if (m + 2 <= i__) {
00677 i__2 = m + 2 + (m + 1) * h_dim1;
00678 i__3 = m + 2 + (m + 1) * h_dim1;
00679 z__1.r = h__[i__3].r * temp.r - h__[i__3].i * temp.i,
00680 z__1.i = h__[i__3].r * temp.i + h__[i__3].i *
00681 temp.r;
00682 h__[i__2].r = z__1.r, h__[i__2].i = z__1.i;
00683 }
00684 i__2 = i__;
00685 for (j = m; j <= i__2; ++j) {
00686 if (j != m + 1) {
00687 if (i2 > j) {
00688 i__3 = i2 - j;
00689 zscal_(&i__3, &temp, &h__[j + (j + 1) * h_dim1],
00690 ldh);
00691 }
00692 i__3 = j - i1;
00693 d_cnjg(&z__1, &temp);
00694 zscal_(&i__3, &z__1, &h__[i1 + j * h_dim1], &c__1);
00695 if (*wantz) {
00696 d_cnjg(&z__1, &temp);
00697 zscal_(&nz, &z__1, &z__[*iloz + j * z_dim1], &
00698 c__1);
00699 }
00700 }
00701
00702 }
00703 }
00704
00705 }
00706
00707
00708
00709 i__1 = i__ + (i__ - 1) * h_dim1;
00710 temp.r = h__[i__1].r, temp.i = h__[i__1].i;
00711 if (d_imag(&temp) != 0.) {
00712 rtemp = z_abs(&temp);
00713 i__1 = i__ + (i__ - 1) * h_dim1;
00714 h__[i__1].r = rtemp, h__[i__1].i = 0.;
00715 z__1.r = temp.r / rtemp, z__1.i = temp.i / rtemp;
00716 temp.r = z__1.r, temp.i = z__1.i;
00717 if (i2 > i__) {
00718 i__1 = i2 - i__;
00719 d_cnjg(&z__1, &temp);
00720 zscal_(&i__1, &z__1, &h__[i__ + (i__ + 1) * h_dim1], ldh);
00721 }
00722 i__1 = i__ - i1;
00723 zscal_(&i__1, &temp, &h__[i1 + i__ * h_dim1], &c__1);
00724 if (*wantz) {
00725 zscal_(&nz, &temp, &z__[*iloz + i__ * z_dim1], &c__1);
00726 }
00727 }
00728
00729
00730 }
00731
00732
00733
00734 *info = i__;
00735 return 0;
00736
00737 L140:
00738
00739
00740
00741 i__1 = i__;
00742 i__2 = i__ + i__ * h_dim1;
00743 w[i__1].r = h__[i__2].r, w[i__1].i = h__[i__2].i;
00744
00745
00746
00747 i__ = l - 1;
00748 goto L30;
00749
00750 L150:
00751 return 0;
00752
00753
00754
00755 }