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 zlanhp_(char *norm, char *uplo, integer *n, doublecomplex *ap,
00021 doublereal *work)
00022 {
00023
00024 integer 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, k;
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 --work;
00119 --ap;
00120
00121
00122 if (*n == 0) {
00123 value = 0.;
00124 } else if (lsame_(norm, "M")) {
00125
00126
00127
00128 value = 0.;
00129 if (lsame_(uplo, "U")) {
00130 k = 0;
00131 i__1 = *n;
00132 for (j = 1; j <= i__1; ++j) {
00133 i__2 = k + j - 1;
00134 for (i__ = k + 1; i__ <= i__2; ++i__) {
00135
00136 d__1 = value, d__2 = z_abs(&ap[i__]);
00137 value = max(d__1,d__2);
00138
00139 }
00140 k += j;
00141
00142 i__2 = k;
00143 d__2 = value, d__3 = (d__1 = ap[i__2].r, abs(d__1));
00144 value = max(d__2,d__3);
00145
00146 }
00147 } else {
00148 k = 1;
00149 i__1 = *n;
00150 for (j = 1; j <= i__1; ++j) {
00151
00152 i__2 = k;
00153 d__2 = value, d__3 = (d__1 = ap[i__2].r, abs(d__1));
00154 value = max(d__2,d__3);
00155 i__2 = k + *n - j;
00156 for (i__ = k + 1; i__ <= i__2; ++i__) {
00157
00158 d__1 = value, d__2 = z_abs(&ap[i__]);
00159 value = max(d__1,d__2);
00160
00161 }
00162 k = k + *n - j + 1;
00163
00164 }
00165 }
00166 } else if (lsame_(norm, "I") || lsame_(norm, "O") || *(unsigned char *)norm == '1') {
00167
00168
00169
00170 value = 0.;
00171 k = 1;
00172 if (lsame_(uplo, "U")) {
00173 i__1 = *n;
00174 for (j = 1; j <= i__1; ++j) {
00175 sum = 0.;
00176 i__2 = j - 1;
00177 for (i__ = 1; i__ <= i__2; ++i__) {
00178 absa = z_abs(&ap[k]);
00179 sum += absa;
00180 work[i__] += absa;
00181 ++k;
00182
00183 }
00184 i__2 = k;
00185 work[j] = sum + (d__1 = ap[i__2].r, abs(d__1));
00186 ++k;
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 i__2 = k;
00205 sum = work[j] + (d__1 = ap[i__2].r, abs(d__1));
00206 ++k;
00207 i__2 = *n;
00208 for (i__ = j + 1; i__ <= i__2; ++i__) {
00209 absa = z_abs(&ap[k]);
00210 sum += absa;
00211 work[i__] += absa;
00212 ++k;
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 k = 2;
00226 if (lsame_(uplo, "U")) {
00227 i__1 = *n;
00228 for (j = 2; j <= i__1; ++j) {
00229 i__2 = j - 1;
00230 zlassq_(&i__2, &ap[k], &c__1, &scale, &sum);
00231 k += j;
00232
00233 }
00234 } else {
00235 i__1 = *n - 1;
00236 for (j = 1; j <= i__1; ++j) {
00237 i__2 = *n - j;
00238 zlassq_(&i__2, &ap[k], &c__1, &scale, &sum);
00239 k = k + *n - j + 1;
00240
00241 }
00242 }
00243 sum *= 2;
00244 k = 1;
00245 i__1 = *n;
00246 for (i__ = 1; i__ <= i__1; ++i__) {
00247 i__2 = k;
00248 if (ap[i__2].r != 0.) {
00249 i__2 = k;
00250 absa = (d__1 = ap[i__2].r, abs(d__1));
00251 if (scale < absa) {
00252
00253 d__1 = scale / absa;
00254 sum = sum * (d__1 * d__1) + 1.;
00255 scale = absa;
00256 } else {
00257
00258 d__1 = absa / scale;
00259 sum += d__1 * d__1;
00260 }
00261 }
00262 if (lsame_(uplo, "U")) {
00263 k = k + i__ + 1;
00264 } else {
00265 k = k + *n - i__ + 1;
00266 }
00267
00268 }
00269 value = scale * sqrt(sum);
00270 }
00271
00272 ret_val = value;
00273 return ret_val;
00274
00275
00276
00277 }