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