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 static integer c_n1 = -1;
00021 static real c_b21 = -1.f;
00022 static real c_b22 = 1.f;
00023 static integer c__33 = 33;
00024
00025 int cpbtrf_(char *uplo, integer *n, integer *kd, complex *ab,
00026 integer *ldab, integer *info)
00027 {
00028
00029 integer ab_dim1, ab_offset, i__1, i__2, i__3, i__4, i__5, i__6;
00030 complex q__1;
00031
00032
00033 integer i__, j, i2, i3, ib, nb, ii, jj;
00034 complex work[1056] ;
00035 extern int cgemm_(char *, char *, integer *, integer *,
00036 integer *, complex *, complex *, integer *, complex *, integer *,
00037 complex *, complex *, integer *), cherk_(char *,
00038 char *, integer *, integer *, real *, complex *, integer *, real *
00039 , complex *, integer *);
00040 extern logical lsame_(char *, char *);
00041 extern int ctrsm_(char *, char *, char *, char *,
00042 integer *, integer *, complex *, complex *, integer *, complex *,
00043 integer *), cpbtf2_(char *,
00044 integer *, integer *, complex *, integer *, integer *),
00045 cpotf2_(char *, integer *, complex *, integer *, integer *), xerbla_(char *, integer *);
00046 extern integer ilaenv_(integer *, char *, char *, integer *, integer *,
00047 integer *, integer *);
00048
00049
00050
00051
00052
00053
00054
00055
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 ab_dim1 = *ldab;
00151 ab_offset = 1 + ab_dim1;
00152 ab -= ab_offset;
00153
00154
00155 *info = 0;
00156 if (! lsame_(uplo, "U") && ! lsame_(uplo, "L")) {
00157 *info = -1;
00158 } else if (*n < 0) {
00159 *info = -2;
00160 } else if (*kd < 0) {
00161 *info = -3;
00162 } else if (*ldab < *kd + 1) {
00163 *info = -5;
00164 }
00165 if (*info != 0) {
00166 i__1 = -(*info);
00167 xerbla_("CPBTRF", &i__1);
00168 return 0;
00169 }
00170
00171
00172
00173 if (*n == 0) {
00174 return 0;
00175 }
00176
00177
00178
00179 nb = ilaenv_(&c__1, "CPBTRF", uplo, n, kd, &c_n1, &c_n1);
00180
00181
00182
00183
00184 nb = min(nb,32);
00185
00186 if (nb <= 1 || nb > *kd) {
00187
00188
00189
00190 cpbtf2_(uplo, n, kd, &ab[ab_offset], ldab, info);
00191 } else {
00192
00193
00194
00195 if (lsame_(uplo, "U")) {
00196
00197
00198
00199
00200
00201
00202
00203 i__1 = nb;
00204 for (j = 1; j <= i__1; ++j) {
00205 i__2 = j - 1;
00206 for (i__ = 1; i__ <= i__2; ++i__) {
00207 i__3 = i__ + j * 33 - 34;
00208 work[i__3].r = 0.f, work[i__3].i = 0.f;
00209
00210 }
00211
00212 }
00213
00214
00215
00216 i__1 = *n;
00217 i__2 = nb;
00218 for (i__ = 1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) {
00219
00220 i__3 = nb, i__4 = *n - i__ + 1;
00221 ib = min(i__3,i__4);
00222
00223
00224
00225 i__3 = *ldab - 1;
00226 cpotf2_(uplo, &ib, &ab[*kd + 1 + i__ * ab_dim1], &i__3, &ii);
00227 if (ii != 0) {
00228 *info = i__ + ii - 1;
00229 goto L150;
00230 }
00231 if (i__ + ib <= *n) {
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248 i__3 = *kd - ib, i__4 = *n - i__ - ib + 1;
00249 i2 = min(i__3,i__4);
00250
00251 i__3 = ib, i__4 = *n - i__ - *kd + 1;
00252 i3 = min(i__3,i__4);
00253
00254 if (i2 > 0) {
00255
00256
00257
00258 i__3 = *ldab - 1;
00259 i__4 = *ldab - 1;
00260 ctrsm_("Left", "Upper", "Conjugate transpose", "Non-"
00261 "unit", &ib, &i2, &c_b1, &ab[*kd + 1 + i__ *
00262 ab_dim1], &i__3, &ab[*kd + 1 - ib + (i__ + ib)
00263 * ab_dim1], &i__4);
00264
00265
00266
00267 i__3 = *ldab - 1;
00268 i__4 = *ldab - 1;
00269 cherk_("Upper", "Conjugate transpose", &i2, &ib, &
00270 c_b21, &ab[*kd + 1 - ib + (i__ + ib) *
00271 ab_dim1], &i__3, &c_b22, &ab[*kd + 1 + (i__ +
00272 ib) * ab_dim1], &i__4);
00273 }
00274
00275 if (i3 > 0) {
00276
00277
00278
00279 i__3 = i3;
00280 for (jj = 1; jj <= i__3; ++jj) {
00281 i__4 = ib;
00282 for (ii = jj; ii <= i__4; ++ii) {
00283 i__5 = ii + jj * 33 - 34;
00284 i__6 = ii - jj + 1 + (jj + i__ + *kd - 1) *
00285 ab_dim1;
00286 work[i__5].r = ab[i__6].r, work[i__5].i = ab[
00287 i__6].i;
00288
00289 }
00290
00291 }
00292
00293
00294
00295 i__3 = *ldab - 1;
00296 ctrsm_("Left", "Upper", "Conjugate transpose", "Non-"
00297 "unit", &ib, &i3, &c_b1, &ab[*kd + 1 + i__ *
00298 ab_dim1], &i__3, work, &c__33);
00299
00300
00301
00302 if (i2 > 0) {
00303 q__1.r = -1.f, q__1.i = -0.f;
00304 i__3 = *ldab - 1;
00305 i__4 = *ldab - 1;
00306 cgemm_("Conjugate transpose", "No transpose", &i2,
00307 &i3, &ib, &q__1, &ab[*kd + 1 - ib + (i__
00308 + ib) * ab_dim1], &i__3, work, &c__33, &
00309 c_b1, &ab[ib + 1 + (i__ + *kd) * ab_dim1],
00310 &i__4);
00311 }
00312
00313
00314
00315 i__3 = *ldab - 1;
00316 cherk_("Upper", "Conjugate transpose", &i3, &ib, &
00317 c_b21, work, &c__33, &c_b22, &ab[*kd + 1 + (
00318 i__ + *kd) * ab_dim1], &i__3);
00319
00320
00321
00322 i__3 = i3;
00323 for (jj = 1; jj <= i__3; ++jj) {
00324 i__4 = ib;
00325 for (ii = jj; ii <= i__4; ++ii) {
00326 i__5 = ii - jj + 1 + (jj + i__ + *kd - 1) *
00327 ab_dim1;
00328 i__6 = ii + jj * 33 - 34;
00329 ab[i__5].r = work[i__6].r, ab[i__5].i = work[
00330 i__6].i;
00331
00332 }
00333
00334 }
00335 }
00336 }
00337
00338 }
00339 } else {
00340
00341
00342
00343
00344
00345
00346
00347 i__2 = nb;
00348 for (j = 1; j <= i__2; ++j) {
00349 i__1 = nb;
00350 for (i__ = j + 1; i__ <= i__1; ++i__) {
00351 i__3 = i__ + j * 33 - 34;
00352 work[i__3].r = 0.f, work[i__3].i = 0.f;
00353
00354 }
00355
00356 }
00357
00358
00359
00360 i__2 = *n;
00361 i__1 = nb;
00362 for (i__ = 1; i__1 < 0 ? i__ >= i__2 : i__ <= i__2; i__ += i__1) {
00363
00364 i__3 = nb, i__4 = *n - i__ + 1;
00365 ib = min(i__3,i__4);
00366
00367
00368
00369 i__3 = *ldab - 1;
00370 cpotf2_(uplo, &ib, &ab[i__ * ab_dim1 + 1], &i__3, &ii);
00371 if (ii != 0) {
00372 *info = i__ + ii - 1;
00373 goto L150;
00374 }
00375 if (i__ + ib <= *n) {
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392 i__3 = *kd - ib, i__4 = *n - i__ - ib + 1;
00393 i2 = min(i__3,i__4);
00394
00395 i__3 = ib, i__4 = *n - i__ - *kd + 1;
00396 i3 = min(i__3,i__4);
00397
00398 if (i2 > 0) {
00399
00400
00401
00402 i__3 = *ldab - 1;
00403 i__4 = *ldab - 1;
00404 ctrsm_("Right", "Lower", "Conjugate transpose", "Non"
00405 "-unit", &i2, &ib, &c_b1, &ab[i__ * ab_dim1 +
00406 1], &i__3, &ab[ib + 1 + i__ * ab_dim1], &i__4);
00407
00408
00409
00410 i__3 = *ldab - 1;
00411 i__4 = *ldab - 1;
00412 cherk_("Lower", "No transpose", &i2, &ib, &c_b21, &ab[
00413 ib + 1 + i__ * ab_dim1], &i__3, &c_b22, &ab[(
00414 i__ + ib) * ab_dim1 + 1], &i__4);
00415 }
00416
00417 if (i3 > 0) {
00418
00419
00420
00421 i__3 = ib;
00422 for (jj = 1; jj <= i__3; ++jj) {
00423 i__4 = min(jj,i3);
00424 for (ii = 1; ii <= i__4; ++ii) {
00425 i__5 = ii + jj * 33 - 34;
00426 i__6 = *kd + 1 - jj + ii + (jj + i__ - 1) *
00427 ab_dim1;
00428 work[i__5].r = ab[i__6].r, work[i__5].i = ab[
00429 i__6].i;
00430
00431 }
00432
00433 }
00434
00435
00436
00437 i__3 = *ldab - 1;
00438 ctrsm_("Right", "Lower", "Conjugate transpose", "Non"
00439 "-unit", &i3, &ib, &c_b1, &ab[i__ * ab_dim1 +
00440 1], &i__3, work, &c__33);
00441
00442
00443
00444 if (i2 > 0) {
00445 q__1.r = -1.f, q__1.i = -0.f;
00446 i__3 = *ldab - 1;
00447 i__4 = *ldab - 1;
00448 cgemm_("No transpose", "Conjugate transpose", &i3,
00449 &i2, &ib, &q__1, work, &c__33, &ab[ib +
00450 1 + i__ * ab_dim1], &i__3, &c_b1, &ab[*kd
00451 + 1 - ib + (i__ + ib) * ab_dim1], &i__4);
00452 }
00453
00454
00455
00456 i__3 = *ldab - 1;
00457 cherk_("Lower", "No transpose", &i3, &ib, &c_b21,
00458 work, &c__33, &c_b22, &ab[(i__ + *kd) *
00459 ab_dim1 + 1], &i__3);
00460
00461
00462
00463 i__3 = ib;
00464 for (jj = 1; jj <= i__3; ++jj) {
00465 i__4 = min(jj,i3);
00466 for (ii = 1; ii <= i__4; ++ii) {
00467 i__5 = *kd + 1 - jj + ii + (jj + i__ - 1) *
00468 ab_dim1;
00469 i__6 = ii + jj * 33 - 34;
00470 ab[i__5].r = work[i__6].r, ab[i__5].i = work[
00471 i__6].i;
00472
00473 }
00474
00475 }
00476 }
00477 }
00478
00479 }
00480 }
00481 }
00482 return 0;
00483
00484 L150:
00485 return 0;
00486
00487
00488
00489 }