1
SUBROUTINE CGBMV(TRANS,M,N,KL,KU,ALPHA,A,LDA,X,INCX,BETA,Y,INCY)
2
* .. Scalar Arguments ..
4
INTEGER INCX,INCY,KL,KU,LDA,M,N
7
* .. Array Arguments ..
8
COMPLEX A(LDA,*),X(*),Y(*)
14
* CGBMV 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
21
* m by n band matrix, with kl sub-diagonals and ku super-diagonals.
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.
49
* On entry, KL specifies the number of sub-diagonals of the
50
* matrix A. KL must satisfy 0 .le. KL.
54
* On entry, KU specifies the number of super-diagonals of the
55
* matrix A. KU must satisfy 0 .le. KU.
59
* On entry, ALPHA specifies the scalar alpha.
62
* A - COMPLEX array of DIMENSION ( LDA, n ).
63
* Before entry, the leading ( kl + ku + 1 ) by n part of the
64
* array A must contain the matrix of coefficients, supplied
65
* column by column, with the leading diagonal of the matrix in
66
* row ( ku + 1 ) of the array, the first super-diagonal
67
* starting at position 2 in row ku, the first sub-diagonal
68
* starting at position 1 in row ( ku + 2 ), and so on.
69
* Elements in the array A that do not correspond to elements
70
* in the band matrix (such as the top left ku by ku triangle)
72
* The following program segment will transfer a band matrix
73
* from conventional full matrix storage to band storage:
77
* DO 10, I = MAX( 1, J - KU ), MIN( M, J + KL )
78
* A( K + I, J ) = matrix( I, J )
85
* On entry, LDA specifies the first dimension of A as declared
86
* in the calling (sub) program. LDA must be at least
90
* X - COMPLEX array of DIMENSION at least
91
* ( 1 + ( n - 1 )*abs( INCX ) ) when TRANS = 'N' or 'n'
93
* ( 1 + ( m - 1 )*abs( INCX ) ) otherwise.
94
* Before entry, the incremented array X must contain the
99
* On entry, INCX specifies the increment for the elements of
100
* X. INCX must not be zero.
104
* On entry, BETA specifies the scalar beta. When BETA is
105
* supplied as zero then Y need not be set on input.
108
* Y - COMPLEX array of DIMENSION at least
109
* ( 1 + ( m - 1 )*abs( INCY ) ) when TRANS = 'N' or 'n'
111
* ( 1 + ( n - 1 )*abs( INCY ) ) otherwise.
112
* Before entry, the incremented array Y must contain the
113
* vector y. On exit, Y is overwritten by the updated vector y.
117
* On entry, INCY specifies the increment for the elements of
118
* Y. INCY must not be zero.
122
* Level 2 Blas routine.
124
* -- Written on 22-October-1986.
125
* Jack Dongarra, Argonne National Lab.
126
* Jeremy Du Croz, Nag Central Office.
127
* Sven Hammarling, Nag Central Office.
128
* Richard Hanson, Sandia National Labs.
133
PARAMETER (ONE= (1.0E+0,0.0E+0))
135
PARAMETER (ZERO= (0.0E+0,0.0E+0))
137
* .. Local Scalars ..
139
INTEGER I,INFO,IX,IY,J,JX,JY,K,KUP1,KX,KY,LENX,LENY
142
* .. External Functions ..
146
* .. External Subroutines ..
149
* .. Intrinsic Functions ..
150
INTRINSIC CONJG,MAX,MIN
153
* Test the input parameters.
156
IF (.NOT.LSAME(TRANS,'N') .AND. .NOT.LSAME(TRANS,'T') .AND.
157
+ .NOT.LSAME(TRANS,'C')) THEN
159
ELSE IF (M.LT.0) THEN
161
ELSE IF (N.LT.0) THEN
163
ELSE IF (KL.LT.0) THEN
165
ELSE IF (KU.LT.0) THEN
167
ELSE IF (LDA.LT. (KL+KU+1)) THEN
169
ELSE IF (INCX.EQ.0) THEN
171
ELSE IF (INCY.EQ.0) THEN
175
CALL XERBLA('CGBMV ',INFO)
179
* Quick return if possible.
181
IF ((M.EQ.0) .OR. (N.EQ.0) .OR.
182
+ ((ALPHA.EQ.ZERO).AND. (BETA.EQ.ONE))) RETURN
184
NOCONJ = LSAME(TRANS,'T')
186
* Set LENX and LENY, the lengths of the vectors x and y, and set
187
* up the start points in X and Y.
189
IF (LSAME(TRANS,'N')) THEN
199
KX = 1 - (LENX-1)*INCX
204
KY = 1 - (LENY-1)*INCY
207
* Start the operations. In this version the elements of A are
208
* accessed sequentially with one pass through the band part of A.
210
* First form y := beta*y.
212
IF (BETA.NE.ONE) THEN
214
IF (BETA.EQ.ZERO) THEN
225
IF (BETA.EQ.ZERO) THEN
238
IF (ALPHA.EQ.ZERO) RETURN
240
IF (LSAME(TRANS,'N')) THEN
242
* Form y := alpha*A*x + y.
247
IF (X(JX).NE.ZERO) THEN
250
DO 50 I = MAX(1,J-KU),MIN(M,J+KL)
251
Y(I) = Y(I) + TEMP*A(K+I,J)
258
IF (X(JX).NE.ZERO) THEN
262
DO 70 I = MAX(1,J-KU),MIN(M,J+KL)
263
Y(IY) = Y(IY) + TEMP*A(K+I,J)
268
IF (J.GT.KU) KY = KY + INCY
273
* Form y := alpha*A'*x + y or y := alpha*conjg( A' )*x + y.
281
DO 90 I = MAX(1,J-KU),MIN(M,J+KL)
282
TEMP = TEMP + A(K+I,J)*X(I)
285
DO 100 I = MAX(1,J-KU),MIN(M,J+KL)
286
TEMP = TEMP + CONJG(A(K+I,J))*X(I)
289
Y(JY) = Y(JY) + ALPHA*TEMP
298
DO 120 I = MAX(1,J-KU),MIN(M,J+KL)
299
TEMP = TEMP + A(K+I,J)*X(IX)
303
DO 130 I = MAX(1,J-KU),MIN(M,J+KL)
304
TEMP = TEMP + CONJG(A(K+I,J))*X(IX)
308
Y(JY) = Y(JY) + ALPHA*TEMP
310
IF (J.GT.KU) KX = KX + INCX