1
SUBROUTINE CGEMV ( TRANS, M, N, ALPHA, A, LDA, X, INCX,
4
* $Id: cgemv.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 CGEMV(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
* COMPLEX A(LDA,*),X(*),Y(*)
28
*> CGEMV performs one of the matrix-vector operations
30
*> y := alpha*A*x + beta*y, or y := alpha*A**T*x + beta*y, or
32
*> y := alpha*A**H*x + beta*y,
34
*> where alpha and beta are scalars, x and y are vectors and A is an
43
*> TRANS is CHARACTER*1
44
*> On entry, TRANS specifies the operation to be performed as
47
*> TRANS = 'N' or 'n' y := alpha*A*x + beta*y.
49
*> TRANS = 'T' or 't' y := alpha*A**T*x + beta*y.
51
*> TRANS = 'C' or 'c' y := alpha*A**H*x + beta*y.
57
*> On entry, M specifies the number of rows of the matrix A.
58
*> M must be at least zero.
64
*> On entry, N specifies the number of columns of the matrix A.
65
*> N must be at least zero.
71
*> On entry, ALPHA specifies the scalar alpha.
76
*> A is COMPLEX array of DIMENSION ( LDA, n ).
77
*> Before entry, the leading m by n part of the array A must
78
*> contain the matrix of coefficients.
84
*> On entry, LDA specifies the first dimension of A as declared
85
*> in the calling (sub) program. LDA must be at least
91
*> X is COMPLEX array of DIMENSION at least
92
*> ( 1 + ( n - 1 )*abs( INCX ) ) when TRANS = 'N' or 'n'
94
*> ( 1 + ( m - 1 )*abs( INCX ) ) otherwise.
95
*> Before entry, the incremented array X must contain the
102
*> On entry, INCX specifies the increment for the elements of
103
*> X. INCX must not be zero.
109
*> On entry, BETA specifies the scalar beta. When BETA is
110
*> supplied as zero then Y need not be set on input.
115
*> Y is COMPLEX array of DIMENSION at least
116
*> ( 1 + ( m - 1 )*abs( INCY ) ) when TRANS = 'N' or 'n'
118
*> ( 1 + ( n - 1 )*abs( INCY ) ) otherwise.
119
*> Before entry with BETA non-zero, the incremented array Y
120
*> must contain the vector y. On exit, Y is overwritten by the
127
*> On entry, INCY specifies the increment for the elements of
128
*> Y. INCY must not be zero.
134
*> \author Univ. of Tennessee
135
*> \author Univ. of California Berkeley
136
*> \author Univ. of Colorado Denver
139
*> \date November 2011
141
*> \ingroup complex_blas_level2
143
*> \par Further Details:
144
* =====================
148
*> Level 2 Blas routine.
149
*> The vector and matrix arguments are not referenced when N = 0, or M = 0
151
*> -- Written on 22-October-1986.
152
*> Jack Dongarra, Argonne National Lab.
153
*> Jeremy Du Croz, Nag Central Office.
154
*> Sven Hammarling, Nag Central Office.
155
*> Richard Hanson, Sandia National Labs.
158
* =====================================================================
159
SUBROUTINE CGEMV(TRANS,M,N,ALPHA,A,LDA,X,INCX,BETA,Y,INCY)
161
* -- Reference BLAS level2 routine (version 3.4.0) --
162
* -- Reference BLAS is a software package provided by Univ. of Tennessee, --
163
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
6
166
* .. Scalar Arguments ..
8
INTEGER INCX, INCY, LDA, M, N
168
INTEGER INCX,INCY,LDA,M,N
10
171
* .. Array Arguments ..
11
COMPLEX A( LDA, * ), X( * ), Y( * )
172
COMPLEX A(LDA,*),X(*),Y(*)
17
* CGEMV performs one of the matrix-vector operations
19
* y := alpha*A*x + beta*y, or y := alpha*A'*x + beta*y, or
21
* y := alpha*conjg( A' )*x + beta*y,
23
* where alpha and beta are scalars, x and y are vectors and A is an
29
* TRANS - CHARACTER*1.
30
* On entry, TRANS specifies the operation to be performed as
33
* TRANS = 'N' or 'n' y := alpha*A*x + beta*y.
35
* TRANS = 'T' or 't' y := alpha*A'*x + beta*y.
37
* TRANS = 'C' or 'c' y := alpha*conjg( A' )*x + beta*y.
42
* On entry, M specifies the number of rows of the matrix A.
43
* M must be at least zero.
47
* On entry, N specifies the number of columns of the matrix A.
48
* N must be at least zero.
52
* On entry, ALPHA specifies the scalar alpha.
55
* A - COMPLEX array of DIMENSION ( LDA, n ).
56
* Before entry, the leading m by n part of the array A must
57
* contain the matrix of coefficients.
61
* On entry, LDA specifies the first dimension of A as declared
62
* in the calling (sub) program. LDA must be at least
66
* X - COMPLEX array of DIMENSION at least
67
* ( 1 + ( n - 1 )*abs( INCX ) ) when TRANS = 'N' or 'n'
69
* ( 1 + ( m - 1 )*abs( INCX ) ) otherwise.
70
* Before entry, the incremented array X must contain the
75
* On entry, INCX specifies the increment for the elements of
76
* X. INCX must not be zero.
80
* On entry, BETA specifies the scalar beta. When BETA is
81
* supplied as zero then Y need not be set on input.
84
* Y - COMPLEX array of DIMENSION at least
85
* ( 1 + ( m - 1 )*abs( INCY ) ) when TRANS = 'N' or 'n'
87
* ( 1 + ( n - 1 )*abs( INCY ) ) otherwise.
88
* Before entry with BETA non-zero, the incremented array Y
89
* must contain the vector y. On exit, Y is overwritten by the
93
* On entry, INCY specifies the increment for the elements of
94
* Y. INCY must not be zero.
98
* Level 2 Blas routine.
100
* -- Written on 22-October-1986.
101
* Jack Dongarra, Argonne National Lab.
102
* Jeremy Du Croz, Nag Central Office.
103
* Sven Hammarling, Nag Central Office.
104
* Richard Hanson, Sandia National Labs.
175
* =====================================================================
107
177
* .. Parameters ..
109
PARAMETER ( ONE = ( 1.0E+0, 0.0E+0 ) )
111
PARAMETER ( ZERO = ( 0.0E+0, 0.0E+0 ) )
179
PARAMETER (ONE= (1.0E+0,0.0E+0))
181
PARAMETER (ZERO= (0.0E+0,0.0E+0))
112
183
* .. Local Scalars ..
114
INTEGER I, INFO, IX, IY, J, JX, JY, KX, KY, LENX, LENY
185
INTEGER I,INFO,IX,IY,J,JX,JY,KX,KY,LENX,LENY
116
188
* .. External Functions ..
119
192
* .. External Subroutines ..
121
195
* .. Intrinsic Functions ..
124
* .. Executable Statements ..
126
199
* Test the input parameters.
129
IF ( .NOT.LSAME( TRANS, 'N' ).AND.
130
$ .NOT.LSAME( TRANS, 'T' ).AND.
131
$ .NOT.LSAME( TRANS, 'C' ) )THEN
133
ELSE IF( M.LT.0 )THEN
135
ELSE IF( N.LT.0 )THEN
137
ELSE IF( LDA.LT.MAX( 1, M ) )THEN
139
ELSE IF( INCX.EQ.0 )THEN
141
ELSE IF( INCY.EQ.0 )THEN
202
IF (.NOT.LSAME(TRANS,'N') .AND. .NOT.LSAME(TRANS,'T') .AND.
203
+ .NOT.LSAME(TRANS,'C')) THEN
205
ELSE IF (M.LT.0) THEN
207
ELSE IF (N.LT.0) THEN
209
ELSE IF (LDA.LT.MAX(1,M)) THEN
211
ELSE IF (INCX.EQ.0) THEN
213
ELSE IF (INCY.EQ.0) THEN
145
CALL XERBLA( 'CGEMV ', INFO )
217
CALL XERBLA('CGEMV ',INFO)
149
221
* Quick return if possible.
151
IF( ( M.EQ.0 ).OR.( N.EQ.0 ).OR.
152
$ ( ( ALPHA.EQ.ZERO ).AND.( BETA.EQ.ONE ) ) )
223
IF ((M.EQ.0) .OR. (N.EQ.0) .OR.
224
+ ((ALPHA.EQ.ZERO).AND. (BETA.EQ.ONE))) RETURN
155
NOCONJ = LSAME( TRANS, 'T' )
226
NOCONJ = LSAME(TRANS,'T')
157
228
* Set LENX and LENY, the lengths of the vectors x and y, and set
158
229
* up the start points in X and Y.
160
IF( LSAME( TRANS, 'N' ) )THEN
170
KX = 1 - ( LENX - 1 )*INCX
175
KY = 1 - ( LENY - 1 )*INCY
231
IF (LSAME(TRANS,'N')) THEN
241
KX = 1 - (LENX-1)*INCX
246
KY = 1 - (LENY-1)*INCY
178
249
* Start the operations. In this version the elements of A are