1 SUBROUTINE DGEMV
( TRANS
, M
, N
, ALPHA
, A
, LDA
, X
, INCX
,
3 * .. Scalar Arguments
..
4 DOUBLE PRECISION ALPHA
, BETA
5 INTEGER INCX
, INCY
, LDA
, M
, N
7 * .. Array Arguments
..
8 DOUBLE PRECISION A
( LDA
, * ), X
( * ), Y
( * )
14 * DGEMV performs one of the matrix
-vector operations
16 * y
:= alpha*A*x
+ beta*y
, or y
:= alpha*A
'*x + beta*y,
18 * where alpha and beta are scalars, x and y are vectors and A is an
24 * TRANS - CHARACTER*1.
25 * On entry, TRANS specifies the operation to be performed as
28 * TRANS = 'N
' or 'n
' y := alpha*A*x + beta*y.
30 * TRANS = 'T
' or 't
' y := alpha*A'*x
+ beta*y
.
32 * TRANS
= 'C' or
'c' y
:= alpha*A
'*x + beta*y.
37 * On entry, M specifies the number of rows of the matrix A.
38 * M must be at least zero.
42 * On entry, N specifies the number of columns of the matrix A.
43 * N must be at least zero.
46 * ALPHA - DOUBLE PRECISION.
47 * On entry, ALPHA specifies the scalar alpha.
50 * A - DOUBLE PRECISION array of DIMENSION ( LDA, n ).
51 * Before entry, the leading m by n part of the array A must
52 * contain the matrix of coefficients.
56 * On entry, LDA specifies the first dimension of A as declared
57 * in the calling (sub) program. LDA must be at least
61 * X - DOUBLE PRECISION array of DIMENSION at least
62 * ( 1 + ( n - 1 )*abs( INCX ) ) when TRANS = 'N
' or 'n
'
64 * ( 1 + ( m - 1 )*abs( INCX ) ) otherwise.
65 * Before entry, the incremented array X must contain the
70 * On entry, INCX specifies the increment for the elements of
71 * X. INCX must not be zero.
74 * BETA - DOUBLE PRECISION.
75 * On entry, BETA specifies the scalar beta. When BETA is
76 * supplied as zero then Y need not be set on input.
79 * Y - DOUBLE PRECISION array of DIMENSION at least
80 * ( 1 + ( m - 1 )*abs( INCY ) ) when TRANS = 'N
' or 'n
'
82 * ( 1 + ( n - 1 )*abs( INCY ) ) otherwise.
83 * Before entry with BETA non-zero, the incremented array Y
84 * must contain the vector y. On exit, Y is overwritten by the
88 * On entry, INCY specifies the increment for the elements of
89 * Y. INCY must not be zero.
93 * Level 2 Blas routine.
95 * -- Written on 22-October-1986.
96 * Jack Dongarra, Argonne National Lab.
97 * Jeremy Du Croz, Nag Central Office.
98 * Sven Hammarling, Nag Central Office.
99 * Richard Hanson, Sandia National Labs.
103 DOUBLE PRECISION ONE , ZERO
104 PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )
105 * .. Local Scalars ..
106 DOUBLE PRECISION TEMP
107 INTEGER I, INFO, IX, IY, J, JX, JY, KX, KY, LENX, LENY
108 * .. External Functions ..
111 * .. External Subroutines ..
113 * .. Intrinsic Functions ..
116 * .. Executable Statements ..
118 * Test the input parameters.
121 IF ( .NOT.LSAME( TRANS, 'N
' ).AND.
122 $ .NOT.LSAME( TRANS, 'T
' ).AND.
123 $ .NOT.LSAME( TRANS, 'C
' ) )THEN
125 ELSE IF( M.LT.0 )THEN
127 ELSE IF( N.LT.0 )THEN
129 ELSE IF( LDA.LT.MAX( 1, M ) )THEN
131 ELSE IF( INCX.EQ.0 )THEN
133 ELSE IF( INCY.EQ.0 )THEN
137 CALL XERBLA( 'DGEMV
', INFO )
141 * Quick return if possible.
143 IF( ( M.EQ.0 ).OR.( N.EQ.0 ).OR.
144 $ ( ( ALPHA.EQ.ZERO ).AND.( BETA.EQ.ONE ) ) )
147 * Set LENX and LENY, the lengths of the vectors x and y, and set
148 * up the start points in X and Y.
150 IF( LSAME( TRANS, 'N
' ) )THEN
160 KX = 1 - ( LENX - 1 )*INCX
165 KY = 1 - ( LENY - 1 )*INCY
168 * Start the operations. In this version the elements of A are
169 * accessed sequentially with one pass through A.
171 * First form y := beta*y.
173 IF( BETA.NE.ONE )THEN
175 IF( BETA.EQ.ZERO )THEN
186 IF( BETA.EQ.ZERO )THEN
193 Y( IY ) = BETA*Y( IY )
201 IF( LSAME( TRANS, 'N
' ) )THEN
203 * Form y := alpha*A*x + y.
208 IF( X( JX ).NE.ZERO )THEN
211 Y( I ) = Y( I ) + TEMP*A( I, J )
218 IF( X( JX ).NE.ZERO )THEN
222 Y( IY ) = Y( IY ) + TEMP*A( I, J )
231 * Form y := alpha*A'*x
+ y
.
238 TEMP
= TEMP
+ A
( I
, J
)*X
( I
)
240 Y
( JY
) = Y
( JY
) + ALPHA*TEMP
248 TEMP
= TEMP
+ A
( I
, J
)*X
( IX
)
251 Y
( JY
) = Y
( JY
) + ALPHA*TEMP