c@427
|
1 /* dgemv.f -- translated by f2c (version 20061008).
|
c@427
|
2 You must link the resulting object file with libf2c:
|
c@427
|
3 on Microsoft Windows system, link with libf2c.lib;
|
c@427
|
4 on Linux or Unix systems, link with .../path/to/libf2c.a -lm
|
c@427
|
5 or, if you install libf2c.a in a standard place, with -lf2c -lm
|
c@427
|
6 -- in that order, at the end of the command line, as in
|
c@427
|
7 cc *.o -lf2c -lm
|
c@427
|
8 Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
|
c@427
|
9
|
c@427
|
10 http://www.netlib.org/f2c/libf2c.zip
|
c@427
|
11 */
|
c@427
|
12
|
c@427
|
13 #include "f2c.h"
|
c@427
|
14 #include "blaswrap.h"
|
c@427
|
15
|
c@427
|
16 /* Subroutine */ int dgemv_(char *trans, integer *m, integer *n, doublereal *
|
c@427
|
17 alpha, doublereal *a, integer *lda, doublereal *x, integer *incx,
|
c@427
|
18 doublereal *beta, doublereal *y, integer *incy)
|
c@427
|
19 {
|
c@427
|
20 /* System generated locals */
|
c@427
|
21 integer a_dim1, a_offset, i__1, i__2;
|
c@427
|
22
|
c@427
|
23 /* Local variables */
|
c@427
|
24 integer i__, j, ix, iy, jx, jy, kx, ky, info;
|
c@427
|
25 doublereal temp;
|
c@427
|
26 integer lenx, leny;
|
c@427
|
27 extern logical lsame_(char *, char *);
|
c@427
|
28 extern /* Subroutine */ int xerbla_(char *, integer *);
|
c@427
|
29
|
c@427
|
30 /* .. Scalar Arguments .. */
|
c@427
|
31 /* .. */
|
c@427
|
32 /* .. Array Arguments .. */
|
c@427
|
33 /* .. */
|
c@427
|
34
|
c@427
|
35 /* Purpose */
|
c@427
|
36 /* ======= */
|
c@427
|
37
|
c@427
|
38 /* DGEMV performs one of the matrix-vector operations */
|
c@427
|
39
|
c@427
|
40 /* y := alpha*A*x + beta*y, or y := alpha*A'*x + beta*y, */
|
c@427
|
41
|
c@427
|
42 /* where alpha and beta are scalars, x and y are vectors and A is an */
|
c@427
|
43 /* m by n matrix. */
|
c@427
|
44
|
c@427
|
45 /* Arguments */
|
c@427
|
46 /* ========== */
|
c@427
|
47
|
c@427
|
48 /* TRANS - CHARACTER*1. */
|
c@427
|
49 /* On entry, TRANS specifies the operation to be performed as */
|
c@427
|
50 /* follows: */
|
c@427
|
51
|
c@427
|
52 /* TRANS = 'N' or 'n' y := alpha*A*x + beta*y. */
|
c@427
|
53
|
c@427
|
54 /* TRANS = 'T' or 't' y := alpha*A'*x + beta*y. */
|
c@427
|
55
|
c@427
|
56 /* TRANS = 'C' or 'c' y := alpha*A'*x + beta*y. */
|
c@427
|
57
|
c@427
|
58 /* Unchanged on exit. */
|
c@427
|
59
|
c@427
|
60 /* M - INTEGER. */
|
c@427
|
61 /* On entry, M specifies the number of rows of the matrix A. */
|
c@427
|
62 /* M must be at least zero. */
|
c@427
|
63 /* Unchanged on exit. */
|
c@427
|
64
|
c@427
|
65 /* N - INTEGER. */
|
c@427
|
66 /* On entry, N specifies the number of columns of the matrix A. */
|
c@427
|
67 /* N must be at least zero. */
|
c@427
|
68 /* Unchanged on exit. */
|
c@427
|
69
|
c@427
|
70 /* ALPHA - DOUBLE PRECISION. */
|
c@427
|
71 /* On entry, ALPHA specifies the scalar alpha. */
|
c@427
|
72 /* Unchanged on exit. */
|
c@427
|
73
|
c@427
|
74 /* A - DOUBLE PRECISION array of DIMENSION ( LDA, n ). */
|
c@427
|
75 /* Before entry, the leading m by n part of the array A must */
|
c@427
|
76 /* contain the matrix of coefficients. */
|
c@427
|
77 /* Unchanged on exit. */
|
c@427
|
78
|
c@427
|
79 /* LDA - INTEGER. */
|
c@427
|
80 /* On entry, LDA specifies the first dimension of A as declared */
|
c@427
|
81 /* in the calling (sub) program. LDA must be at least */
|
c@427
|
82 /* max( 1, m ). */
|
c@427
|
83 /* Unchanged on exit. */
|
c@427
|
84
|
c@427
|
85 /* X - DOUBLE PRECISION array of DIMENSION at least */
|
c@427
|
86 /* ( 1 + ( n - 1 )*abs( INCX ) ) when TRANS = 'N' or 'n' */
|
c@427
|
87 /* and at least */
|
c@427
|
88 /* ( 1 + ( m - 1 )*abs( INCX ) ) otherwise. */
|
c@427
|
89 /* Before entry, the incremented array X must contain the */
|
c@427
|
90 /* vector x. */
|
c@427
|
91 /* Unchanged on exit. */
|
c@427
|
92
|
c@427
|
93 /* INCX - INTEGER. */
|
c@427
|
94 /* On entry, INCX specifies the increment for the elements of */
|
c@427
|
95 /* X. INCX must not be zero. */
|
c@427
|
96 /* Unchanged on exit. */
|
c@427
|
97
|
c@427
|
98 /* BETA - DOUBLE PRECISION. */
|
c@427
|
99 /* On entry, BETA specifies the scalar beta. When BETA is */
|
c@427
|
100 /* supplied as zero then Y need not be set on input. */
|
c@427
|
101 /* Unchanged on exit. */
|
c@427
|
102
|
c@427
|
103 /* Y - DOUBLE PRECISION array of DIMENSION at least */
|
c@427
|
104 /* ( 1 + ( m - 1 )*abs( INCY ) ) when TRANS = 'N' or 'n' */
|
c@427
|
105 /* and at least */
|
c@427
|
106 /* ( 1 + ( n - 1 )*abs( INCY ) ) otherwise. */
|
c@427
|
107 /* Before entry with BETA non-zero, the incremented array Y */
|
c@427
|
108 /* must contain the vector y. On exit, Y is overwritten by the */
|
c@427
|
109 /* updated vector y. */
|
c@427
|
110
|
c@427
|
111 /* INCY - INTEGER. */
|
c@427
|
112 /* On entry, INCY specifies the increment for the elements of */
|
c@427
|
113 /* Y. INCY must not be zero. */
|
c@427
|
114 /* Unchanged on exit. */
|
c@427
|
115
|
c@427
|
116
|
c@427
|
117 /* Level 2 Blas routine. */
|
c@427
|
118
|
c@427
|
119 /* -- Written on 22-October-1986. */
|
c@427
|
120 /* Jack Dongarra, Argonne National Lab. */
|
c@427
|
121 /* Jeremy Du Croz, Nag Central Office. */
|
c@427
|
122 /* Sven Hammarling, Nag Central Office. */
|
c@427
|
123 /* Richard Hanson, Sandia National Labs. */
|
c@427
|
124
|
c@427
|
125
|
c@427
|
126 /* .. Parameters .. */
|
c@427
|
127 /* .. */
|
c@427
|
128 /* .. Local Scalars .. */
|
c@427
|
129 /* .. */
|
c@427
|
130 /* .. External Functions .. */
|
c@427
|
131 /* .. */
|
c@427
|
132 /* .. External Subroutines .. */
|
c@427
|
133 /* .. */
|
c@427
|
134 /* .. Intrinsic Functions .. */
|
c@427
|
135 /* .. */
|
c@427
|
136
|
c@427
|
137 /* Test the input parameters. */
|
c@427
|
138
|
c@427
|
139 /* Parameter adjustments */
|
c@427
|
140 a_dim1 = *lda;
|
c@427
|
141 a_offset = 1 + a_dim1;
|
c@427
|
142 a -= a_offset;
|
c@427
|
143 --x;
|
c@427
|
144 --y;
|
c@427
|
145
|
c@427
|
146 /* Function Body */
|
c@427
|
147 info = 0;
|
c@427
|
148 if (! lsame_(trans, "N") && ! lsame_(trans, "T") && ! lsame_(trans, "C")
|
c@427
|
149 ) {
|
c@427
|
150 info = 1;
|
c@427
|
151 } else if (*m < 0) {
|
c@427
|
152 info = 2;
|
c@427
|
153 } else if (*n < 0) {
|
c@427
|
154 info = 3;
|
c@427
|
155 } else if (*lda < max(1,*m)) {
|
c@427
|
156 info = 6;
|
c@427
|
157 } else if (*incx == 0) {
|
c@427
|
158 info = 8;
|
c@427
|
159 } else if (*incy == 0) {
|
c@427
|
160 info = 11;
|
c@427
|
161 }
|
c@427
|
162 if (info != 0) {
|
c@427
|
163 xerbla_("DGEMV ", &info);
|
c@427
|
164 return 0;
|
c@427
|
165 }
|
c@427
|
166
|
c@427
|
167 /* Quick return if possible. */
|
c@427
|
168
|
c@427
|
169 if (*m == 0 || *n == 0 || *alpha == 0. && *beta == 1.) {
|
c@427
|
170 return 0;
|
c@427
|
171 }
|
c@427
|
172
|
c@427
|
173 /* Set LENX and LENY, the lengths of the vectors x and y, and set */
|
c@427
|
174 /* up the start points in X and Y. */
|
c@427
|
175
|
c@427
|
176 if (lsame_(trans, "N")) {
|
c@427
|
177 lenx = *n;
|
c@427
|
178 leny = *m;
|
c@427
|
179 } else {
|
c@427
|
180 lenx = *m;
|
c@427
|
181 leny = *n;
|
c@427
|
182 }
|
c@427
|
183 if (*incx > 0) {
|
c@427
|
184 kx = 1;
|
c@427
|
185 } else {
|
c@427
|
186 kx = 1 - (lenx - 1) * *incx;
|
c@427
|
187 }
|
c@427
|
188 if (*incy > 0) {
|
c@427
|
189 ky = 1;
|
c@427
|
190 } else {
|
c@427
|
191 ky = 1 - (leny - 1) * *incy;
|
c@427
|
192 }
|
c@427
|
193
|
c@427
|
194 /* Start the operations. In this version the elements of A are */
|
c@427
|
195 /* accessed sequentially with one pass through A. */
|
c@427
|
196
|
c@427
|
197 /* First form y := beta*y. */
|
c@427
|
198
|
c@427
|
199 if (*beta != 1.) {
|
c@427
|
200 if (*incy == 1) {
|
c@427
|
201 if (*beta == 0.) {
|
c@427
|
202 i__1 = leny;
|
c@427
|
203 for (i__ = 1; i__ <= i__1; ++i__) {
|
c@427
|
204 y[i__] = 0.;
|
c@427
|
205 /* L10: */
|
c@427
|
206 }
|
c@427
|
207 } else {
|
c@427
|
208 i__1 = leny;
|
c@427
|
209 for (i__ = 1; i__ <= i__1; ++i__) {
|
c@427
|
210 y[i__] = *beta * y[i__];
|
c@427
|
211 /* L20: */
|
c@427
|
212 }
|
c@427
|
213 }
|
c@427
|
214 } else {
|
c@427
|
215 iy = ky;
|
c@427
|
216 if (*beta == 0.) {
|
c@427
|
217 i__1 = leny;
|
c@427
|
218 for (i__ = 1; i__ <= i__1; ++i__) {
|
c@427
|
219 y[iy] = 0.;
|
c@427
|
220 iy += *incy;
|
c@427
|
221 /* L30: */
|
c@427
|
222 }
|
c@427
|
223 } else {
|
c@427
|
224 i__1 = leny;
|
c@427
|
225 for (i__ = 1; i__ <= i__1; ++i__) {
|
c@427
|
226 y[iy] = *beta * y[iy];
|
c@427
|
227 iy += *incy;
|
c@427
|
228 /* L40: */
|
c@427
|
229 }
|
c@427
|
230 }
|
c@427
|
231 }
|
c@427
|
232 }
|
c@427
|
233 if (*alpha == 0.) {
|
c@427
|
234 return 0;
|
c@427
|
235 }
|
c@427
|
236 if (lsame_(trans, "N")) {
|
c@427
|
237
|
c@427
|
238 /* Form y := alpha*A*x + y. */
|
c@427
|
239
|
c@427
|
240 jx = kx;
|
c@427
|
241 if (*incy == 1) {
|
c@427
|
242 i__1 = *n;
|
c@427
|
243 for (j = 1; j <= i__1; ++j) {
|
c@427
|
244 if (x[jx] != 0.) {
|
c@427
|
245 temp = *alpha * x[jx];
|
c@427
|
246 i__2 = *m;
|
c@427
|
247 for (i__ = 1; i__ <= i__2; ++i__) {
|
c@427
|
248 y[i__] += temp * a[i__ + j * a_dim1];
|
c@427
|
249 /* L50: */
|
c@427
|
250 }
|
c@427
|
251 }
|
c@427
|
252 jx += *incx;
|
c@427
|
253 /* L60: */
|
c@427
|
254 }
|
c@427
|
255 } else {
|
c@427
|
256 i__1 = *n;
|
c@427
|
257 for (j = 1; j <= i__1; ++j) {
|
c@427
|
258 if (x[jx] != 0.) {
|
c@427
|
259 temp = *alpha * x[jx];
|
c@427
|
260 iy = ky;
|
c@427
|
261 i__2 = *m;
|
c@427
|
262 for (i__ = 1; i__ <= i__2; ++i__) {
|
c@427
|
263 y[iy] += temp * a[i__ + j * a_dim1];
|
c@427
|
264 iy += *incy;
|
c@427
|
265 /* L70: */
|
c@427
|
266 }
|
c@427
|
267 }
|
c@427
|
268 jx += *incx;
|
c@427
|
269 /* L80: */
|
c@427
|
270 }
|
c@427
|
271 }
|
c@427
|
272 } else {
|
c@427
|
273
|
c@427
|
274 /* Form y := alpha*A'*x + y. */
|
c@427
|
275
|
c@427
|
276 jy = ky;
|
c@427
|
277 if (*incx == 1) {
|
c@427
|
278 i__1 = *n;
|
c@427
|
279 for (j = 1; j <= i__1; ++j) {
|
c@427
|
280 temp = 0.;
|
c@427
|
281 i__2 = *m;
|
c@427
|
282 for (i__ = 1; i__ <= i__2; ++i__) {
|
c@427
|
283 temp += a[i__ + j * a_dim1] * x[i__];
|
c@427
|
284 /* L90: */
|
c@427
|
285 }
|
c@427
|
286 y[jy] += *alpha * temp;
|
c@427
|
287 jy += *incy;
|
c@427
|
288 /* L100: */
|
c@427
|
289 }
|
c@427
|
290 } else {
|
c@427
|
291 i__1 = *n;
|
c@427
|
292 for (j = 1; j <= i__1; ++j) {
|
c@427
|
293 temp = 0.;
|
c@427
|
294 ix = kx;
|
c@427
|
295 i__2 = *m;
|
c@427
|
296 for (i__ = 1; i__ <= i__2; ++i__) {
|
c@427
|
297 temp += a[i__ + j * a_dim1] * x[ix];
|
c@427
|
298 ix += *incx;
|
c@427
|
299 /* L110: */
|
c@427
|
300 }
|
c@427
|
301 y[jy] += *alpha * temp;
|
c@427
|
302 jy += *incy;
|
c@427
|
303 /* L120: */
|
c@427
|
304 }
|
c@427
|
305 }
|
c@427
|
306 }
|
c@427
|
307
|
c@427
|
308 return 0;
|
c@427
|
309
|
c@427
|
310 /* End of DGEMV . */
|
c@427
|
311
|
c@427
|
312 } /* dgemv_ */
|