3 /* Subroutine */ int sgemv_(char *trans, integer *m, integer *n, real *alpha,
4 real *a, integer *lda, real *x, integer *incx, real *beta, real *y,
7 /* System generated locals */
8 integer a_dim1, a_offset, i__1, i__2;
11 integer i__, j, ix, iy, jx, jy, kx, ky, info;
14 extern logical lsame_(char *, char *);
15 extern /* Subroutine */ int xerbla_(char *, integer *);
17 /* .. Scalar Arguments .. */
19 /* .. Array Arguments .. */
25 /* SGEMV performs one of the matrix-vector operations */
27 /* y := alpha*A*x + beta*y, or y := alpha*A'*x + beta*y, */
29 /* where alpha and beta are scalars, x and y are vectors and A is an */
35 /* TRANS - CHARACTER*1. */
36 /* On entry, TRANS specifies the operation to be performed as */
39 /* TRANS = 'N' or 'n' y := alpha*A*x + beta*y. */
41 /* TRANS = 'T' or 't' y := alpha*A'*x + beta*y. */
43 /* TRANS = 'C' or 'c' y := alpha*A'*x + beta*y. */
45 /* Unchanged on exit. */
48 /* On entry, M specifies the number of rows of the matrix A. */
49 /* M must be at least zero. */
50 /* Unchanged on exit. */
53 /* On entry, N specifies the number of columns of the matrix A. */
54 /* N must be at least zero. */
55 /* Unchanged on exit. */
58 /* On entry, ALPHA specifies the scalar alpha. */
59 /* Unchanged on exit. */
61 /* A - REAL array of DIMENSION ( LDA, n ). */
62 /* Before entry, the leading m by n part of the array A must */
63 /* contain the matrix of coefficients. */
64 /* Unchanged on exit. */
67 /* On entry, LDA specifies the first dimension of A as declared */
68 /* in the calling (sub) program. LDA must be at least */
70 /* Unchanged on exit. */
72 /* X - REAL array of DIMENSION at least */
73 /* ( 1 + ( n - 1 )*abs( INCX ) ) when TRANS = 'N' or 'n' */
75 /* ( 1 + ( m - 1 )*abs( INCX ) ) otherwise. */
76 /* Before entry, the incremented array X must contain the */
78 /* Unchanged on exit. */
81 /* On entry, INCX specifies the increment for the elements of */
82 /* X. INCX must not be zero. */
83 /* Unchanged on exit. */
86 /* On entry, BETA specifies the scalar beta. When BETA is */
87 /* supplied as zero then Y need not be set on input. */
88 /* Unchanged on exit. */
90 /* Y - REAL array of DIMENSION at least */
91 /* ( 1 + ( m - 1 )*abs( INCY ) ) when TRANS = 'N' or 'n' */
93 /* ( 1 + ( n - 1 )*abs( INCY ) ) otherwise. */
94 /* Before entry with BETA non-zero, the incremented array Y */
95 /* must contain the vector y. On exit, Y is overwritten by the */
96 /* updated vector y. */
99 /* On entry, INCY specifies the increment for the elements of */
100 /* Y. INCY must not be zero. */
101 /* Unchanged on exit. */
104 /* Level 2 Blas routine. */
106 /* -- Written on 22-October-1986. */
107 /* Jack Dongarra, Argonne National Lab. */
108 /* Jeremy Du Croz, Nag Central Office. */
109 /* Sven Hammarling, Nag Central Office. */
110 /* Richard Hanson, Sandia National Labs. */
113 /* .. Parameters .. */
115 /* .. Local Scalars .. */
117 /* .. External Functions .. */
119 /* .. External Subroutines .. */
121 /* .. Intrinsic Functions .. */
124 /* Test the input parameters. */
126 /* Parameter adjustments */
128 a_offset = 1 + a_dim1;
135 if (! lsame_(trans, "N") && ! lsame_(trans, "T") && ! lsame_(trans, "C")
142 } else if (*lda < max(1,*m)) {
144 } else if (*incx == 0) {
146 } else if (*incy == 0) {
150 xerbla_("SGEMV ", &info);
154 /* Quick return if possible. */
156 if (*m == 0 || *n == 0 || *alpha == 0.f && *beta == 1.f) {
160 /* Set LENX and LENY, the lengths of the vectors x and y, and set */
161 /* up the start points in X and Y. */
163 if (lsame_(trans, "N")) {
173 kx = 1 - (lenx - 1) * *incx;
178 ky = 1 - (leny - 1) * *incy;
181 /* Start the operations. In this version the elements of A are */
182 /* accessed sequentially with one pass through A. */
184 /* First form y := beta*y. */
190 for (i__ = 1; i__ <= i__1; ++i__) {
196 for (i__ = 1; i__ <= i__1; ++i__) {
197 y[i__] = *beta * y[i__];
205 for (i__ = 1; i__ <= i__1; ++i__) {
212 for (i__ = 1; i__ <= i__1; ++i__) {
213 y[iy] = *beta * y[iy];
223 if (lsame_(trans, "N")) {
225 /* Form y := alpha*A*x + y. */
230 for (j = 1; j <= i__1; ++j) {
232 temp = *alpha * x[jx];
234 for (i__ = 1; i__ <= i__2; ++i__) {
235 y[i__] += temp * a[i__ + j * a_dim1];
244 for (j = 1; j <= i__1; ++j) {
246 temp = *alpha * x[jx];
249 for (i__ = 1; i__ <= i__2; ++i__) {
250 y[iy] += temp * a[i__ + j * a_dim1];
261 /* Form y := alpha*A'*x + y. */
266 for (j = 1; j <= i__1; ++j) {
269 for (i__ = 1; i__ <= i__2; ++i__) {
270 temp += a[i__ + j * a_dim1] * x[i__];
273 y[jy] += *alpha * temp;
279 for (j = 1; j <= i__1; ++j) {
283 for (i__ = 1; i__ <= i__2; ++i__) {
284 temp += a[i__ + j * a_dim1] * x[ix];
288 y[jy] += *alpha * temp;