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