3 /* Subroutine */ int dtrmv_(char *uplo, char *trans, char *diag, integer *n,
4 doublereal *a, integer *lda, doublereal *x, integer *incx)
6 /* System generated locals */
7 integer a_dim1, a_offset, i__1, i__2;
10 integer i__, j, ix, jx, kx, info;
12 extern logical lsame_(char *, char *);
13 extern /* Subroutine */ int xerbla_(char *, integer *);
16 /* .. Scalar Arguments .. */
18 /* .. Array Arguments .. */
24 /* DTRMV performs one of the matrix-vector operations */
26 /* x := A*x, or x := A'*x, */
28 /* where x is an n element vector and A is an n by n unit, or non-unit, */
29 /* upper or lower triangular matrix. */
34 /* UPLO - CHARACTER*1. */
35 /* On entry, UPLO specifies whether the matrix is an upper or */
36 /* lower triangular matrix as follows: */
38 /* UPLO = 'U' or 'u' A is an upper triangular matrix. */
40 /* UPLO = 'L' or 'l' A is a lower triangular matrix. */
42 /* Unchanged on exit. */
44 /* TRANS - CHARACTER*1. */
45 /* On entry, TRANS specifies the operation to be performed as */
48 /* TRANS = 'N' or 'n' x := A*x. */
50 /* TRANS = 'T' or 't' x := A'*x. */
52 /* TRANS = 'C' or 'c' x := A'*x. */
54 /* Unchanged on exit. */
56 /* DIAG - CHARACTER*1. */
57 /* On entry, DIAG specifies whether or not A is unit */
58 /* triangular as follows: */
60 /* DIAG = 'U' or 'u' A is assumed to be unit triangular. */
62 /* DIAG = 'N' or 'n' A is not assumed to be unit */
65 /* Unchanged on exit. */
68 /* On entry, N specifies the order of the matrix A. */
69 /* N must be at least zero. */
70 /* Unchanged on exit. */
72 /* A - DOUBLE PRECISION array of DIMENSION ( LDA, n ). */
73 /* Before entry with UPLO = 'U' or 'u', the leading n by n */
74 /* upper triangular part of the array A must contain the upper */
75 /* triangular matrix and the strictly lower triangular part of */
76 /* A is not referenced. */
77 /* Before entry with UPLO = 'L' or 'l', the leading n by n */
78 /* lower triangular part of the array A must contain the lower */
79 /* triangular matrix and the strictly upper triangular part of */
80 /* A is not referenced. */
81 /* Note that when DIAG = 'U' or 'u', the diagonal elements of */
82 /* A are not referenced either, but are assumed to be unity. */
83 /* Unchanged on exit. */
86 /* On entry, LDA specifies the first dimension of A as declared */
87 /* in the calling (sub) program. LDA must be at least */
89 /* Unchanged on exit. */
91 /* X - DOUBLE PRECISION array of dimension at least */
92 /* ( 1 + ( n - 1 )*abs( INCX ) ). */
93 /* Before entry, the incremented array X must contain the n */
94 /* element vector x. On exit, X is overwritten with the */
95 /* tranformed vector x. */
98 /* On entry, INCX specifies the increment for the elements of */
99 /* X. INCX must not be zero. */
100 /* Unchanged on exit. */
103 /* Level 2 Blas routine. */
105 /* -- Written on 22-October-1986. */
106 /* Jack Dongarra, Argonne National Lab. */
107 /* Jeremy Du Croz, Nag Central Office. */
108 /* Sven Hammarling, Nag Central Office. */
109 /* Richard Hanson, Sandia National Labs. */
112 /* .. Parameters .. */
114 /* .. Local Scalars .. */
116 /* .. External Functions .. */
118 /* .. External Subroutines .. */
120 /* .. Intrinsic Functions .. */
123 /* Test the input parameters. */
125 /* Parameter adjustments */
127 a_offset = 1 + a_dim1;
133 if (! lsame_(uplo, "U") && ! lsame_(uplo, "L")) {
135 } else if (! lsame_(trans, "N") && ! lsame_(trans,
136 "T") && ! lsame_(trans, "C")) {
138 } else if (! lsame_(diag, "U") && ! lsame_(diag,
143 } else if (*lda < max(1,*n)) {
145 } else if (*incx == 0) {
149 xerbla_("DTRMV ", &info);
153 /* Quick return if possible. */
159 nounit = lsame_(diag, "N");
161 /* Set up the start point in X if the increment is not unity. This */
162 /* will be ( N - 1 )*INCX too small for descending loops. */
165 kx = 1 - (*n - 1) * *incx;
166 } else if (*incx != 1) {
170 /* Start the operations. In this version the elements of A are */
171 /* accessed sequentially with one pass through A. */
173 if (lsame_(trans, "N")) {
177 if (lsame_(uplo, "U")) {
180 for (j = 1; j <= i__1; ++j) {
184 for (i__ = 1; i__ <= i__2; ++i__) {
185 x[i__] += temp * a[i__ + j * a_dim1];
189 x[j] *= a[j + j * a_dim1];
197 for (j = 1; j <= i__1; ++j) {
202 for (i__ = 1; i__ <= i__2; ++i__) {
203 x[ix] += temp * a[i__ + j * a_dim1];
208 x[jx] *= a[j + j * a_dim1];
217 for (j = *n; j >= 1; --j) {
221 for (i__ = *n; i__ >= i__1; --i__) {
222 x[i__] += temp * a[i__ + j * a_dim1];
226 x[j] *= a[j + j * a_dim1];
232 kx += (*n - 1) * *incx;
234 for (j = *n; j >= 1; --j) {
239 for (i__ = *n; i__ >= i__1; --i__) {
240 x[ix] += temp * a[i__ + j * a_dim1];
245 x[jx] *= a[j + j * a_dim1];
255 /* Form x := A'*x. */
257 if (lsame_(uplo, "U")) {
259 for (j = *n; j >= 1; --j) {
262 temp *= a[j + j * a_dim1];
264 for (i__ = j - 1; i__ >= 1; --i__) {
265 temp += a[i__ + j * a_dim1] * x[i__];
272 jx = kx + (*n - 1) * *incx;
273 for (j = *n; j >= 1; --j) {
277 temp *= a[j + j * a_dim1];
279 for (i__ = j - 1; i__ >= 1; --i__) {
281 temp += a[i__ + j * a_dim1] * x[ix];
292 for (j = 1; j <= i__1; ++j) {
295 temp *= a[j + j * a_dim1];
298 for (i__ = j + 1; i__ <= i__2; ++i__) {
299 temp += a[i__ + j * a_dim1] * x[i__];
308 for (j = 1; j <= i__1; ++j) {
312 temp *= a[j + j * a_dim1];
315 for (i__ = j + 1; i__ <= i__2; ++i__) {
317 temp += a[i__ + j * a_dim1] * x[ix];