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 dlansb_(char *norm, char *uplo, integer *n, integer *k, doublereal
00021 *ab, integer *ldab, doublereal *work)
00022 {
00023
00024 integer ab_dim1, ab_offset, i__1, i__2, i__3, i__4;
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, absa, scale;
00033 extern logical lsame_(char *, char *);
00034 doublereal value;
00035 extern int dlassq_(integer *, doublereal *, integer *,
00036 doublereal *, doublereal *);
00037
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 ab_dim1 = *ldab;
00124 ab_offset = 1 + ab_dim1;
00125 ab -= ab_offset;
00126 --work;
00127
00128
00129 if (*n == 0) {
00130 value = 0.;
00131 } else if (lsame_(norm, "M")) {
00132
00133
00134
00135 value = 0.;
00136 if (lsame_(uplo, "U")) {
00137 i__1 = *n;
00138 for (j = 1; j <= i__1; ++j) {
00139
00140 i__2 = *k + 2 - j;
00141 i__3 = *k + 1;
00142 for (i__ = max(i__2,1); i__ <= i__3; ++i__) {
00143
00144 d__2 = value, d__3 = (d__1 = ab[i__ + j * ab_dim1], abs(
00145 d__1));
00146 value = max(d__2,d__3);
00147
00148 }
00149
00150 }
00151 } else {
00152 i__1 = *n;
00153 for (j = 1; j <= i__1; ++j) {
00154
00155 i__2 = *n + 1 - j, i__4 = *k + 1;
00156 i__3 = min(i__2,i__4);
00157 for (i__ = 1; i__ <= i__3; ++i__) {
00158
00159 d__2 = value, d__3 = (d__1 = ab[i__ + j * ab_dim1], abs(
00160 d__1));
00161 value = max(d__2,d__3);
00162
00163 }
00164
00165 }
00166 }
00167 } else if (lsame_(norm, "I") || lsame_(norm, "O") || *(unsigned char *)norm == '1') {
00168
00169
00170
00171 value = 0.;
00172 if (lsame_(uplo, "U")) {
00173 i__1 = *n;
00174 for (j = 1; j <= i__1; ++j) {
00175 sum = 0.;
00176 l = *k + 1 - j;
00177
00178 i__3 = 1, i__2 = j - *k;
00179 i__4 = j - 1;
00180 for (i__ = max(i__3,i__2); i__ <= i__4; ++i__) {
00181 absa = (d__1 = ab[l + i__ + j * ab_dim1], abs(d__1));
00182 sum += absa;
00183 work[i__] += absa;
00184
00185 }
00186 work[j] = sum + (d__1 = ab[*k + 1 + j * ab_dim1], abs(d__1));
00187
00188 }
00189 i__1 = *n;
00190 for (i__ = 1; i__ <= i__1; ++i__) {
00191
00192 d__1 = value, d__2 = work[i__];
00193 value = max(d__1,d__2);
00194
00195 }
00196 } else {
00197 i__1 = *n;
00198 for (i__ = 1; i__ <= i__1; ++i__) {
00199 work[i__] = 0.;
00200
00201 }
00202 i__1 = *n;
00203 for (j = 1; j <= i__1; ++j) {
00204 sum = work[j] + (d__1 = ab[j * ab_dim1 + 1], abs(d__1));
00205 l = 1 - j;
00206
00207 i__3 = *n, i__2 = j + *k;
00208 i__4 = min(i__3,i__2);
00209 for (i__ = j + 1; i__ <= i__4; ++i__) {
00210 absa = (d__1 = ab[l + i__ + j * ab_dim1], abs(d__1));
00211 sum += absa;
00212 work[i__] += absa;
00213
00214 }
00215 value = max(value,sum);
00216
00217 }
00218 }
00219 } else if (lsame_(norm, "F") || lsame_(norm, "E")) {
00220
00221
00222
00223 scale = 0.;
00224 sum = 1.;
00225 if (*k > 0) {
00226 if (lsame_(uplo, "U")) {
00227 i__1 = *n;
00228 for (j = 2; j <= i__1; ++j) {
00229
00230 i__3 = j - 1;
00231 i__4 = min(i__3,*k);
00232
00233 i__2 = *k + 2 - j;
00234 dlassq_(&i__4, &ab[max(i__2, 1)+ j * ab_dim1], &c__1, &
00235 scale, &sum);
00236
00237 }
00238 l = *k + 1;
00239 } else {
00240 i__1 = *n - 1;
00241 for (j = 1; j <= i__1; ++j) {
00242
00243 i__3 = *n - j;
00244 i__4 = min(i__3,*k);
00245 dlassq_(&i__4, &ab[j * ab_dim1 + 2], &c__1, &scale, &sum);
00246
00247 }
00248 l = 1;
00249 }
00250 sum *= 2;
00251 } else {
00252 l = 1;
00253 }
00254 dlassq_(n, &ab[l + ab_dim1], ldab, &scale, &sum);
00255 value = scale * sqrt(sum);
00256 }
00257
00258 ret_val = value;
00259 return ret_val;
00260
00261
00262
00263 }