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