1
SUBROUTINE DTBMV(UPLO,TRANS,DIAG,N,K,A,LDA,X,INCX)
2
* .. Scalar Arguments ..
4
CHARACTER DIAG,TRANS,UPLO
6
* .. Array Arguments ..
7
DOUBLE PRECISION A(LDA,*),X(*)
13
* DTBMV performs one of the matrix-vector operations
15
* x := A*x, or x := A'*x,
17
* where x is an n element vector and A is an n by n unit, or non-unit,
18
* upper or lower triangular band matrix, with ( k + 1 ) diagonals.
24
* On entry, UPLO specifies whether the matrix is an upper or
25
* lower triangular matrix as follows:
27
* UPLO = 'U' or 'u' A is an upper triangular matrix.
29
* UPLO = 'L' or 'l' A is a lower triangular matrix.
33
* TRANS - CHARACTER*1.
34
* On entry, TRANS specifies the operation to be performed as
37
* TRANS = 'N' or 'n' x := A*x.
39
* TRANS = 'T' or 't' x := A'*x.
41
* TRANS = 'C' or 'c' x := A'*x.
46
* On entry, DIAG specifies whether or not A is unit
47
* triangular as follows:
49
* DIAG = 'U' or 'u' A is assumed to be unit triangular.
51
* DIAG = 'N' or 'n' A is not assumed to be unit
57
* On entry, N specifies the order of the matrix A.
58
* N must be at least zero.
62
* On entry with UPLO = 'U' or 'u', K specifies the number of
63
* super-diagonals of the matrix A.
64
* On entry with UPLO = 'L' or 'l', K specifies the number of
65
* sub-diagonals of the matrix A.
66
* K must satisfy 0 .le. K.
69
* A - DOUBLE PRECISION array of DIMENSION ( LDA, n ).
70
* Before entry with UPLO = 'U' or 'u', the leading ( k + 1 )
71
* by n part of the array A must contain the upper triangular
72
* band part of the matrix of coefficients, supplied column by
73
* column, with the leading diagonal of the matrix in row
74
* ( k + 1 ) of the array, the first super-diagonal starting at
75
* position 2 in row k, and so on. The top left k by k triangle
76
* of the array A is not referenced.
77
* The following program segment will transfer an upper
78
* triangular band matrix from conventional full matrix storage
83
* DO 10, I = MAX( 1, J - K ), J
84
* A( M + I, J ) = matrix( I, J )
88
* Before entry with UPLO = 'L' or 'l', the leading ( k + 1 )
89
* by n part of the array A must contain the lower triangular
90
* band part of the matrix of coefficients, supplied column by
91
* column, with the leading diagonal of the matrix in row 1 of
92
* the array, the first sub-diagonal starting at position 1 in
93
* row 2, and so on. The bottom right k by k triangle of the
94
* array A is not referenced.
95
* The following program segment will transfer a lower
96
* triangular band matrix from conventional full matrix storage
101
* DO 10, I = J, MIN( N, J + K )
102
* A( M + I, J ) = matrix( I, J )
106
* Note that when DIAG = 'U' or 'u' the elements of the array A
107
* corresponding to the diagonal elements of the matrix are not
108
* referenced, but are assumed to be unity.
112
* On entry, LDA specifies the first dimension of A as declared
113
* in the calling (sub) program. LDA must be at least
117
* X - DOUBLE PRECISION array of dimension at least
118
* ( 1 + ( n - 1 )*abs( INCX ) ).
119
* Before entry, the incremented array X must contain the n
120
* element vector x. On exit, X is overwritten with the
121
* tranformed vector x.
124
* On entry, INCX specifies the increment for the elements of
125
* X. INCX must not be zero.
129
* Level 2 Blas routine.
131
* -- Written on 22-October-1986.
132
* Jack Dongarra, Argonne National Lab.
133
* Jeremy Du Croz, Nag Central Office.
134
* Sven Hammarling, Nag Central Office.
135
* Richard Hanson, Sandia National Labs.
139
DOUBLE PRECISION ZERO
140
PARAMETER (ZERO=0.0D+0)
142
* .. Local Scalars ..
143
DOUBLE PRECISION TEMP
144
INTEGER I,INFO,IX,J,JX,KPLUS1,KX,L
147
* .. External Functions ..
151
* .. External Subroutines ..
154
* .. Intrinsic Functions ..
158
* Test the input parameters.
161
IF (.NOT.LSAME(UPLO,'U') .AND. .NOT.LSAME(UPLO,'L')) THEN
163
ELSE IF (.NOT.LSAME(TRANS,'N') .AND. .NOT.LSAME(TRANS,'T') .AND.
164
+ .NOT.LSAME(TRANS,'C')) THEN
166
ELSE IF (.NOT.LSAME(DIAG,'U') .AND. .NOT.LSAME(DIAG,'N')) THEN
168
ELSE IF (N.LT.0) THEN
170
ELSE IF (K.LT.0) THEN
172
ELSE IF (LDA.LT. (K+1)) THEN
174
ELSE IF (INCX.EQ.0) THEN
178
CALL XERBLA('DTBMV ',INFO)
182
* Quick return if possible.
186
NOUNIT = LSAME(DIAG,'N')
188
* Set up the start point in X if the increment is not unity. This
189
* will be ( N - 1 )*INCX too small for descending loops.
193
ELSE IF (INCX.NE.1) THEN
197
* Start the operations. In this version the elements of A are
198
* accessed sequentially with one pass through A.
200
IF (LSAME(TRANS,'N')) THEN
204
IF (LSAME(UPLO,'U')) THEN
208
IF (X(J).NE.ZERO) THEN
211
DO 10 I = MAX(1,J-K),J - 1
212
X(I) = X(I) + TEMP*A(L+I,J)
214
IF (NOUNIT) X(J) = X(J)*A(KPLUS1,J)
220
IF (X(JX).NE.ZERO) THEN
224
DO 30 I = MAX(1,J-K),J - 1
225
X(IX) = X(IX) + TEMP*A(L+I,J)
228
IF (NOUNIT) X(JX) = X(JX)*A(KPLUS1,J)
231
IF (J.GT.K) KX = KX + INCX
237
IF (X(J).NE.ZERO) THEN
240
DO 50 I = MIN(N,J+K),J + 1,-1
241
X(I) = X(I) + TEMP*A(L+I,J)
243
IF (NOUNIT) X(J) = X(J)*A(1,J)
250
IF (X(JX).NE.ZERO) THEN
254
DO 70 I = MIN(N,J+K),J + 1,-1
255
X(IX) = X(IX) + TEMP*A(L+I,J)
258
IF (NOUNIT) X(JX) = X(JX)*A(1,J)
261
IF ((N-J).GE.K) KX = KX - INCX
269
IF (LSAME(UPLO,'U')) THEN
275
IF (NOUNIT) TEMP = TEMP*A(KPLUS1,J)
276
DO 90 I = J - 1,MAX(1,J-K),-1
277
TEMP = TEMP + A(L+I,J)*X(I)
289
IF (NOUNIT) TEMP = TEMP*A(KPLUS1,J)
290
DO 110 I = J - 1,MAX(1,J-K),-1
291
TEMP = TEMP + A(L+I,J)*X(IX)
303
IF (NOUNIT) TEMP = TEMP*A(1,J)
304
DO 130 I = J + 1,MIN(N,J+K)
305
TEMP = TEMP + A(L+I,J)*X(I)
316
IF (NOUNIT) TEMP = TEMP*A(1,J)
317
DO 150 I = J + 1,MIN(N,J+K)
318
TEMP = TEMP + A(L+I,J)*X(IX)