comparison ext/cblas/src/dtrmv.c @ 430:335af74a25b6

Merge from branch clapack-included
author Chris Cannam <c.cannam@qmul.ac.uk>
date Fri, 30 Sep 2016 16:24:24 +0100
parents 905e45637745
children
comparison
equal deleted inserted replaced
426:a23b9f8b4a59 430:335af74a25b6
1 /* dtrmv.f -- translated by f2c (version 20061008).
2 You must link the resulting object file with libf2c:
3 on Microsoft Windows system, link with libf2c.lib;
4 on Linux or Unix systems, link with .../path/to/libf2c.a -lm
5 or, if you install libf2c.a in a standard place, with -lf2c -lm
6 -- in that order, at the end of the command line, as in
7 cc *.o -lf2c -lm
8 Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
9
10 http://www.netlib.org/f2c/libf2c.zip
11 */
12
13 #include "f2c.h"
14 #include "blaswrap.h"
15
16 /* Subroutine */ int dtrmv_(char *uplo, char *trans, char *diag, integer *n,
17 doublereal *a, integer *lda, doublereal *x, integer *incx)
18 {
19 /* System generated locals */
20 integer a_dim1, a_offset, i__1, i__2;
21
22 /* Local variables */
23 integer i__, j, ix, jx, kx, info;
24 doublereal temp;
25 extern logical lsame_(char *, char *);
26 extern /* Subroutine */ int xerbla_(char *, integer *);
27 logical nounit;
28
29 /* .. Scalar Arguments .. */
30 /* .. */
31 /* .. Array Arguments .. */
32 /* .. */
33
34 /* Purpose */
35 /* ======= */
36
37 /* DTRMV performs one of the matrix-vector operations */
38
39 /* x := A*x, or x := A'*x, */
40
41 /* where x is an n element vector and A is an n by n unit, or non-unit, */
42 /* upper or lower triangular matrix. */
43
44 /* Arguments */
45 /* ========== */
46
47 /* UPLO - CHARACTER*1. */
48 /* On entry, UPLO specifies whether the matrix is an upper or */
49 /* lower triangular matrix as follows: */
50
51 /* UPLO = 'U' or 'u' A is an upper triangular matrix. */
52
53 /* UPLO = 'L' or 'l' A is a lower triangular matrix. */
54
55 /* Unchanged on exit. */
56
57 /* TRANS - CHARACTER*1. */
58 /* On entry, TRANS specifies the operation to be performed as */
59 /* follows: */
60
61 /* TRANS = 'N' or 'n' x := A*x. */
62
63 /* TRANS = 'T' or 't' x := A'*x. */
64
65 /* TRANS = 'C' or 'c' x := A'*x. */
66
67 /* Unchanged on exit. */
68
69 /* DIAG - CHARACTER*1. */
70 /* On entry, DIAG specifies whether or not A is unit */
71 /* triangular as follows: */
72
73 /* DIAG = 'U' or 'u' A is assumed to be unit triangular. */
74
75 /* DIAG = 'N' or 'n' A is not assumed to be unit */
76 /* triangular. */
77
78 /* Unchanged on exit. */
79
80 /* N - INTEGER. */
81 /* On entry, N specifies the order of the matrix A. */
82 /* N must be at least zero. */
83 /* Unchanged on exit. */
84
85 /* A - DOUBLE PRECISION array of DIMENSION ( LDA, n ). */
86 /* Before entry with UPLO = 'U' or 'u', the leading n by n */
87 /* upper triangular part of the array A must contain the upper */
88 /* triangular matrix and the strictly lower triangular part of */
89 /* A is not referenced. */
90 /* Before entry with UPLO = 'L' or 'l', the leading n by n */
91 /* lower triangular part of the array A must contain the lower */
92 /* triangular matrix and the strictly upper triangular part of */
93 /* A is not referenced. */
94 /* Note that when DIAG = 'U' or 'u', the diagonal elements of */
95 /* A are not referenced either, but are assumed to be unity. */
96 /* Unchanged on exit. */
97
98 /* LDA - INTEGER. */
99 /* On entry, LDA specifies the first dimension of A as declared */
100 /* in the calling (sub) program. LDA must be at least */
101 /* max( 1, n ). */
102 /* Unchanged on exit. */
103
104 /* X - DOUBLE PRECISION array of dimension at least */
105 /* ( 1 + ( n - 1 )*abs( INCX ) ). */
106 /* Before entry, the incremented array X must contain the n */
107 /* element vector x. On exit, X is overwritten with the */
108 /* tranformed vector x. */
109
110 /* INCX - INTEGER. */
111 /* On entry, INCX specifies the increment for the elements of */
112 /* X. INCX must not be zero. */
113 /* Unchanged on exit. */
114
115
116 /* Level 2 Blas routine. */
117
118 /* -- Written on 22-October-1986. */
119 /* Jack Dongarra, Argonne National Lab. */
120 /* Jeremy Du Croz, Nag Central Office. */
121 /* Sven Hammarling, Nag Central Office. */
122 /* Richard Hanson, Sandia National Labs. */
123
124
125 /* .. Parameters .. */
126 /* .. */
127 /* .. Local Scalars .. */
128 /* .. */
129 /* .. External Functions .. */
130 /* .. */
131 /* .. External Subroutines .. */
132 /* .. */
133 /* .. Intrinsic Functions .. */
134 /* .. */
135
136 /* Test the input parameters. */
137
138 /* Parameter adjustments */
139 a_dim1 = *lda;
140 a_offset = 1 + a_dim1;
141 a -= a_offset;
142 --x;
143
144 /* Function Body */
145 info = 0;
146 if (! lsame_(uplo, "U") && ! lsame_(uplo, "L")) {
147 info = 1;
148 } else if (! lsame_(trans, "N") && ! lsame_(trans,
149 "T") && ! lsame_(trans, "C")) {
150 info = 2;
151 } else if (! lsame_(diag, "U") && ! lsame_(diag,
152 "N")) {
153 info = 3;
154 } else if (*n < 0) {
155 info = 4;
156 } else if (*lda < max(1,*n)) {
157 info = 6;
158 } else if (*incx == 0) {
159 info = 8;
160 }
161 if (info != 0) {
162 xerbla_("DTRMV ", &info);
163 return 0;
164 }
165
166 /* Quick return if possible. */
167
168 if (*n == 0) {
169 return 0;
170 }
171
172 nounit = lsame_(diag, "N");
173
174 /* Set up the start point in X if the increment is not unity. This */
175 /* will be ( N - 1 )*INCX too small for descending loops. */
176
177 if (*incx <= 0) {
178 kx = 1 - (*n - 1) * *incx;
179 } else if (*incx != 1) {
180 kx = 1;
181 }
182
183 /* Start the operations. In this version the elements of A are */
184 /* accessed sequentially with one pass through A. */
185
186 if (lsame_(trans, "N")) {
187
188 /* Form x := A*x. */
189
190 if (lsame_(uplo, "U")) {
191 if (*incx == 1) {
192 i__1 = *n;
193 for (j = 1; j <= i__1; ++j) {
194 if (x[j] != 0.) {
195 temp = x[j];
196 i__2 = j - 1;
197 for (i__ = 1; i__ <= i__2; ++i__) {
198 x[i__] += temp * a[i__ + j * a_dim1];
199 /* L10: */
200 }
201 if (nounit) {
202 x[j] *= a[j + j * a_dim1];
203 }
204 }
205 /* L20: */
206 }
207 } else {
208 jx = kx;
209 i__1 = *n;
210 for (j = 1; j <= i__1; ++j) {
211 if (x[jx] != 0.) {
212 temp = x[jx];
213 ix = kx;
214 i__2 = j - 1;
215 for (i__ = 1; i__ <= i__2; ++i__) {
216 x[ix] += temp * a[i__ + j * a_dim1];
217 ix += *incx;
218 /* L30: */
219 }
220 if (nounit) {
221 x[jx] *= a[j + j * a_dim1];
222 }
223 }
224 jx += *incx;
225 /* L40: */
226 }
227 }
228 } else {
229 if (*incx == 1) {
230 for (j = *n; j >= 1; --j) {
231 if (x[j] != 0.) {
232 temp = x[j];
233 i__1 = j + 1;
234 for (i__ = *n; i__ >= i__1; --i__) {
235 x[i__] += temp * a[i__ + j * a_dim1];
236 /* L50: */
237 }
238 if (nounit) {
239 x[j] *= a[j + j * a_dim1];
240 }
241 }
242 /* L60: */
243 }
244 } else {
245 kx += (*n - 1) * *incx;
246 jx = kx;
247 for (j = *n; j >= 1; --j) {
248 if (x[jx] != 0.) {
249 temp = x[jx];
250 ix = kx;
251 i__1 = j + 1;
252 for (i__ = *n; i__ >= i__1; --i__) {
253 x[ix] += temp * a[i__ + j * a_dim1];
254 ix -= *incx;
255 /* L70: */
256 }
257 if (nounit) {
258 x[jx] *= a[j + j * a_dim1];
259 }
260 }
261 jx -= *incx;
262 /* L80: */
263 }
264 }
265 }
266 } else {
267
268 /* Form x := A'*x. */
269
270 if (lsame_(uplo, "U")) {
271 if (*incx == 1) {
272 for (j = *n; j >= 1; --j) {
273 temp = x[j];
274 if (nounit) {
275 temp *= a[j + j * a_dim1];
276 }
277 for (i__ = j - 1; i__ >= 1; --i__) {
278 temp += a[i__ + j * a_dim1] * x[i__];
279 /* L90: */
280 }
281 x[j] = temp;
282 /* L100: */
283 }
284 } else {
285 jx = kx + (*n - 1) * *incx;
286 for (j = *n; j >= 1; --j) {
287 temp = x[jx];
288 ix = jx;
289 if (nounit) {
290 temp *= a[j + j * a_dim1];
291 }
292 for (i__ = j - 1; i__ >= 1; --i__) {
293 ix -= *incx;
294 temp += a[i__ + j * a_dim1] * x[ix];
295 /* L110: */
296 }
297 x[jx] = temp;
298 jx -= *incx;
299 /* L120: */
300 }
301 }
302 } else {
303 if (*incx == 1) {
304 i__1 = *n;
305 for (j = 1; j <= i__1; ++j) {
306 temp = x[j];
307 if (nounit) {
308 temp *= a[j + j * a_dim1];
309 }
310 i__2 = *n;
311 for (i__ = j + 1; i__ <= i__2; ++i__) {
312 temp += a[i__ + j * a_dim1] * x[i__];
313 /* L130: */
314 }
315 x[j] = temp;
316 /* L140: */
317 }
318 } else {
319 jx = kx;
320 i__1 = *n;
321 for (j = 1; j <= i__1; ++j) {
322 temp = x[jx];
323 ix = jx;
324 if (nounit) {
325 temp *= a[j + j * a_dim1];
326 }
327 i__2 = *n;
328 for (i__ = j + 1; i__ <= i__2; ++i__) {
329 ix += *incx;
330 temp += a[i__ + j * a_dim1] * x[ix];
331 /* L150: */
332 }
333 x[jx] = temp;
334 jx += *incx;
335 /* L160: */
336 }
337 }
338 }
339 }
340
341 return 0;
342
343 /* End of DTRMV . */
344
345 } /* dtrmv_ */