1
SUBROUTINE SGEMV ( TRANS, M, N, ALPHA, A, LDA, X, INCX,
4
* $Id: sgemv.f 19695 2010-10-29 16:51:02Z d3y133 $
3
* =========== DOCUMENTATION ===========
5
* Online html documentation available at
6
* http://www.netlib.org/lapack/explore-html/
11
* SUBROUTINE SGEMV(TRANS,M,N,ALPHA,A,LDA,X,INCX,BETA,Y,INCY)
13
* .. Scalar Arguments ..
15
* INTEGER INCX,INCY,LDA,M,N
18
* .. Array Arguments ..
19
* REAL A(LDA,*),X(*),Y(*)
28
*> SGEMV performs one of the matrix-vector operations
30
*> y := alpha*A*x + beta*y, or y := alpha*A**T*x + beta*y,
32
*> where alpha and beta are scalars, x and y are vectors and A is an
41
*> TRANS is CHARACTER*1
42
*> On entry, TRANS specifies the operation to be performed as
45
*> TRANS = 'N' or 'n' y := alpha*A*x + beta*y.
47
*> TRANS = 'T' or 't' y := alpha*A**T*x + beta*y.
49
*> TRANS = 'C' or 'c' y := alpha*A**T*x + beta*y.
55
*> On entry, M specifies the number of rows of the matrix A.
56
*> M must be at least zero.
62
*> On entry, N specifies the number of columns of the matrix A.
63
*> N must be at least zero.
69
*> On entry, ALPHA specifies the scalar alpha.
74
*> A is REAL array of DIMENSION ( LDA, n ).
75
*> Before entry, the leading m by n part of the array A must
76
*> contain the matrix of coefficients.
82
*> On entry, LDA specifies the first dimension of A as declared
83
*> in the calling (sub) program. LDA must be at least
89
*> X is REAL array of DIMENSION at least
90
*> ( 1 + ( n - 1 )*abs( INCX ) ) when TRANS = 'N' or 'n'
92
*> ( 1 + ( m - 1 )*abs( INCX ) ) otherwise.
93
*> Before entry, the incremented array X must contain the
100
*> On entry, INCX specifies the increment for the elements of
101
*> X. INCX must not be zero.
107
*> On entry, BETA specifies the scalar beta. When BETA is
108
*> supplied as zero then Y need not be set on input.
113
*> Y is REAL array of DIMENSION at least
114
*> ( 1 + ( m - 1 )*abs( INCY ) ) when TRANS = 'N' or 'n'
116
*> ( 1 + ( n - 1 )*abs( INCY ) ) otherwise.
117
*> Before entry with BETA non-zero, the incremented array Y
118
*> must contain the vector y. On exit, Y is overwritten by the
125
*> On entry, INCY specifies the increment for the elements of
126
*> Y. INCY must not be zero.
132
*> \author Univ. of Tennessee
133
*> \author Univ. of California Berkeley
134
*> \author Univ. of Colorado Denver
137
*> \date November 2011
139
*> \ingroup single_blas_level2
141
*> \par Further Details:
142
* =====================
146
*> Level 2 Blas routine.
147
*> The vector and matrix arguments are not referenced when N = 0, or M = 0
149
*> -- Written on 22-October-1986.
150
*> Jack Dongarra, Argonne National Lab.
151
*> Jeremy Du Croz, Nag Central Office.
152
*> Sven Hammarling, Nag Central Office.
153
*> Richard Hanson, Sandia National Labs.
156
* =====================================================================
157
SUBROUTINE SGEMV(TRANS,M,N,ALPHA,A,LDA,X,INCX,BETA,Y,INCY)
159
* -- Reference BLAS level2 routine (version 3.4.0) --
160
* -- Reference BLAS is a software package provided by Univ. of Tennessee, --
161
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
6
164
* .. Scalar Arguments ..
8
INTEGER INCX, INCY, LDA, M, N
166
INTEGER INCX,INCY,LDA,M,N
10
169
* .. Array Arguments ..
11
REAL A( LDA, * ), X( * ), Y( * )
170
REAL A(LDA,*),X(*),Y(*)
17
* SGEMV performs one of the matrix-vector operations
19
* y := alpha*A*x + beta*y, or y := alpha*A'*x + beta*y,
21
* where alpha and beta are scalars, x and y are vectors and A is an
27
* TRANS - CHARACTER*1.
28
* On entry, TRANS specifies the operation to be performed as
31
* TRANS = 'N' or 'n' y := alpha*A*x + beta*y.
33
* TRANS = 'T' or 't' y := alpha*A'*x + beta*y.
35
* TRANS = 'C' or 'c' y := alpha*A'*x + beta*y.
40
* On entry, M specifies the number of rows of the matrix A.
41
* M must be at least zero.
45
* On entry, N specifies the number of columns of the matrix A.
46
* N must be at least zero.
50
* On entry, ALPHA specifies the scalar alpha.
53
* A - REAL array of DIMENSION ( LDA, n ).
54
* Before entry, the leading m by n part of the array A must
55
* contain the matrix of coefficients.
59
* On entry, LDA specifies the first dimension of A as declared
60
* in the calling (sub) program. LDA must be at least
64
* X - REAL array of DIMENSION at least
65
* ( 1 + ( n - 1 )*abs( INCX ) ) when TRANS = 'N' or 'n'
67
* ( 1 + ( m - 1 )*abs( INCX ) ) otherwise.
68
* Before entry, the incremented array X must contain the
73
* On entry, INCX specifies the increment for the elements of
74
* X. INCX must not be zero.
78
* On entry, BETA specifies the scalar beta. When BETA is
79
* supplied as zero then Y need not be set on input.
82
* Y - REAL array of DIMENSION at least
83
* ( 1 + ( m - 1 )*abs( INCY ) ) when TRANS = 'N' or 'n'
85
* ( 1 + ( n - 1 )*abs( INCY ) ) otherwise.
86
* Before entry with BETA non-zero, the incremented array Y
87
* must contain the vector y. On exit, Y is overwritten by the
91
* On entry, INCY specifies the increment for the elements of
92
* Y. INCY must not be zero.
96
* Level 2 Blas routine.
98
* -- Written on 22-October-1986.
99
* Jack Dongarra, Argonne National Lab.
100
* Jeremy Du Croz, Nag Central Office.
101
* Sven Hammarling, Nag Central Office.
102
* Richard Hanson, Sandia National Labs.
173
* =====================================================================
105
175
* .. Parameters ..
107
PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 )
177
PARAMETER (ONE=1.0E+0,ZERO=0.0E+0)
108
179
* .. Local Scalars ..
110
INTEGER I, INFO, IX, IY, J, JX, JY, KX, KY, LENX, LENY
181
INTEGER I,INFO,IX,IY,J,JX,JY,KX,KY,LENX,LENY
111
183
* .. External Functions ..
114
187
* .. External Subroutines ..
116
190
* .. Intrinsic Functions ..
119
* .. Executable Statements ..
121
194
* Test the input parameters.
124
IF ( .NOT.LSAME( TRANS, 'N' ).AND.
125
$ .NOT.LSAME( TRANS, 'T' ).AND.
126
$ .NOT.LSAME( TRANS, 'C' ) )THEN
128
ELSE IF( M.LT.0 )THEN
130
ELSE IF( N.LT.0 )THEN
132
ELSE IF( LDA.LT.MAX( 1, M ) )THEN
134
ELSE IF( INCX.EQ.0 )THEN
136
ELSE IF( INCY.EQ.0 )THEN
197
IF (.NOT.LSAME(TRANS,'N') .AND. .NOT.LSAME(TRANS,'T') .AND.
198
+ .NOT.LSAME(TRANS,'C')) THEN
200
ELSE IF (M.LT.0) THEN
202
ELSE IF (N.LT.0) THEN
204
ELSE IF (LDA.LT.MAX(1,M)) THEN
206
ELSE IF (INCX.EQ.0) THEN
208
ELSE IF (INCY.EQ.0) THEN
140
CALL XERBLA( 'SGEMV ', INFO )
212
CALL XERBLA('SGEMV ',INFO)
144
216
* Quick return if possible.
146
IF( ( M.EQ.0 ).OR.( N.EQ.0 ).OR.
147
$ ( ( ALPHA.EQ.ZERO ).AND.( BETA.EQ.ONE ) ) )
218
IF ((M.EQ.0) .OR. (N.EQ.0) .OR.
219
+ ((ALPHA.EQ.ZERO).AND. (BETA.EQ.ONE))) RETURN
150
221
* Set LENX and LENY, the lengths of the vectors x and y, and set
151
222
* up the start points in X and Y.
153
IF( LSAME( TRANS, 'N' ) )THEN
163
KX = 1 - ( LENX - 1 )*INCX
168
KY = 1 - ( LENY - 1 )*INCY
224
IF (LSAME(TRANS,'N')) THEN
234
KX = 1 - (LENX-1)*INCX
239
KY = 1 - (LENY-1)*INCY
171
242
* Start the operations. In this version the elements of A are