00001
00002
00003
00004
00005
00006 #include "f2c.h"
00007
00008
00009
00010
00011 int dtrsv_(uplo, trans, diag, n, a, lda, x, incx, uplo_len,
00012 trans_len, diag_len)
00013 char *uplo, *trans, *diag;
00014 integer *n;
00015 doublereal *a;
00016 integer *lda;
00017 doublereal *x;
00018 integer *incx;
00019 ftnlen uplo_len;
00020 ftnlen trans_len;
00021 ftnlen diag_len;
00022 {
00023
00024 integer a_dim1, a_offset, i__1, i__2;
00025
00026
00027 static integer info;
00028 static doublereal temp;
00029 static integer i, j;
00030 extern logical lsame_();
00031 static integer ix, jx, kx;
00032 extern int xerbla_();
00033 static logical nounit;
00034
00035
00036
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
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 a_dim1 = *lda;
00152 a_offset = a_dim1 + 1;
00153 a -= a_offset;
00154 --x;
00155
00156
00157 info = 0;
00158 if (! lsame_(uplo, "U", 1L, 1L) && ! lsame_(uplo, "L", 1L, 1L)) {
00159 info = 1;
00160 } else if (! lsame_(trans, "N", 1L, 1L) && ! lsame_(trans, "T", 1L, 1L) &&
00161 ! lsame_(trans, "C", 1L, 1L)) {
00162 info = 2;
00163 } else if (! lsame_(diag, "U", 1L, 1L) && ! lsame_(diag, "N", 1L, 1L)) {
00164 info = 3;
00165 } else if (*n < 0) {
00166 info = 4;
00167 } else if (*lda < max(1,*n)) {
00168 info = 6;
00169 } else if (*incx == 0) {
00170 info = 8;
00171 }
00172 if (info != 0) {
00173 xerbla_("DTRSV ", &info, 6L);
00174 return 0;
00175 }
00176
00177
00178
00179 if (*n == 0) {
00180 return 0;
00181 }
00182
00183 nounit = lsame_(diag, "N", 1L, 1L);
00184
00185
00186
00187
00188 if (*incx <= 0) {
00189 kx = 1 - (*n - 1) * *incx;
00190 } else if (*incx != 1) {
00191 kx = 1;
00192 }
00193
00194
00195
00196
00197 if (lsame_(trans, "N", 1L, 1L)) {
00198
00199
00200
00201 if (lsame_(uplo, "U", 1L, 1L)) {
00202 if (*incx == 1) {
00203 for (j = *n; j >= 1; --j) {
00204 if (x[j] != 0.) {
00205 if (nounit) {
00206 x[j] /= a[j + j * a_dim1];
00207 }
00208 temp = x[j];
00209 for (i = j - 1; i >= 1; --i) {
00210 x[i] -= temp * a[i + j * a_dim1];
00211
00212 }
00213 }
00214
00215 }
00216 } else {
00217 jx = kx + (*n - 1) * *incx;
00218 for (j = *n; j >= 1; --j) {
00219 if (x[jx] != 0.) {
00220 if (nounit) {
00221 x[jx] /= a[j + j * a_dim1];
00222 }
00223 temp = x[jx];
00224 ix = jx;
00225 for (i = j - 1; i >= 1; --i) {
00226 ix -= *incx;
00227 x[ix] -= temp * a[i + j * a_dim1];
00228
00229 }
00230 }
00231 jx -= *incx;
00232
00233 }
00234 }
00235 } else {
00236 if (*incx == 1) {
00237 i__1 = *n;
00238 for (j = 1; j <= i__1; ++j) {
00239 if (x[j] != 0.) {
00240 if (nounit) {
00241 x[j] /= a[j + j * a_dim1];
00242 }
00243 temp = x[j];
00244 i__2 = *n;
00245 for (i = j + 1; i <= i__2; ++i) {
00246 x[i] -= temp * a[i + j * a_dim1];
00247
00248 }
00249 }
00250
00251 }
00252 } else {
00253 jx = kx;
00254 i__1 = *n;
00255 for (j = 1; j <= i__1; ++j) {
00256 if (x[jx] != 0.) {
00257 if (nounit) {
00258 x[jx] /= a[j + j * a_dim1];
00259 }
00260 temp = x[jx];
00261 ix = jx;
00262 i__2 = *n;
00263 for (i = j + 1; i <= i__2; ++i) {
00264 ix += *incx;
00265 x[ix] -= temp * a[i + j * a_dim1];
00266
00267 }
00268 }
00269 jx += *incx;
00270
00271 }
00272 }
00273 }
00274 } else {
00275
00276
00277
00278 if (lsame_(uplo, "U", 1L, 1L)) {
00279 if (*incx == 1) {
00280 i__1 = *n;
00281 for (j = 1; j <= i__1; ++j) {
00282 temp = x[j];
00283 i__2 = j - 1;
00284 for (i = 1; i <= i__2; ++i) {
00285 temp -= a[i + j * a_dim1] * x[i];
00286
00287 }
00288 if (nounit) {
00289 temp /= a[j + j * a_dim1];
00290 }
00291 x[j] = temp;
00292
00293 }
00294 } else {
00295 jx = kx;
00296 i__1 = *n;
00297 for (j = 1; j <= i__1; ++j) {
00298 temp = x[jx];
00299 ix = kx;
00300 i__2 = j - 1;
00301 for (i = 1; i <= i__2; ++i) {
00302 temp -= a[i + j * a_dim1] * x[ix];
00303 ix += *incx;
00304
00305 }
00306 if (nounit) {
00307 temp /= a[j + j * a_dim1];
00308 }
00309 x[jx] = temp;
00310 jx += *incx;
00311
00312 }
00313 }
00314 } else {
00315 if (*incx == 1) {
00316 for (j = *n; j >= 1; --j) {
00317 temp = x[j];
00318 i__1 = j + 1;
00319 for (i = *n; i >= i__1; --i) {
00320 temp -= a[i + j * a_dim1] * x[i];
00321
00322 }
00323 if (nounit) {
00324 temp /= a[j + j * a_dim1];
00325 }
00326 x[j] = temp;
00327
00328 }
00329 } else {
00330 kx += (*n - 1) * *incx;
00331 jx = kx;
00332 for (j = *n; j >= 1; --j) {
00333 temp = x[jx];
00334 ix = kx;
00335 i__1 = j + 1;
00336 for (i = *n; i >= i__1; --i) {
00337 temp -= a[i + j * a_dim1] * x[ix];
00338 ix -= *incx;
00339
00340 }
00341 if (nounit) {
00342 temp /= a[j + j * a_dim1];
00343 }
00344 x[jx] = temp;
00345 jx -= *incx;
00346
00347 }
00348 }
00349 }
00350 }
00351
00352 return 0;
00353
00354
00355
00356 }
00357