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
00021 int zstt22_(integer *n, integer *m, integer *kband,
00022 doublereal *ad, doublereal *ae, doublereal *sd, doublereal *se,
00023 doublecomplex *u, integer *ldu, doublecomplex *work, integer *ldwork,
00024 doublereal *rwork, doublereal *result)
00025 {
00026
00027 integer u_dim1, u_offset, work_dim1, work_offset, i__1, i__2, i__3, i__4,
00028 i__5, i__6;
00029 doublereal d__1, d__2, d__3, d__4, d__5;
00030 doublecomplex z__1, z__2;
00031
00032
00033 integer i__, j, k;
00034 doublereal ulp;
00035 doublecomplex aukj;
00036 doublereal unfl, anorm;
00037 extern int zgemm_(char *, char *, integer *, integer *,
00038 integer *, doublecomplex *, doublecomplex *, integer *,
00039 doublecomplex *, integer *, doublecomplex *, doublecomplex *,
00040 integer *);
00041 doublereal wnorm;
00042 extern doublereal dlamch_(char *), zlange_(char *, integer *,
00043 integer *, doublecomplex *, integer *, doublereal *),
00044 zlansy_(char *, char *, integer *, doublecomplex *, integer *,
00045 doublereal *);
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
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138 --ad;
00139 --ae;
00140 --sd;
00141 --se;
00142 u_dim1 = *ldu;
00143 u_offset = 1 + u_dim1;
00144 u -= u_offset;
00145 work_dim1 = *ldwork;
00146 work_offset = 1 + work_dim1;
00147 work -= work_offset;
00148 --rwork;
00149 --result;
00150
00151
00152 result[1] = 0.;
00153 result[2] = 0.;
00154 if (*n <= 0 || *m <= 0) {
00155 return 0;
00156 }
00157
00158 unfl = dlamch_("Safe minimum");
00159 ulp = dlamch_("Epsilon");
00160
00161
00162
00163
00164
00165 if (*n > 1) {
00166 anorm = abs(ad[1]) + abs(ae[1]);
00167 i__1 = *n - 1;
00168 for (j = 2; j <= i__1; ++j) {
00169
00170 d__4 = anorm, d__5 = (d__1 = ad[j], abs(d__1)) + (d__2 = ae[j],
00171 abs(d__2)) + (d__3 = ae[j - 1], abs(d__3));
00172 anorm = max(d__4,d__5);
00173
00174 }
00175
00176 d__3 = anorm, d__4 = (d__1 = ad[*n], abs(d__1)) + (d__2 = ae[*n - 1],
00177 abs(d__2));
00178 anorm = max(d__3,d__4);
00179 } else {
00180 anorm = abs(ad[1]);
00181 }
00182 anorm = max(anorm,unfl);
00183
00184
00185
00186 i__1 = *m;
00187 for (i__ = 1; i__ <= i__1; ++i__) {
00188 i__2 = *m;
00189 for (j = 1; j <= i__2; ++j) {
00190 i__3 = i__ + j * work_dim1;
00191 work[i__3].r = 0., work[i__3].i = 0.;
00192 i__3 = *n;
00193 for (k = 1; k <= i__3; ++k) {
00194 i__4 = k;
00195 i__5 = k + j * u_dim1;
00196 z__1.r = ad[i__4] * u[i__5].r, z__1.i = ad[i__4] * u[i__5].i;
00197 aukj.r = z__1.r, aukj.i = z__1.i;
00198 if (k != *n) {
00199 i__4 = k;
00200 i__5 = k + 1 + j * u_dim1;
00201 z__2.r = ae[i__4] * u[i__5].r, z__2.i = ae[i__4] * u[i__5]
00202 .i;
00203 z__1.r = aukj.r + z__2.r, z__1.i = aukj.i + z__2.i;
00204 aukj.r = z__1.r, aukj.i = z__1.i;
00205 }
00206 if (k != 1) {
00207 i__4 = k - 1;
00208 i__5 = k - 1 + j * u_dim1;
00209 z__2.r = ae[i__4] * u[i__5].r, z__2.i = ae[i__4] * u[i__5]
00210 .i;
00211 z__1.r = aukj.r + z__2.r, z__1.i = aukj.i + z__2.i;
00212 aukj.r = z__1.r, aukj.i = z__1.i;
00213 }
00214 i__4 = i__ + j * work_dim1;
00215 i__5 = i__ + j * work_dim1;
00216 i__6 = k + i__ * u_dim1;
00217 z__2.r = u[i__6].r * aukj.r - u[i__6].i * aukj.i, z__2.i = u[
00218 i__6].r * aukj.i + u[i__6].i * aukj.r;
00219 z__1.r = work[i__5].r + z__2.r, z__1.i = work[i__5].i +
00220 z__2.i;
00221 work[i__4].r = z__1.r, work[i__4].i = z__1.i;
00222
00223 }
00224
00225 }
00226 i__2 = i__ + i__ * work_dim1;
00227 i__3 = i__ + i__ * work_dim1;
00228 i__4 = i__;
00229 z__1.r = work[i__3].r - sd[i__4], z__1.i = work[i__3].i;
00230 work[i__2].r = z__1.r, work[i__2].i = z__1.i;
00231 if (*kband == 1) {
00232 if (i__ != 1) {
00233 i__2 = i__ + (i__ - 1) * work_dim1;
00234 i__3 = i__ + (i__ - 1) * work_dim1;
00235 i__4 = i__ - 1;
00236 z__1.r = work[i__3].r - se[i__4], z__1.i = work[i__3].i;
00237 work[i__2].r = z__1.r, work[i__2].i = z__1.i;
00238 }
00239 if (i__ != *n) {
00240 i__2 = i__ + (i__ + 1) * work_dim1;
00241 i__3 = i__ + (i__ + 1) * work_dim1;
00242 i__4 = i__;
00243 z__1.r = work[i__3].r - se[i__4], z__1.i = work[i__3].i;
00244 work[i__2].r = z__1.r, work[i__2].i = z__1.i;
00245 }
00246 }
00247
00248 }
00249
00250 wnorm = zlansy_("1", "L", m, &work[work_offset], m, &rwork[1]);
00251
00252 if (anorm > wnorm) {
00253 result[1] = wnorm / anorm / (*m * ulp);
00254 } else {
00255 if (anorm < 1.) {
00256
00257 d__1 = wnorm, d__2 = *m * anorm;
00258 result[1] = min(d__1,d__2) / anorm / (*m * ulp);
00259 } else {
00260
00261 d__1 = wnorm / anorm, d__2 = (doublereal) (*m);
00262 result[1] = min(d__1,d__2) / (*m * ulp);
00263 }
00264 }
00265
00266
00267
00268
00269
00270 zgemm_("T", "N", m, m, n, &c_b2, &u[u_offset], ldu, &u[u_offset], ldu, &
00271 c_b1, &work[work_offset], m);
00272
00273 i__1 = *m;
00274 for (j = 1; j <= i__1; ++j) {
00275 i__2 = j + j * work_dim1;
00276 i__3 = j + j * work_dim1;
00277 z__1.r = work[i__3].r - 1., z__1.i = work[i__3].i;
00278 work[i__2].r = z__1.r, work[i__2].i = z__1.i;
00279
00280 }
00281
00282
00283 d__1 = (doublereal) (*m), d__2 = zlange_("1", m, m, &work[work_offset], m,
00284 &rwork[1]);
00285 result[2] = min(d__1,d__2) / (*m * ulp);
00286
00287 return 0;
00288
00289
00290
00291 }