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 doublecomplex c_b1 = {1.,0.};
00019 static integer c__1 = 1;
00020
00021 int zlahef_(char *uplo, integer *n, integer *nb, integer *kb,
00022 doublecomplex *a, integer *lda, integer *ipiv, doublecomplex *w,
00023 integer *ldw, integer *info)
00024 {
00025
00026 integer a_dim1, a_offset, w_dim1, w_offset, i__1, i__2, i__3, i__4, i__5;
00027 doublereal d__1, d__2, d__3, d__4;
00028 doublecomplex z__1, z__2, z__3, z__4;
00029
00030
00031 double sqrt(doublereal), d_imag(doublecomplex *);
00032 void d_cnjg(doublecomplex *, doublecomplex *), z_div(doublecomplex *,
00033 doublecomplex *, doublecomplex *);
00034
00035
00036 integer j, k;
00037 doublereal t, r1;
00038 doublecomplex d11, d21, d22;
00039 integer jb, jj, kk, jp, kp, kw, kkw, imax, jmax;
00040 doublereal alpha;
00041 extern logical lsame_(char *, char *);
00042 extern int zgemm_(char *, char *, integer *, integer *,
00043 integer *, doublecomplex *, doublecomplex *, integer *,
00044 doublecomplex *, integer *, doublecomplex *, doublecomplex *,
00045 integer *);
00046 integer kstep;
00047 extern int zgemv_(char *, integer *, integer *,
00048 doublecomplex *, doublecomplex *, integer *, doublecomplex *,
00049 integer *, doublecomplex *, doublecomplex *, integer *),
00050 zcopy_(integer *, doublecomplex *, integer *, doublecomplex *,
00051 integer *), zswap_(integer *, doublecomplex *, integer *,
00052 doublecomplex *, integer *);
00053 doublereal absakk;
00054 extern int zdscal_(integer *, doublereal *,
00055 doublecomplex *, integer *);
00056 doublereal colmax;
00057 extern int zlacgv_(integer *, doublecomplex *, integer *)
00058 ;
00059 extern integer izamax_(integer *, doublecomplex *, integer *);
00060 doublereal rowmax;
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
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 a_dim1 = *lda;
00171 a_offset = 1 + a_dim1;
00172 a -= a_offset;
00173 --ipiv;
00174 w_dim1 = *ldw;
00175 w_offset = 1 + w_dim1;
00176 w -= w_offset;
00177
00178
00179 *info = 0;
00180
00181
00182
00183 alpha = (sqrt(17.) + 1.) / 8.;
00184
00185 if (lsame_(uplo, "U")) {
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195 k = *n;
00196 L10:
00197 kw = *nb + k - *n;
00198
00199
00200
00201 if (k <= *n - *nb + 1 && *nb < *n || k < 1) {
00202 goto L30;
00203 }
00204
00205
00206
00207 i__1 = k - 1;
00208 zcopy_(&i__1, &a[k * a_dim1 + 1], &c__1, &w[kw * w_dim1 + 1], &c__1);
00209 i__1 = k + kw * w_dim1;
00210 i__2 = k + k * a_dim1;
00211 d__1 = a[i__2].r;
00212 w[i__1].r = d__1, w[i__1].i = 0.;
00213 if (k < *n) {
00214 i__1 = *n - k;
00215 z__1.r = -1., z__1.i = -0.;
00216 zgemv_("No transpose", &k, &i__1, &z__1, &a[(k + 1) * a_dim1 + 1],
00217 lda, &w[k + (kw + 1) * w_dim1], ldw, &c_b1, &w[kw *
00218 w_dim1 + 1], &c__1);
00219 i__1 = k + kw * w_dim1;
00220 i__2 = k + kw * w_dim1;
00221 d__1 = w[i__2].r;
00222 w[i__1].r = d__1, w[i__1].i = 0.;
00223 }
00224
00225 kstep = 1;
00226
00227
00228
00229
00230 i__1 = k + kw * w_dim1;
00231 absakk = (d__1 = w[i__1].r, abs(d__1));
00232
00233
00234
00235
00236 if (k > 1) {
00237 i__1 = k - 1;
00238 imax = izamax_(&i__1, &w[kw * w_dim1 + 1], &c__1);
00239 i__1 = imax + kw * w_dim1;
00240 colmax = (d__1 = w[i__1].r, abs(d__1)) + (d__2 = d_imag(&w[imax +
00241 kw * w_dim1]), abs(d__2));
00242 } else {
00243 colmax = 0.;
00244 }
00245
00246 if (max(absakk,colmax) == 0.) {
00247
00248
00249
00250 if (*info == 0) {
00251 *info = k;
00252 }
00253 kp = k;
00254 i__1 = k + k * a_dim1;
00255 i__2 = k + k * a_dim1;
00256 d__1 = a[i__2].r;
00257 a[i__1].r = d__1, a[i__1].i = 0.;
00258 } else {
00259 if (absakk >= alpha * colmax) {
00260
00261
00262
00263 kp = k;
00264 } else {
00265
00266
00267
00268 i__1 = imax - 1;
00269 zcopy_(&i__1, &a[imax * a_dim1 + 1], &c__1, &w[(kw - 1) *
00270 w_dim1 + 1], &c__1);
00271 i__1 = imax + (kw - 1) * w_dim1;
00272 i__2 = imax + imax * a_dim1;
00273 d__1 = a[i__2].r;
00274 w[i__1].r = d__1, w[i__1].i = 0.;
00275 i__1 = k - imax;
00276 zcopy_(&i__1, &a[imax + (imax + 1) * a_dim1], lda, &w[imax +
00277 1 + (kw - 1) * w_dim1], &c__1);
00278 i__1 = k - imax;
00279 zlacgv_(&i__1, &w[imax + 1 + (kw - 1) * w_dim1], &c__1);
00280 if (k < *n) {
00281 i__1 = *n - k;
00282 z__1.r = -1., z__1.i = -0.;
00283 zgemv_("No transpose", &k, &i__1, &z__1, &a[(k + 1) *
00284 a_dim1 + 1], lda, &w[imax + (kw + 1) * w_dim1],
00285 ldw, &c_b1, &w[(kw - 1) * w_dim1 + 1], &c__1);
00286 i__1 = imax + (kw - 1) * w_dim1;
00287 i__2 = imax + (kw - 1) * w_dim1;
00288 d__1 = w[i__2].r;
00289 w[i__1].r = d__1, w[i__1].i = 0.;
00290 }
00291
00292
00293
00294
00295 i__1 = k - imax;
00296 jmax = imax + izamax_(&i__1, &w[imax + 1 + (kw - 1) * w_dim1],
00297 &c__1);
00298 i__1 = jmax + (kw - 1) * w_dim1;
00299 rowmax = (d__1 = w[i__1].r, abs(d__1)) + (d__2 = d_imag(&w[
00300 jmax + (kw - 1) * w_dim1]), abs(d__2));
00301 if (imax > 1) {
00302 i__1 = imax - 1;
00303 jmax = izamax_(&i__1, &w[(kw - 1) * w_dim1 + 1], &c__1);
00304
00305 i__1 = jmax + (kw - 1) * w_dim1;
00306 d__3 = rowmax, d__4 = (d__1 = w[i__1].r, abs(d__1)) + (
00307 d__2 = d_imag(&w[jmax + (kw - 1) * w_dim1]), abs(
00308 d__2));
00309 rowmax = max(d__3,d__4);
00310 }
00311
00312 if (absakk >= alpha * colmax * (colmax / rowmax)) {
00313
00314
00315
00316 kp = k;
00317 } else {
00318 i__1 = imax + (kw - 1) * w_dim1;
00319 if ((d__1 = w[i__1].r, abs(d__1)) >= alpha * rowmax) {
00320
00321
00322
00323
00324 kp = imax;
00325
00326
00327
00328 zcopy_(&k, &w[(kw - 1) * w_dim1 + 1], &c__1, &w[kw *
00329 w_dim1 + 1], &c__1);
00330 } else {
00331
00332
00333
00334
00335 kp = imax;
00336 kstep = 2;
00337 }
00338 }
00339 }
00340
00341 kk = k - kstep + 1;
00342 kkw = *nb + kk - *n;
00343
00344
00345
00346 if (kp != kk) {
00347
00348
00349
00350 i__1 = kp + kp * a_dim1;
00351 i__2 = kk + kk * a_dim1;
00352 d__1 = a[i__2].r;
00353 a[i__1].r = d__1, a[i__1].i = 0.;
00354 i__1 = kk - 1 - kp;
00355 zcopy_(&i__1, &a[kp + 1 + kk * a_dim1], &c__1, &a[kp + (kp +
00356 1) * a_dim1], lda);
00357 i__1 = kk - 1 - kp;
00358 zlacgv_(&i__1, &a[kp + (kp + 1) * a_dim1], lda);
00359 i__1 = kp - 1;
00360 zcopy_(&i__1, &a[kk * a_dim1 + 1], &c__1, &a[kp * a_dim1 + 1],
00361 &c__1);
00362
00363
00364
00365 if (kk < *n) {
00366 i__1 = *n - kk;
00367 zswap_(&i__1, &a[kk + (kk + 1) * a_dim1], lda, &a[kp + (
00368 kk + 1) * a_dim1], lda);
00369 }
00370 i__1 = *n - kk + 1;
00371 zswap_(&i__1, &w[kk + kkw * w_dim1], ldw, &w[kp + kkw *
00372 w_dim1], ldw);
00373 }
00374
00375 if (kstep == 1) {
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385 zcopy_(&k, &w[kw * w_dim1 + 1], &c__1, &a[k * a_dim1 + 1], &
00386 c__1);
00387 i__1 = k + k * a_dim1;
00388 r1 = 1. / a[i__1].r;
00389 i__1 = k - 1;
00390 zdscal_(&i__1, &r1, &a[k * a_dim1 + 1], &c__1);
00391
00392
00393
00394 i__1 = k - 1;
00395 zlacgv_(&i__1, &w[kw * w_dim1 + 1], &c__1);
00396 } else {
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406 if (k > 2) {
00407
00408
00409
00410 i__1 = k - 1 + kw * w_dim1;
00411 d21.r = w[i__1].r, d21.i = w[i__1].i;
00412 d_cnjg(&z__2, &d21);
00413 z_div(&z__1, &w[k + kw * w_dim1], &z__2);
00414 d11.r = z__1.r, d11.i = z__1.i;
00415 z_div(&z__1, &w[k - 1 + (kw - 1) * w_dim1], &d21);
00416 d22.r = z__1.r, d22.i = z__1.i;
00417 z__1.r = d11.r * d22.r - d11.i * d22.i, z__1.i = d11.r *
00418 d22.i + d11.i * d22.r;
00419 t = 1. / (z__1.r - 1.);
00420 z__2.r = t, z__2.i = 0.;
00421 z_div(&z__1, &z__2, &d21);
00422 d21.r = z__1.r, d21.i = z__1.i;
00423 i__1 = k - 2;
00424 for (j = 1; j <= i__1; ++j) {
00425 i__2 = j + (k - 1) * a_dim1;
00426 i__3 = j + (kw - 1) * w_dim1;
00427 z__3.r = d11.r * w[i__3].r - d11.i * w[i__3].i,
00428 z__3.i = d11.r * w[i__3].i + d11.i * w[i__3]
00429 .r;
00430 i__4 = j + kw * w_dim1;
00431 z__2.r = z__3.r - w[i__4].r, z__2.i = z__3.i - w[i__4]
00432 .i;
00433 z__1.r = d21.r * z__2.r - d21.i * z__2.i, z__1.i =
00434 d21.r * z__2.i + d21.i * z__2.r;
00435 a[i__2].r = z__1.r, a[i__2].i = z__1.i;
00436 i__2 = j + k * a_dim1;
00437 d_cnjg(&z__2, &d21);
00438 i__3 = j + kw * w_dim1;
00439 z__4.r = d22.r * w[i__3].r - d22.i * w[i__3].i,
00440 z__4.i = d22.r * w[i__3].i + d22.i * w[i__3]
00441 .r;
00442 i__4 = j + (kw - 1) * w_dim1;
00443 z__3.r = z__4.r - w[i__4].r, z__3.i = z__4.i - w[i__4]
00444 .i;
00445 z__1.r = z__2.r * z__3.r - z__2.i * z__3.i, z__1.i =
00446 z__2.r * z__3.i + z__2.i * z__3.r;
00447 a[i__2].r = z__1.r, a[i__2].i = z__1.i;
00448
00449 }
00450 }
00451
00452
00453
00454 i__1 = k - 1 + (k - 1) * a_dim1;
00455 i__2 = k - 1 + (kw - 1) * w_dim1;
00456 a[i__1].r = w[i__2].r, a[i__1].i = w[i__2].i;
00457 i__1 = k - 1 + k * a_dim1;
00458 i__2 = k - 1 + kw * w_dim1;
00459 a[i__1].r = w[i__2].r, a[i__1].i = w[i__2].i;
00460 i__1 = k + k * a_dim1;
00461 i__2 = k + kw * w_dim1;
00462 a[i__1].r = w[i__2].r, a[i__1].i = w[i__2].i;
00463
00464
00465
00466 i__1 = k - 1;
00467 zlacgv_(&i__1, &w[kw * w_dim1 + 1], &c__1);
00468 i__1 = k - 2;
00469 zlacgv_(&i__1, &w[(kw - 1) * w_dim1 + 1], &c__1);
00470 }
00471 }
00472
00473
00474
00475 if (kstep == 1) {
00476 ipiv[k] = kp;
00477 } else {
00478 ipiv[k] = -kp;
00479 ipiv[k - 1] = -kp;
00480 }
00481
00482
00483
00484 k -= kstep;
00485 goto L10;
00486
00487 L30:
00488
00489
00490
00491
00492
00493
00494
00495
00496 i__1 = -(*nb);
00497 for (j = (k - 1) / *nb * *nb + 1; i__1 < 0 ? j >= 1 : j <= 1; j +=
00498 i__1) {
00499
00500 i__2 = *nb, i__3 = k - j + 1;
00501 jb = min(i__2,i__3);
00502
00503
00504
00505 i__2 = j + jb - 1;
00506 for (jj = j; jj <= i__2; ++jj) {
00507 i__3 = jj + jj * a_dim1;
00508 i__4 = jj + jj * a_dim1;
00509 d__1 = a[i__4].r;
00510 a[i__3].r = d__1, a[i__3].i = 0.;
00511 i__3 = jj - j + 1;
00512 i__4 = *n - k;
00513 z__1.r = -1., z__1.i = -0.;
00514 zgemv_("No transpose", &i__3, &i__4, &z__1, &a[j + (k + 1) *
00515 a_dim1], lda, &w[jj + (kw + 1) * w_dim1], ldw, &c_b1,
00516 &a[j + jj * a_dim1], &c__1);
00517 i__3 = jj + jj * a_dim1;
00518 i__4 = jj + jj * a_dim1;
00519 d__1 = a[i__4].r;
00520 a[i__3].r = d__1, a[i__3].i = 0.;
00521
00522 }
00523
00524
00525
00526 i__2 = j - 1;
00527 i__3 = *n - k;
00528 z__1.r = -1., z__1.i = -0.;
00529 zgemm_("No transpose", "Transpose", &i__2, &jb, &i__3, &z__1, &a[(
00530 k + 1) * a_dim1 + 1], lda, &w[j + (kw + 1) * w_dim1], ldw,
00531 &c_b1, &a[j * a_dim1 + 1], lda);
00532
00533 }
00534
00535
00536
00537
00538 j = k + 1;
00539 L60:
00540 jj = j;
00541 jp = ipiv[j];
00542 if (jp < 0) {
00543 jp = -jp;
00544 ++j;
00545 }
00546 ++j;
00547 if (jp != jj && j <= *n) {
00548 i__1 = *n - j + 1;
00549 zswap_(&i__1, &a[jp + j * a_dim1], lda, &a[jj + j * a_dim1], lda);
00550 }
00551 if (j <= *n) {
00552 goto L60;
00553 }
00554
00555
00556
00557 *kb = *n - k;
00558
00559 } else {
00560
00561
00562
00563
00564
00565
00566
00567 k = 1;
00568 L70:
00569
00570
00571
00572 if (k >= *nb && *nb < *n || k > *n) {
00573 goto L90;
00574 }
00575
00576
00577
00578 i__1 = k + k * w_dim1;
00579 i__2 = k + k * a_dim1;
00580 d__1 = a[i__2].r;
00581 w[i__1].r = d__1, w[i__1].i = 0.;
00582 if (k < *n) {
00583 i__1 = *n - k;
00584 zcopy_(&i__1, &a[k + 1 + k * a_dim1], &c__1, &w[k + 1 + k *
00585 w_dim1], &c__1);
00586 }
00587 i__1 = *n - k + 1;
00588 i__2 = k - 1;
00589 z__1.r = -1., z__1.i = -0.;
00590 zgemv_("No transpose", &i__1, &i__2, &z__1, &a[k + a_dim1], lda, &w[k
00591 + w_dim1], ldw, &c_b1, &w[k + k * w_dim1], &c__1);
00592 i__1 = k + k * w_dim1;
00593 i__2 = k + k * w_dim1;
00594 d__1 = w[i__2].r;
00595 w[i__1].r = d__1, w[i__1].i = 0.;
00596
00597 kstep = 1;
00598
00599
00600
00601
00602 i__1 = k + k * w_dim1;
00603 absakk = (d__1 = w[i__1].r, abs(d__1));
00604
00605
00606
00607
00608 if (k < *n) {
00609 i__1 = *n - k;
00610 imax = k + izamax_(&i__1, &w[k + 1 + k * w_dim1], &c__1);
00611 i__1 = imax + k * w_dim1;
00612 colmax = (d__1 = w[i__1].r, abs(d__1)) + (d__2 = d_imag(&w[imax +
00613 k * w_dim1]), abs(d__2));
00614 } else {
00615 colmax = 0.;
00616 }
00617
00618 if (max(absakk,colmax) == 0.) {
00619
00620
00621
00622 if (*info == 0) {
00623 *info = k;
00624 }
00625 kp = k;
00626 i__1 = k + k * a_dim1;
00627 i__2 = k + k * a_dim1;
00628 d__1 = a[i__2].r;
00629 a[i__1].r = d__1, a[i__1].i = 0.;
00630 } else {
00631 if (absakk >= alpha * colmax) {
00632
00633
00634
00635 kp = k;
00636 } else {
00637
00638
00639
00640 i__1 = imax - k;
00641 zcopy_(&i__1, &a[imax + k * a_dim1], lda, &w[k + (k + 1) *
00642 w_dim1], &c__1);
00643 i__1 = imax - k;
00644 zlacgv_(&i__1, &w[k + (k + 1) * w_dim1], &c__1);
00645 i__1 = imax + (k + 1) * w_dim1;
00646 i__2 = imax + imax * a_dim1;
00647 d__1 = a[i__2].r;
00648 w[i__1].r = d__1, w[i__1].i = 0.;
00649 if (imax < *n) {
00650 i__1 = *n - imax;
00651 zcopy_(&i__1, &a[imax + 1 + imax * a_dim1], &c__1, &w[
00652 imax + 1 + (k + 1) * w_dim1], &c__1);
00653 }
00654 i__1 = *n - k + 1;
00655 i__2 = k - 1;
00656 z__1.r = -1., z__1.i = -0.;
00657 zgemv_("No transpose", &i__1, &i__2, &z__1, &a[k + a_dim1],
00658 lda, &w[imax + w_dim1], ldw, &c_b1, &w[k + (k + 1) *
00659 w_dim1], &c__1);
00660 i__1 = imax + (k + 1) * w_dim1;
00661 i__2 = imax + (k + 1) * w_dim1;
00662 d__1 = w[i__2].r;
00663 w[i__1].r = d__1, w[i__1].i = 0.;
00664
00665
00666
00667
00668 i__1 = imax - k;
00669 jmax = k - 1 + izamax_(&i__1, &w[k + (k + 1) * w_dim1], &c__1)
00670 ;
00671 i__1 = jmax + (k + 1) * w_dim1;
00672 rowmax = (d__1 = w[i__1].r, abs(d__1)) + (d__2 = d_imag(&w[
00673 jmax + (k + 1) * w_dim1]), abs(d__2));
00674 if (imax < *n) {
00675 i__1 = *n - imax;
00676 jmax = imax + izamax_(&i__1, &w[imax + 1 + (k + 1) *
00677 w_dim1], &c__1);
00678
00679 i__1 = jmax + (k + 1) * w_dim1;
00680 d__3 = rowmax, d__4 = (d__1 = w[i__1].r, abs(d__1)) + (
00681 d__2 = d_imag(&w[jmax + (k + 1) * w_dim1]), abs(
00682 d__2));
00683 rowmax = max(d__3,d__4);
00684 }
00685
00686 if (absakk >= alpha * colmax * (colmax / rowmax)) {
00687
00688
00689
00690 kp = k;
00691 } else {
00692 i__1 = imax + (k + 1) * w_dim1;
00693 if ((d__1 = w[i__1].r, abs(d__1)) >= alpha * rowmax) {
00694
00695
00696
00697
00698 kp = imax;
00699
00700
00701
00702 i__1 = *n - k + 1;
00703 zcopy_(&i__1, &w[k + (k + 1) * w_dim1], &c__1, &w[k +
00704 k * w_dim1], &c__1);
00705 } else {
00706
00707
00708
00709
00710 kp = imax;
00711 kstep = 2;
00712 }
00713 }
00714 }
00715
00716 kk = k + kstep - 1;
00717
00718
00719
00720 if (kp != kk) {
00721
00722
00723
00724 i__1 = kp + kp * a_dim1;
00725 i__2 = kk + kk * a_dim1;
00726 d__1 = a[i__2].r;
00727 a[i__1].r = d__1, a[i__1].i = 0.;
00728 i__1 = kp - kk - 1;
00729 zcopy_(&i__1, &a[kk + 1 + kk * a_dim1], &c__1, &a[kp + (kk +
00730 1) * a_dim1], lda);
00731 i__1 = kp - kk - 1;
00732 zlacgv_(&i__1, &a[kp + (kk + 1) * a_dim1], lda);
00733 if (kp < *n) {
00734 i__1 = *n - kp;
00735 zcopy_(&i__1, &a[kp + 1 + kk * a_dim1], &c__1, &a[kp + 1
00736 + kp * a_dim1], &c__1);
00737 }
00738
00739
00740
00741 i__1 = kk - 1;
00742 zswap_(&i__1, &a[kk + a_dim1], lda, &a[kp + a_dim1], lda);
00743 zswap_(&kk, &w[kk + w_dim1], ldw, &w[kp + w_dim1], ldw);
00744 }
00745
00746 if (kstep == 1) {
00747
00748
00749
00750
00751
00752
00753
00754
00755
00756 i__1 = *n - k + 1;
00757 zcopy_(&i__1, &w[k + k * w_dim1], &c__1, &a[k + k * a_dim1], &
00758 c__1);
00759 if (k < *n) {
00760 i__1 = k + k * a_dim1;
00761 r1 = 1. / a[i__1].r;
00762 i__1 = *n - k;
00763 zdscal_(&i__1, &r1, &a[k + 1 + k * a_dim1], &c__1);
00764
00765
00766
00767 i__1 = *n - k;
00768 zlacgv_(&i__1, &w[k + 1 + k * w_dim1], &c__1);
00769 }
00770 } else {
00771
00772
00773
00774
00775
00776
00777
00778
00779 if (k < *n - 1) {
00780
00781
00782
00783 i__1 = k + 1 + k * w_dim1;
00784 d21.r = w[i__1].r, d21.i = w[i__1].i;
00785 z_div(&z__1, &w[k + 1 + (k + 1) * w_dim1], &d21);
00786 d11.r = z__1.r, d11.i = z__1.i;
00787 d_cnjg(&z__2, &d21);
00788 z_div(&z__1, &w[k + k * w_dim1], &z__2);
00789 d22.r = z__1.r, d22.i = z__1.i;
00790 z__1.r = d11.r * d22.r - d11.i * d22.i, z__1.i = d11.r *
00791 d22.i + d11.i * d22.r;
00792 t = 1. / (z__1.r - 1.);
00793 z__2.r = t, z__2.i = 0.;
00794 z_div(&z__1, &z__2, &d21);
00795 d21.r = z__1.r, d21.i = z__1.i;
00796 i__1 = *n;
00797 for (j = k + 2; j <= i__1; ++j) {
00798 i__2 = j + k * a_dim1;
00799 d_cnjg(&z__2, &d21);
00800 i__3 = j + k * w_dim1;
00801 z__4.r = d11.r * w[i__3].r - d11.i * w[i__3].i,
00802 z__4.i = d11.r * w[i__3].i + d11.i * w[i__3]
00803 .r;
00804 i__4 = j + (k + 1) * w_dim1;
00805 z__3.r = z__4.r - w[i__4].r, z__3.i = z__4.i - w[i__4]
00806 .i;
00807 z__1.r = z__2.r * z__3.r - z__2.i * z__3.i, z__1.i =
00808 z__2.r * z__3.i + z__2.i * z__3.r;
00809 a[i__2].r = z__1.r, a[i__2].i = z__1.i;
00810 i__2 = j + (k + 1) * a_dim1;
00811 i__3 = j + (k + 1) * w_dim1;
00812 z__3.r = d22.r * w[i__3].r - d22.i * w[i__3].i,
00813 z__3.i = d22.r * w[i__3].i + d22.i * w[i__3]
00814 .r;
00815 i__4 = j + k * w_dim1;
00816 z__2.r = z__3.r - w[i__4].r, z__2.i = z__3.i - w[i__4]
00817 .i;
00818 z__1.r = d21.r * z__2.r - d21.i * z__2.i, z__1.i =
00819 d21.r * z__2.i + d21.i * z__2.r;
00820 a[i__2].r = z__1.r, a[i__2].i = z__1.i;
00821
00822 }
00823 }
00824
00825
00826
00827 i__1 = k + k * a_dim1;
00828 i__2 = k + k * w_dim1;
00829 a[i__1].r = w[i__2].r, a[i__1].i = w[i__2].i;
00830 i__1 = k + 1 + k * a_dim1;
00831 i__2 = k + 1 + k * w_dim1;
00832 a[i__1].r = w[i__2].r, a[i__1].i = w[i__2].i;
00833 i__1 = k + 1 + (k + 1) * a_dim1;
00834 i__2 = k + 1 + (k + 1) * w_dim1;
00835 a[i__1].r = w[i__2].r, a[i__1].i = w[i__2].i;
00836
00837
00838
00839 i__1 = *n - k;
00840 zlacgv_(&i__1, &w[k + 1 + k * w_dim1], &c__1);
00841 i__1 = *n - k - 1;
00842 zlacgv_(&i__1, &w[k + 2 + (k + 1) * w_dim1], &c__1);
00843 }
00844 }
00845
00846
00847
00848 if (kstep == 1) {
00849 ipiv[k] = kp;
00850 } else {
00851 ipiv[k] = -kp;
00852 ipiv[k + 1] = -kp;
00853 }
00854
00855
00856
00857 k += kstep;
00858 goto L70;
00859
00860 L90:
00861
00862
00863
00864
00865
00866
00867
00868
00869 i__1 = *n;
00870 i__2 = *nb;
00871 for (j = k; i__2 < 0 ? j >= i__1 : j <= i__1; j += i__2) {
00872
00873 i__3 = *nb, i__4 = *n - j + 1;
00874 jb = min(i__3,i__4);
00875
00876
00877
00878 i__3 = j + jb - 1;
00879 for (jj = j; jj <= i__3; ++jj) {
00880 i__4 = jj + jj * a_dim1;
00881 i__5 = jj + jj * a_dim1;
00882 d__1 = a[i__5].r;
00883 a[i__4].r = d__1, a[i__4].i = 0.;
00884 i__4 = j + jb - jj;
00885 i__5 = k - 1;
00886 z__1.r = -1., z__1.i = -0.;
00887 zgemv_("No transpose", &i__4, &i__5, &z__1, &a[jj + a_dim1],
00888 lda, &w[jj + w_dim1], ldw, &c_b1, &a[jj + jj * a_dim1]
00889 , &c__1);
00890 i__4 = jj + jj * a_dim1;
00891 i__5 = jj + jj * a_dim1;
00892 d__1 = a[i__5].r;
00893 a[i__4].r = d__1, a[i__4].i = 0.;
00894
00895 }
00896
00897
00898
00899 if (j + jb <= *n) {
00900 i__3 = *n - j - jb + 1;
00901 i__4 = k - 1;
00902 z__1.r = -1., z__1.i = -0.;
00903 zgemm_("No transpose", "Transpose", &i__3, &jb, &i__4, &z__1,
00904 &a[j + jb + a_dim1], lda, &w[j + w_dim1], ldw, &c_b1,
00905 &a[j + jb + j * a_dim1], lda);
00906 }
00907
00908 }
00909
00910
00911
00912
00913 j = k - 1;
00914 L120:
00915 jj = j;
00916 jp = ipiv[j];
00917 if (jp < 0) {
00918 jp = -jp;
00919 --j;
00920 }
00921 --j;
00922 if (jp != jj && j >= 1) {
00923 zswap_(&j, &a[jp + a_dim1], lda, &a[jj + a_dim1], lda);
00924 }
00925 if (j >= 1) {
00926 goto L120;
00927 }
00928
00929
00930
00931 *kb = k - 1;
00932
00933 }
00934 return 0;
00935
00936
00937
00938 }