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 int strt05_(char *uplo, char *trans, char *diag, integer *n,
00021 integer *nrhs, real *a, integer *lda, real *b, integer *ldb, real *x,
00022 integer *ldx, real *xact, integer *ldxact, real *ferr, real *berr,
00023 real *reslts)
00024 {
00025
00026 integer a_dim1, a_offset, b_dim1, b_offset, x_dim1, x_offset, xact_dim1,
00027 xact_offset, i__1, i__2, i__3;
00028 real r__1, r__2, r__3;
00029
00030
00031 integer i__, j, k, ifu;
00032 real eps, tmp, diff, axbi;
00033 integer imax;
00034 real unfl, ovfl;
00035 logical unit;
00036 extern logical lsame_(char *, char *);
00037 logical upper;
00038 real xnorm;
00039 extern doublereal slamch_(char *);
00040 real errbnd;
00041 extern integer isamax_(integer *, real *, integer *);
00042 logical notran;
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
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162 a_dim1 = *lda;
00163 a_offset = 1 + a_dim1;
00164 a -= a_offset;
00165 b_dim1 = *ldb;
00166 b_offset = 1 + b_dim1;
00167 b -= b_offset;
00168 x_dim1 = *ldx;
00169 x_offset = 1 + x_dim1;
00170 x -= x_offset;
00171 xact_dim1 = *ldxact;
00172 xact_offset = 1 + xact_dim1;
00173 xact -= xact_offset;
00174 --ferr;
00175 --berr;
00176 --reslts;
00177
00178
00179 if (*n <= 0 || *nrhs <= 0) {
00180 reslts[1] = 0.f;
00181 reslts[2] = 0.f;
00182 return 0;
00183 }
00184
00185 eps = slamch_("Epsilon");
00186 unfl = slamch_("Safe minimum");
00187 ovfl = 1.f / unfl;
00188 upper = lsame_(uplo, "U");
00189 notran = lsame_(trans, "N");
00190 unit = lsame_(diag, "U");
00191
00192
00193
00194
00195
00196 errbnd = 0.f;
00197 i__1 = *nrhs;
00198 for (j = 1; j <= i__1; ++j) {
00199 imax = isamax_(n, &x[j * x_dim1 + 1], &c__1);
00200
00201 r__2 = (r__1 = x[imax + j * x_dim1], dabs(r__1));
00202 xnorm = dmax(r__2,unfl);
00203 diff = 0.f;
00204 i__2 = *n;
00205 for (i__ = 1; i__ <= i__2; ++i__) {
00206
00207 r__2 = diff, r__3 = (r__1 = x[i__ + j * x_dim1] - xact[i__ + j *
00208 xact_dim1], dabs(r__1));
00209 diff = dmax(r__2,r__3);
00210
00211 }
00212
00213 if (xnorm > 1.f) {
00214 goto L20;
00215 } else if (diff <= ovfl * xnorm) {
00216 goto L20;
00217 } else {
00218 errbnd = 1.f / eps;
00219 goto L30;
00220 }
00221
00222 L20:
00223 if (diff / xnorm <= ferr[j]) {
00224
00225 r__1 = errbnd, r__2 = diff / xnorm / ferr[j];
00226 errbnd = dmax(r__1,r__2);
00227 } else {
00228 errbnd = 1.f / eps;
00229 }
00230 L30:
00231 ;
00232 }
00233 reslts[1] = errbnd;
00234
00235
00236
00237
00238 ifu = 0;
00239 if (unit) {
00240 ifu = 1;
00241 }
00242 i__1 = *nrhs;
00243 for (k = 1; k <= i__1; ++k) {
00244 i__2 = *n;
00245 for (i__ = 1; i__ <= i__2; ++i__) {
00246 tmp = (r__1 = b[i__ + k * b_dim1], dabs(r__1));
00247 if (upper) {
00248 if (! notran) {
00249 i__3 = i__ - ifu;
00250 for (j = 1; j <= i__3; ++j) {
00251 tmp += (r__1 = a[j + i__ * a_dim1], dabs(r__1)) * (
00252 r__2 = x[j + k * x_dim1], dabs(r__2));
00253
00254 }
00255 if (unit) {
00256 tmp += (r__1 = x[i__ + k * x_dim1], dabs(r__1));
00257 }
00258 } else {
00259 if (unit) {
00260 tmp += (r__1 = x[i__ + k * x_dim1], dabs(r__1));
00261 }
00262 i__3 = *n;
00263 for (j = i__ + ifu; j <= i__3; ++j) {
00264 tmp += (r__1 = a[i__ + j * a_dim1], dabs(r__1)) * (
00265 r__2 = x[j + k * x_dim1], dabs(r__2));
00266
00267 }
00268 }
00269 } else {
00270 if (notran) {
00271 i__3 = i__ - ifu;
00272 for (j = 1; j <= i__3; ++j) {
00273 tmp += (r__1 = a[i__ + j * a_dim1], dabs(r__1)) * (
00274 r__2 = x[j + k * x_dim1], dabs(r__2));
00275
00276 }
00277 if (unit) {
00278 tmp += (r__1 = x[i__ + k * x_dim1], dabs(r__1));
00279 }
00280 } else {
00281 if (unit) {
00282 tmp += (r__1 = x[i__ + k * x_dim1], dabs(r__1));
00283 }
00284 i__3 = *n;
00285 for (j = i__ + ifu; j <= i__3; ++j) {
00286 tmp += (r__1 = a[j + i__ * a_dim1], dabs(r__1)) * (
00287 r__2 = x[j + k * x_dim1], dabs(r__2));
00288
00289 }
00290 }
00291 }
00292 if (i__ == 1) {
00293 axbi = tmp;
00294 } else {
00295 axbi = dmin(axbi,tmp);
00296 }
00297
00298 }
00299
00300 r__1 = axbi, r__2 = (*n + 1) * unfl;
00301 tmp = berr[k] / ((*n + 1) * eps + (*n + 1) * unfl / dmax(r__1,r__2));
00302 if (k == 1) {
00303 reslts[2] = tmp;
00304 } else {
00305 reslts[2] = dmax(reslts[2],tmp);
00306 }
00307
00308 }
00309
00310 return 0;
00311
00312
00313
00314 }