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