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