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 doublereal c_b12 = 1.;
00019 static doublereal c_b13 = 0.;
00020
00021 int dstt22_(integer *n, integer *m, integer *kband,
00022 doublereal *ad, doublereal *ae, doublereal *sd, doublereal *se,
00023 doublereal *u, integer *ldu, doublereal *work, integer *ldwork,
00024 doublereal *result)
00025 {
00026
00027 integer u_dim1, u_offset, work_dim1, work_offset, i__1, i__2, i__3;
00028 doublereal d__1, d__2, d__3, d__4, d__5;
00029
00030
00031 integer i__, j, k;
00032 doublereal ulp, aukj, unfl;
00033 extern int dgemm_(char *, char *, integer *, integer *,
00034 integer *, doublereal *, doublereal *, integer *, doublereal *,
00035 integer *, doublereal *, doublereal *, integer *);
00036 doublereal anorm, wnorm;
00037 extern doublereal dlamch_(char *), dlange_(char *, integer *,
00038 integer *, doublereal *, integer *, doublereal *),
00039 dlansy_(char *, char *, integer *, doublereal *, integer *,
00040 doublereal *);
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
00123
00124
00125
00126
00127
00128
00129
00130
00131 --ad;
00132 --ae;
00133 --sd;
00134 --se;
00135 u_dim1 = *ldu;
00136 u_offset = 1 + u_dim1;
00137 u -= u_offset;
00138 work_dim1 = *ldwork;
00139 work_offset = 1 + work_dim1;
00140 work -= work_offset;
00141 --result;
00142
00143
00144 result[1] = 0.;
00145 result[2] = 0.;
00146 if (*n <= 0 || *m <= 0) {
00147 return 0;
00148 }
00149
00150 unfl = dlamch_("Safe minimum");
00151 ulp = dlamch_("Epsilon");
00152
00153
00154
00155
00156
00157 if (*n > 1) {
00158 anorm = abs(ad[1]) + abs(ae[1]);
00159 i__1 = *n - 1;
00160 for (j = 2; j <= i__1; ++j) {
00161
00162 d__4 = anorm, d__5 = (d__1 = ad[j], abs(d__1)) + (d__2 = ae[j],
00163 abs(d__2)) + (d__3 = ae[j - 1], abs(d__3));
00164 anorm = max(d__4,d__5);
00165
00166 }
00167
00168 d__3 = anorm, d__4 = (d__1 = ad[*n], abs(d__1)) + (d__2 = ae[*n - 1],
00169 abs(d__2));
00170 anorm = max(d__3,d__4);
00171 } else {
00172 anorm = abs(ad[1]);
00173 }
00174 anorm = max(anorm,unfl);
00175
00176
00177
00178 i__1 = *m;
00179 for (i__ = 1; i__ <= i__1; ++i__) {
00180 i__2 = *m;
00181 for (j = 1; j <= i__2; ++j) {
00182 work[i__ + j * work_dim1] = 0.;
00183 i__3 = *n;
00184 for (k = 1; k <= i__3; ++k) {
00185 aukj = ad[k] * u[k + j * u_dim1];
00186 if (k != *n) {
00187 aukj += ae[k] * u[k + 1 + j * u_dim1];
00188 }
00189 if (k != 1) {
00190 aukj += ae[k - 1] * u[k - 1 + j * u_dim1];
00191 }
00192 work[i__ + j * work_dim1] += u[k + i__ * u_dim1] * aukj;
00193
00194 }
00195
00196 }
00197 work[i__ + i__ * work_dim1] -= sd[i__];
00198 if (*kband == 1) {
00199 if (i__ != 1) {
00200 work[i__ + (i__ - 1) * work_dim1] -= se[i__ - 1];
00201 }
00202 if (i__ != *n) {
00203 work[i__ + (i__ + 1) * work_dim1] -= se[i__];
00204 }
00205 }
00206
00207 }
00208
00209 wnorm = dlansy_("1", "L", m, &work[work_offset], m, &work[(*m + 1) *
00210 work_dim1 + 1]);
00211
00212 if (anorm > wnorm) {
00213 result[1] = wnorm / anorm / (*m * ulp);
00214 } else {
00215 if (anorm < 1.) {
00216
00217 d__1 = wnorm, d__2 = *m * anorm;
00218 result[1] = min(d__1,d__2) / anorm / (*m * ulp);
00219 } else {
00220
00221 d__1 = wnorm / anorm, d__2 = (doublereal) (*m);
00222 result[1] = min(d__1,d__2) / (*m * ulp);
00223 }
00224 }
00225
00226
00227
00228
00229
00230 dgemm_("T", "N", m, m, n, &c_b12, &u[u_offset], ldu, &u[u_offset], ldu, &
00231 c_b13, &work[work_offset], m);
00232
00233 i__1 = *m;
00234 for (j = 1; j <= i__1; ++j) {
00235 work[j + j * work_dim1] += -1.;
00236
00237 }
00238
00239
00240 d__1 = (doublereal) (*m), d__2 = dlange_("1", m, m, &work[work_offset], m,
00241 &work[(*m + 1) * work_dim1 + 1]);
00242 result[2] = min(d__1,d__2) / (*m * ulp);
00243
00244 return 0;
00245
00246
00247
00248 }