1 SUBROUTINE ZGEMV
( TRANS
, M
, N
, ALPHA
, A
, LDA
, X
, INCX
,
3 * .. Scalar Arguments
..
5 INTEGER INCX
, INCY
, LDA
, M
, N
7 * .. Array Arguments
..
8 COMPLEX*16 A
( LDA
, * ), X
( * ), Y
( * )
14 * ZGEMV performs one of the matrix
-vector operations
16 * y
:= alpha*A*x
+ beta*y
, or y
:= alpha*A
'*x + beta*y, or
18 * y := alpha*conjg( A' )*x
+ beta*y
,
20 * where alpha and beta are scalars
, x and y are vectors and A is an
26 * TRANS
- CHARACTER*1
.
27 * On entry
, TRANS specifies the operation
to be performed as
30 * TRANS
= 'N' or
'n' y
:= alpha*A*x
+ beta*y
.
32 * TRANS
= 'T' or
't' y
:= alpha*A
'*x + beta*y.
34 * TRANS = 'C
' or 'c
' y := alpha*conjg( A' )*x
+ beta*y
.
39 * On entry
, M specifies the number of rows of the matrix A
.
40 * M must be at least zero
.
44 * On entry
, N specifies the number of columns of the matrix A
.
45 * N must be at least zero
.
48 * ALPHA
- COMPLEX*16
.
49 * On entry
, ALPHA specifies the scalar alpha
.
52 * A
- COMPLEX*16 array of
DIMENSION ( LDA
, n
).
53 * Before entry
, the leading m by n part of the array A must
54 * contain the matrix of coefficients
.
58 * On entry
, LDA specifies the first
dimension of A as declared
59 * in the calling
(sub
) program. LDA must be at least
63 * X
- COMPLEX*16 array of
DIMENSION at least
64 * ( 1 + ( n
- 1 )*abs
( INCX
) ) when TRANS
= 'N' or
'n'
66 * ( 1 + ( m
- 1 )*abs
( INCX
) ) otherwise
.
67 * Before entry
, the incremented array X must contain the
72 * On entry
, INCX specifies the increment
for the elements of
73 * X
. INCX must not be zero
.
77 * On entry
, BETA specifies the scalar beta
. When BETA is
78 * supplied as zero
then Y need not be set on input
.
81 * Y
- COMPLEX*16 array of
DIMENSION at least
82 * ( 1 + ( m
- 1 )*abs
( INCY
) ) when TRANS
= 'N' or
'n'
84 * ( 1 + ( n
- 1 )*abs
( INCY
) ) otherwise
.
85 * Before entry with BETA non
-zero
, the incremented array Y
86 * must contain the vector y
. On exit
, Y is overwritten by the
90 * On entry
, INCY specifies the increment
for the elements of
91 * Y
. INCY must not be zero
.
95 * Level
2 Blas routine
.
97 * -- Written on
22-October
-1986.
98 * Jack Dongarra
, Argonne National Lab
.
99 * Jeremy Du Croz
, Nag Central Office
.
100 * Sven Hammarling
, Nag Central Office
.
101 * Richard Hanson
, Sandia National Labs
.
106 PARAMETER ( ONE
= ( 1.0D
+0, 0.0D
+0 ) )
108 PARAMETER ( ZERO
= ( 0.0D
+0, 0.0D
+0 ) )
109 * .. Local Scalars
..
111 INTEGER I
, INFO
, IX
, IY
, J
, JX
, JY
, KX
, KY
, LENX
, LENY
113 * .. External Functions
..
116 * .. External Subroutines
..
118 * .. Intrinsic Functions
..
119 INTRINSIC DCONJG
, MAX
121 * .. Executable Statements
..
123 * Test the input parameters
.
126 IF ( .NOT
.LSAME
( TRANS
, 'N' ).AND
.
127 $
.NOT
.LSAME
( TRANS
, 'T' ).AND
.
128 $
.NOT
.LSAME
( TRANS
, 'C' ) )THEN
130 ELSE IF( M
.LT
.0 )THEN
132 ELSE IF( N
.LT
.0 )THEN
134 ELSE IF( LDA
.LT
.MAX
( 1, M
) )THEN
136 ELSE IF( INCX
.EQ
.0 )THEN
138 ELSE IF( INCY
.EQ
.0 )THEN
142 CALL XERBLA
( 'ZGEMV ', INFO
)
146 * Quick
return if possible
.
148 IF( ( M
.EQ
.0 ).OR
.( N
.EQ
.0 ).OR
.
149 $
( ( ALPHA
.EQ
.ZERO
).AND
.( BETA
.EQ
.ONE
) ) )
152 NOCONJ
= LSAME
( TRANS
, 'T' )
154 * Set LENX and LENY
, the lengths of the vectors x and y
, and set
155 * up the start points in X and Y
.
157 IF( LSAME
( TRANS
, 'N' ) )THEN
167 KX
= 1 - ( LENX
- 1 )*INCX
172 KY
= 1 - ( LENY
- 1 )*INCY
175 * Start the operations
. In this version the elements of A are
176 * accessed sequentially with one pass through A
.
178 * First form y
:= beta*y
.
180 IF( BETA
.NE
.ONE
)THEN
182 IF( BETA
.EQ
.ZERO
)THEN
193 IF( BETA
.EQ
.ZERO
)THEN
200 Y
( IY
) = BETA*Y
( IY
)
208 IF( LSAME
( TRANS
, 'N' ) )THEN
210 * Form y
:= alpha*A*x
+ y
.
215 IF( X
( JX
).NE
.ZERO
)THEN
218 Y
( I
) = Y
( I
) + TEMP*A
( I
, J
)
225 IF( X
( JX
).NE
.ZERO
)THEN
229 Y
( IY
) = Y
( IY
) + TEMP*A
( I
, J
)
238 * Form y
:= alpha*A
'*x + y or y := alpha*conjg( A' )*x
+ y
.
246 TEMP
= TEMP
+ A
( I
, J
)*X
( I
)
250 TEMP
= TEMP
+ DCONJG
( A
( I
, J
) )*X
( I
)
253 Y
( JY
) = Y
( JY
) + ALPHA*TEMP
262 TEMP
= TEMP
+ A
( I
, J
)*X
( IX
)
267 TEMP
= TEMP
+ DCONJG
( A
( I
, J
) )*X
( IX
)
271 Y
( JY
) = Y
( JY
) + ALPHA*TEMP