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 doublecomplex c_b1 = {0.,0.};
00019 static doublecomplex c_b2 = {1.,0.};
00020 static integer c__1 = 1;
00021
00022 int zstt21_(integer *n, integer *kband, doublereal *ad,
00023 doublereal *ae, doublereal *sd, doublereal *se, doublecomplex *u,
00024 integer *ldu, doublecomplex *work, doublereal *rwork, doublereal *
00025 result)
00026 {
00027
00028 integer u_dim1, u_offset, i__1, i__2, i__3;
00029 doublereal d__1, d__2, d__3;
00030 doublecomplex z__1, z__2;
00031
00032
00033 integer j;
00034 doublereal ulp, unfl;
00035 extern int zher_(char *, integer *, doublereal *,
00036 doublecomplex *, integer *, doublecomplex *, integer *);
00037 doublereal temp1, temp2;
00038 extern int zher2_(char *, integer *, doublecomplex *,
00039 doublecomplex *, integer *, doublecomplex *, integer *,
00040 doublecomplex *, integer *);
00041 doublereal anorm;
00042 extern int zgemm_(char *, char *, integer *, integer *,
00043 integer *, doublecomplex *, doublecomplex *, integer *,
00044 doublecomplex *, integer *, doublecomplex *, doublecomplex *,
00045 integer *);
00046 doublereal wnorm;
00047 extern doublereal dlamch_(char *), zlange_(char *, integer *,
00048 integer *, doublecomplex *, integer *, doublereal *),
00049 zlanhe_(char *, char *, integer *, doublecomplex *, integer *,
00050 doublereal *);
00051 extern int zlaset_(char *, integer *, integer *,
00052 doublecomplex *, doublecomplex *, doublecomplex *, integer *);
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
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141 --ad;
00142 --ae;
00143 --sd;
00144 --se;
00145 u_dim1 = *ldu;
00146 u_offset = 1 + u_dim1;
00147 u -= u_offset;
00148 --work;
00149 --rwork;
00150 --result;
00151
00152
00153 result[1] = 0.;
00154 result[2] = 0.;
00155 if (*n <= 0) {
00156 return 0;
00157 }
00158
00159 unfl = dlamch_("Safe minimum");
00160 ulp = dlamch_("Precision");
00161
00162
00163
00164
00165
00166 zlaset_("Full", n, n, &c_b1, &c_b1, &work[1], n);
00167
00168 anorm = 0.;
00169 temp1 = 0.;
00170
00171 i__1 = *n - 1;
00172 for (j = 1; j <= i__1; ++j) {
00173 i__2 = (*n + 1) * (j - 1) + 1;
00174 i__3 = j;
00175 work[i__2].r = ad[i__3], work[i__2].i = 0.;
00176 i__2 = (*n + 1) * (j - 1) + 2;
00177 i__3 = j;
00178 work[i__2].r = ae[i__3], work[i__2].i = 0.;
00179 temp2 = (d__1 = ae[j], abs(d__1));
00180
00181 d__2 = anorm, d__3 = (d__1 = ad[j], abs(d__1)) + temp1 + temp2;
00182 anorm = max(d__2,d__3);
00183 temp1 = temp2;
00184
00185 }
00186
00187
00188 i__2 = *n;
00189 i__1 = i__2 * i__2;
00190 i__3 = *n;
00191 work[i__1].r = ad[i__3], work[i__1].i = 0.;
00192
00193 d__2 = anorm, d__3 = (d__1 = ad[*n], abs(d__1)) + temp1, d__2 = max(d__2,
00194 d__3);
00195 anorm = max(d__2,unfl);
00196
00197
00198
00199 i__1 = *n;
00200 for (j = 1; j <= i__1; ++j) {
00201 d__1 = -sd[j];
00202 zher_("L", n, &d__1, &u[j * u_dim1 + 1], &c__1, &work[1], n);
00203
00204 }
00205
00206 if (*n > 1 && *kband == 1) {
00207 i__1 = *n - 1;
00208 for (j = 1; j <= i__1; ++j) {
00209 i__2 = j;
00210 z__2.r = se[i__2], z__2.i = 0.;
00211 z__1.r = -z__2.r, z__1.i = -z__2.i;
00212 zher2_("L", n, &z__1, &u[j * u_dim1 + 1], &c__1, &u[(j + 1) *
00213 u_dim1 + 1], &c__1, &work[1], n);
00214
00215 }
00216 }
00217
00218 wnorm = zlanhe_("1", "L", n, &work[1], n, &rwork[1])
00219 ;
00220
00221 if (anorm > wnorm) {
00222 result[1] = wnorm / anorm / (*n * ulp);
00223 } else {
00224 if (anorm < 1.) {
00225
00226 d__1 = wnorm, d__2 = *n * anorm;
00227 result[1] = min(d__1,d__2) / anorm / (*n * ulp);
00228 } else {
00229
00230 d__1 = wnorm / anorm, d__2 = (doublereal) (*n);
00231 result[1] = min(d__1,d__2) / (*n * ulp);
00232 }
00233 }
00234
00235
00236
00237
00238
00239 zgemm_("N", "C", n, n, n, &c_b2, &u[u_offset], ldu, &u[u_offset], ldu, &
00240 c_b1, &work[1], n);
00241
00242 i__1 = *n;
00243 for (j = 1; j <= i__1; ++j) {
00244 i__2 = (*n + 1) * (j - 1) + 1;
00245 i__3 = (*n + 1) * (j - 1) + 1;
00246 z__1.r = work[i__3].r - 1., z__1.i = work[i__3].i - 0.;
00247 work[i__2].r = z__1.r, work[i__2].i = z__1.i;
00248
00249 }
00250
00251
00252 d__1 = (doublereal) (*n), d__2 = zlange_("1", n, n, &work[1], n, &rwork[1]
00253 );
00254 result[2] = min(d__1,d__2) / (*n * ulp);
00255
00256 return 0;
00257
00258
00259
00260 }