1
SUBROUTINE ZGBMV ( TRANS, M, N, KL, KU, ALPHA, A, LDA, X, INCX,
3
* .. Scalar Arguments ..
5
INTEGER INCX, INCY, KL, KU, LDA, M, N
7
* .. Array Arguments ..
8
COMPLEX*16 A( LDA, * ), X( * ), Y( * )
14
* ZGBMV 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.
58
* ALPHA - COMPLEX*16 .
59
* On entry, ALPHA specifies the scalar alpha.
62
* A - COMPLEX*16 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*16 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.
103
* BETA - COMPLEX*16 .
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*16 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.0D+0, 0.0D+0 ) )
135
PARAMETER ( ZERO = ( 0.0D+0, 0.0D+0 ) )
136
* .. Local Scalars ..
138
INTEGER I, INFO, IX, IY, J, JX, JY, K, KUP1, KX, KY,
141
* .. External Functions ..
144
* .. External Subroutines ..
146
* .. Intrinsic Functions ..
147
INTRINSIC DCONJG, MAX, MIN
149
* .. Executable Statements ..
151
* Test the input parameters.
154
IF ( .NOT.LSAME( TRANS, 'N' ).AND.
155
$ .NOT.LSAME( TRANS, 'T' ).AND.
156
$ .NOT.LSAME( TRANS, 'C' ) )THEN
158
ELSE IF( M.LT.0 )THEN
160
ELSE IF( N.LT.0 )THEN
162
ELSE IF( KL.LT.0 )THEN
164
ELSE IF( KU.LT.0 )THEN
166
ELSE IF( LDA.LT.( KL + KU + 1 ) )THEN
168
ELSE IF( INCX.EQ.0 )THEN
170
ELSE IF( INCY.EQ.0 )THEN
174
CALL XERBLA( 'ZGBMV ', INFO )
178
* Quick return if possible.
180
IF( ( M.EQ.0 ).OR.( N.EQ.0 ).OR.
181
$ ( ( ALPHA.EQ.ZERO ).AND.( BETA.EQ.ONE ) ) )
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
232
Y( IY ) = BETA*Y( IY )
241
IF( LSAME( TRANS, 'N' ) )THEN
243
* Form y := alpha*A*x + y.
248
IF( X( JX ).NE.ZERO )THEN
251
DO 50, I = MAX( 1, J - KU ), MIN( M, J + KL )
252
Y( I ) = Y( I ) + TEMP*A( K + I, J )
259
IF( X( JX ).NE.ZERO )THEN
263
DO 70, I = MAX( 1, J - KU ), MIN( M, J + KL )
264
Y( IY ) = Y( IY ) + TEMP*A( K + I, J )
275
* Form y := alpha*A'*x + y or y := alpha*conjg( A' )*x + y.
283
DO 90, I = MAX( 1, J - KU ), MIN( M, J + KL )
284
TEMP = TEMP + A( K + I, J )*X( I )
287
DO 100, I = MAX( 1, J - KU ), MIN( M, J + KL )
288
TEMP = TEMP + DCONJG( A( K + I, J ) )*X( I )
291
Y( JY ) = Y( JY ) + ALPHA*TEMP
300
DO 120, I = MAX( 1, J - KU ), MIN( M, J + KL )
301
TEMP = TEMP + A( K + I, J )*X( IX )
305
DO 130, I = MAX( 1, J - KU ), MIN( M, J + KL )
306
TEMP = TEMP + DCONJG( A( K + I, J ) )*X( IX )
310
Y( JY ) = Y( JY ) + ALPHA*TEMP