Debian Codegraph @

debian/external_deps/fetk/punc/src/blas/strmv.c

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