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
00020 doublereal dlantb_(char *norm, char *uplo, char *diag, integer *n, integer *k,
00021 doublereal *ab, integer *ldab, doublereal *work)
00022 {
00023
00024 integer ab_dim1, ab_offset, i__1, i__2, i__3, i__4, i__5;
00025 doublereal ret_val, d__1, d__2, d__3;
00026
00027
00028 double sqrt(doublereal);
00029
00030
00031 integer i__, j, l;
00032 doublereal sum, scale;
00033 logical udiag;
00034 extern logical lsame_(char *, char *);
00035 doublereal value;
00036 extern int dlassq_(integer *, doublereal *, integer *,
00037 doublereal *, doublereal *);
00038
00039
00040
00041
00042
00043
00044
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 ab_dim1 = *ldab;
00133 ab_offset = 1 + ab_dim1;
00134 ab -= ab_offset;
00135 --work;
00136
00137
00138 if (*n == 0) {
00139 value = 0.;
00140 } else if (lsame_(norm, "M")) {
00141
00142
00143
00144 if (lsame_(diag, "U")) {
00145 value = 1.;
00146 if (lsame_(uplo, "U")) {
00147 i__1 = *n;
00148 for (j = 1; j <= i__1; ++j) {
00149
00150 i__2 = *k + 2 - j;
00151 i__3 = *k;
00152 for (i__ = max(i__2,1); i__ <= i__3; ++i__) {
00153
00154 d__2 = value, d__3 = (d__1 = ab[i__ + j * ab_dim1],
00155 abs(d__1));
00156 value = max(d__2,d__3);
00157
00158 }
00159
00160 }
00161 } else {
00162 i__1 = *n;
00163 for (j = 1; j <= i__1; ++j) {
00164
00165 i__2 = *n + 1 - j, i__4 = *k + 1;
00166 i__3 = min(i__2,i__4);
00167 for (i__ = 2; i__ <= i__3; ++i__) {
00168
00169 d__2 = value, d__3 = (d__1 = ab[i__ + j * ab_dim1],
00170 abs(d__1));
00171 value = max(d__2,d__3);
00172
00173 }
00174
00175 }
00176 }
00177 } else {
00178 value = 0.;
00179 if (lsame_(uplo, "U")) {
00180 i__1 = *n;
00181 for (j = 1; j <= i__1; ++j) {
00182
00183 i__3 = *k + 2 - j;
00184 i__2 = *k + 1;
00185 for (i__ = max(i__3,1); i__ <= i__2; ++i__) {
00186
00187 d__2 = value, d__3 = (d__1 = ab[i__ + j * ab_dim1],
00188 abs(d__1));
00189 value = max(d__2,d__3);
00190
00191 }
00192
00193 }
00194 } else {
00195 i__1 = *n;
00196 for (j = 1; j <= i__1; ++j) {
00197
00198 i__3 = *n + 1 - j, i__4 = *k + 1;
00199 i__2 = min(i__3,i__4);
00200 for (i__ = 1; i__ <= i__2; ++i__) {
00201
00202 d__2 = value, d__3 = (d__1 = ab[i__ + j * ab_dim1],
00203 abs(d__1));
00204 value = max(d__2,d__3);
00205
00206 }
00207
00208 }
00209 }
00210 }
00211 } else if (lsame_(norm, "O") || *(unsigned char *)
00212 norm == '1') {
00213
00214
00215
00216 value = 0.;
00217 udiag = lsame_(diag, "U");
00218 if (lsame_(uplo, "U")) {
00219 i__1 = *n;
00220 for (j = 1; j <= i__1; ++j) {
00221 if (udiag) {
00222 sum = 1.;
00223
00224 i__2 = *k + 2 - j;
00225 i__3 = *k;
00226 for (i__ = max(i__2,1); i__ <= i__3; ++i__) {
00227 sum += (d__1 = ab[i__ + j * ab_dim1], abs(d__1));
00228
00229 }
00230 } else {
00231 sum = 0.;
00232
00233 i__3 = *k + 2 - j;
00234 i__2 = *k + 1;
00235 for (i__ = max(i__3,1); i__ <= i__2; ++i__) {
00236 sum += (d__1 = ab[i__ + j * ab_dim1], abs(d__1));
00237
00238 }
00239 }
00240 value = max(value,sum);
00241
00242 }
00243 } else {
00244 i__1 = *n;
00245 for (j = 1; j <= i__1; ++j) {
00246 if (udiag) {
00247 sum = 1.;
00248
00249 i__3 = *n + 1 - j, i__4 = *k + 1;
00250 i__2 = min(i__3,i__4);
00251 for (i__ = 2; i__ <= i__2; ++i__) {
00252 sum += (d__1 = ab[i__ + j * ab_dim1], abs(d__1));
00253
00254 }
00255 } else {
00256 sum = 0.;
00257
00258 i__3 = *n + 1 - j, i__4 = *k + 1;
00259 i__2 = min(i__3,i__4);
00260 for (i__ = 1; i__ <= i__2; ++i__) {
00261 sum += (d__1 = ab[i__ + j * ab_dim1], abs(d__1));
00262
00263 }
00264 }
00265 value = max(value,sum);
00266
00267 }
00268 }
00269 } else if (lsame_(norm, "I")) {
00270
00271
00272
00273 value = 0.;
00274 if (lsame_(uplo, "U")) {
00275 if (lsame_(diag, "U")) {
00276 i__1 = *n;
00277 for (i__ = 1; i__ <= i__1; ++i__) {
00278 work[i__] = 1.;
00279
00280 }
00281 i__1 = *n;
00282 for (j = 1; j <= i__1; ++j) {
00283 l = *k + 1 - j;
00284
00285 i__2 = 1, i__3 = j - *k;
00286 i__4 = j - 1;
00287 for (i__ = max(i__2,i__3); i__ <= i__4; ++i__) {
00288 work[i__] += (d__1 = ab[l + i__ + j * ab_dim1], abs(
00289 d__1));
00290
00291 }
00292
00293 }
00294 } else {
00295 i__1 = *n;
00296 for (i__ = 1; i__ <= i__1; ++i__) {
00297 work[i__] = 0.;
00298
00299 }
00300 i__1 = *n;
00301 for (j = 1; j <= i__1; ++j) {
00302 l = *k + 1 - j;
00303
00304 i__4 = 1, i__2 = j - *k;
00305 i__3 = j;
00306 for (i__ = max(i__4,i__2); i__ <= i__3; ++i__) {
00307 work[i__] += (d__1 = ab[l + i__ + j * ab_dim1], abs(
00308 d__1));
00309
00310 }
00311
00312 }
00313 }
00314 } else {
00315 if (lsame_(diag, "U")) {
00316 i__1 = *n;
00317 for (i__ = 1; i__ <= i__1; ++i__) {
00318 work[i__] = 1.;
00319
00320 }
00321 i__1 = *n;
00322 for (j = 1; j <= i__1; ++j) {
00323 l = 1 - j;
00324
00325 i__4 = *n, i__2 = j + *k;
00326 i__3 = min(i__4,i__2);
00327 for (i__ = j + 1; i__ <= i__3; ++i__) {
00328 work[i__] += (d__1 = ab[l + i__ + j * ab_dim1], abs(
00329 d__1));
00330
00331 }
00332
00333 }
00334 } else {
00335 i__1 = *n;
00336 for (i__ = 1; i__ <= i__1; ++i__) {
00337 work[i__] = 0.;
00338
00339 }
00340 i__1 = *n;
00341 for (j = 1; j <= i__1; ++j) {
00342 l = 1 - j;
00343
00344 i__4 = *n, i__2 = j + *k;
00345 i__3 = min(i__4,i__2);
00346 for (i__ = j; i__ <= i__3; ++i__) {
00347 work[i__] += (d__1 = ab[l + i__ + j * ab_dim1], abs(
00348 d__1));
00349
00350 }
00351
00352 }
00353 }
00354 }
00355 i__1 = *n;
00356 for (i__ = 1; i__ <= i__1; ++i__) {
00357
00358 d__1 = value, d__2 = work[i__];
00359 value = max(d__1,d__2);
00360
00361 }
00362 } else if (lsame_(norm, "F") || lsame_(norm, "E")) {
00363
00364
00365
00366 if (lsame_(uplo, "U")) {
00367 if (lsame_(diag, "U")) {
00368 scale = 1.;
00369 sum = (doublereal) (*n);
00370 if (*k > 0) {
00371 i__1 = *n;
00372 for (j = 2; j <= i__1; ++j) {
00373
00374 i__4 = j - 1;
00375 i__3 = min(i__4,*k);
00376
00377 i__2 = *k + 2 - j;
00378 dlassq_(&i__3, &ab[max(i__2, 1)+ j * ab_dim1], &c__1,
00379 &scale, &sum);
00380
00381 }
00382 }
00383 } else {
00384 scale = 0.;
00385 sum = 1.;
00386 i__1 = *n;
00387 for (j = 1; j <= i__1; ++j) {
00388
00389 i__4 = j, i__2 = *k + 1;
00390 i__3 = min(i__4,i__2);
00391
00392 i__5 = *k + 2 - j;
00393 dlassq_(&i__3, &ab[max(i__5, 1)+ j * ab_dim1], &c__1, &
00394 scale, &sum);
00395
00396 }
00397 }
00398 } else {
00399 if (lsame_(diag, "U")) {
00400 scale = 1.;
00401 sum = (doublereal) (*n);
00402 if (*k > 0) {
00403 i__1 = *n - 1;
00404 for (j = 1; j <= i__1; ++j) {
00405
00406 i__4 = *n - j;
00407 i__3 = min(i__4,*k);
00408 dlassq_(&i__3, &ab[j * ab_dim1 + 2], &c__1, &scale, &
00409 sum);
00410
00411 }
00412 }
00413 } else {
00414 scale = 0.;
00415 sum = 1.;
00416 i__1 = *n;
00417 for (j = 1; j <= i__1; ++j) {
00418
00419 i__4 = *n - j + 1, i__2 = *k + 1;
00420 i__3 = min(i__4,i__2);
00421 dlassq_(&i__3, &ab[j * ab_dim1 + 1], &c__1, &scale, &sum);
00422
00423 }
00424 }
00425 }
00426 value = scale * sqrt(sum);
00427 }
00428
00429 ret_val = value;
00430 return ret_val;
00431
00432
00433
00434 }