1 SUBROUTINE DGBMV
( TRANS
, M
, N
, KL
, KU
, ALPHA
, A
, LDA
, X
, INCX
,
3 * .. Scalar Arguments
..
4 DOUBLE PRECISION ALPHA
, BETA
5 INTEGER INCX
, INCY
, KL
, KU
, LDA
, M
, N
7 * .. Array Arguments
..
8 DOUBLE PRECISION A
( LDA
, * ), X
( * ), Y
( * )
14 * DGBMV 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
19 * m by n band matrix, with kl sub-diagonals and ku super-diagonals.
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.
47 * On entry, KL specifies the number of sub-diagonals of the
48 * matrix A. KL must satisfy 0 .le. KL.
52 * On entry, KU specifies the number of super-diagonals of the
53 * matrix A. KU must satisfy 0 .le. KU.
56 * ALPHA - DOUBLE PRECISION.
57 * On entry, ALPHA specifies the scalar alpha.
60 * A - DOUBLE PRECISION array of DIMENSION ( LDA, n ).
61 * Before entry, the leading ( kl + ku + 1 ) by n part of the
62 * array A must contain the matrix of coefficients, supplied
63 * column by column, with the leading diagonal of the matrix in
64 * row ( ku + 1 ) of the array, the first super-diagonal
65 * starting at position 2 in row ku, the first sub-diagonal
66 * starting at position 1 in row ( ku + 2 ), and so on.
67 * Elements in the array A that do not correspond to elements
68 * in the band matrix (such as the top left ku by ku triangle)
70 * The following program segment will transfer a band matrix
71 * from conventional full matrix storage to band storage:
75 * DO 10, I = MAX( 1, J - KU ), MIN( M, J + KL )
76 * A( K + I, J ) = matrix( I, J )
83 * On entry, LDA specifies the first dimension of A as declared
84 * in the calling (sub) program. LDA must be at least
88 * X - DOUBLE PRECISION array of DIMENSION at least
89 * ( 1 + ( n - 1 )*abs( INCX ) ) when TRANS = 'N
' or 'n
'
91 * ( 1 + ( m - 1 )*abs( INCX ) ) otherwise.
92 * Before entry, the incremented array X must contain the
97 * On entry, INCX specifies the increment for the elements of
98 * X. INCX must not be zero.
101 * BETA - DOUBLE PRECISION.
102 * On entry, BETA specifies the scalar beta. When BETA is
103 * supplied as zero then Y need not be set on input.
106 * Y - DOUBLE PRECISION array of DIMENSION at least
107 * ( 1 + ( m - 1 )*abs( INCY ) ) when TRANS = 'N
' or 'n
'
109 * ( 1 + ( n - 1 )*abs( INCY ) ) otherwise.
110 * Before entry, the incremented array Y must contain the
111 * vector y. On exit, Y is overwritten by the updated vector y.
114 * On entry, INCY specifies the increment for the elements of
115 * Y. INCY must not be zero.
119 * Level 2 Blas routine.
121 * -- Written on 22-October-1986.
122 * Jack Dongarra, Argonne National Lab.
123 * Jeremy Du Croz, Nag Central Office.
124 * Sven Hammarling, Nag Central Office.
125 * Richard Hanson, Sandia National Labs.
128 DOUBLE PRECISION ONE , ZERO
129 PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )
130 * .. Local Scalars ..
131 DOUBLE PRECISION TEMP
132 INTEGER I, INFO, IX, IY, J, JX, JY, K, KUP1, KX, KY,
134 * .. External Functions ..
137 * .. External Subroutines ..
139 * .. Intrinsic Functions ..
142 * .. Executable Statements ..
144 * Test the input parameters.
147 IF ( .NOT.LSAME( TRANS, 'N
' ).AND.
148 $ .NOT.LSAME( TRANS, 'T
' ).AND.
149 $ .NOT.LSAME( TRANS, 'C
' ) )THEN
151 ELSE IF( M.LT.0 )THEN
153 ELSE IF( N.LT.0 )THEN
155 ELSE IF( KL.LT.0 )THEN
157 ELSE IF( KU.LT.0 )THEN
159 ELSE IF( LDA.LT.( KL + KU + 1 ) )THEN
161 ELSE IF( INCX.EQ.0 )THEN
163 ELSE IF( INCY.EQ.0 )THEN
167 CALL XERBLA( 'DGBMV
', INFO )
171 * Quick return if possible.
173 IF( ( M.EQ.0 ).OR.( N.EQ.0 ).OR.
174 $ ( ( ALPHA.EQ.ZERO ).AND.( BETA.EQ.ONE ) ) )
177 * Set LENX and LENY, the lengths of the vectors x and y, and set
178 * up the start points in X and Y.
180 IF( LSAME( TRANS, 'N
' ) )THEN
190 KX = 1 - ( LENX - 1 )*INCX
195 KY = 1 - ( LENY - 1 )*INCY
198 * Start the operations. In this version the elements of A are
199 * accessed sequentially with one pass through the band part of A.
201 * First form y := beta*y.
203 IF( BETA.NE.ONE )THEN
205 IF( BETA.EQ.ZERO )THEN
216 IF( BETA.EQ.ZERO )THEN
223 Y( IY ) = BETA*Y( IY )
232 IF( LSAME( TRANS, 'N
' ) )THEN
234 * Form y := alpha*A*x + y.
239 IF( X( JX ).NE.ZERO )THEN
242 DO 50, I = MAX( 1, J - KU ), MIN( M, J + KL )
243 Y( I ) = Y( I ) + TEMP*A( K + I, J )
250 IF( X( JX ).NE.ZERO )THEN
254 DO 70, I = MAX( 1, J - KU ), MIN( M, J + KL )
255 Y( IY ) = Y( IY ) + TEMP*A( K + I, J )
266 * Form y := alpha*A'*x
+ y
.
273 DO 90, I
= MAX
( 1, J
- KU
), MIN
( M
, J
+ KL
)
274 TEMP
= TEMP
+ A
( K
+ I
, J
)*X
( I
)
276 Y
( JY
) = Y
( JY
) + ALPHA*TEMP
284 DO 110, I
= MAX
( 1, J
- KU
), MIN
( M
, J
+ KL
)
285 TEMP
= TEMP
+ A
( K
+ I
, J
)*X
( IX
)
288 Y
( JY
) = Y
( JY
) + ALPHA*TEMP