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