3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
11 * SUBROUTINE STBMV(UPLO,TRANS,DIAG,N,K,A,LDA,X,INCX)
13 * .. Scalar Arguments ..
14 * INTEGER INCX,K,LDA,N
15 * CHARACTER DIAG,TRANS,UPLO
17 * .. Array Arguments ..
27 *> STBMV performs one of the matrix-vector operations
29 *> x := A*x, or x := A**T*x,
31 *> where x is an n element vector and A is an n by n unit, or non-unit,
32 *> upper or lower triangular band matrix, with ( k + 1 ) diagonals.
40 *> UPLO is CHARACTER*1
41 *> On entry, UPLO specifies whether the matrix is an upper or
42 *> lower triangular matrix as follows:
44 *> UPLO = 'U' or 'u' A is an upper triangular matrix.
46 *> UPLO = 'L' or 'l' A is a lower triangular matrix.
51 *> TRANS is CHARACTER*1
52 *> On entry, TRANS specifies the operation to be performed as
55 *> TRANS = 'N' or 'n' x := A*x.
57 *> TRANS = 'T' or 't' x := A**T*x.
59 *> TRANS = 'C' or 'c' x := A**T*x.
64 *> DIAG is CHARACTER*1
65 *> On entry, DIAG specifies whether or not A is unit
66 *> triangular as follows:
68 *> DIAG = 'U' or 'u' A is assumed to be unit triangular.
70 *> DIAG = 'N' or 'n' A is not assumed to be unit
77 *> On entry, N specifies the order of the matrix A.
78 *> N must be at least zero.
84 *> On entry with UPLO = 'U' or 'u', K specifies the number of
85 *> super-diagonals of the matrix A.
86 *> On entry with UPLO = 'L' or 'l', K specifies the number of
87 *> sub-diagonals of the matrix A.
88 *> K must satisfy 0 .le. K.
93 *> A is REAL array of DIMENSION ( LDA, n ).
94 *> Before entry with UPLO = 'U' or 'u', the leading ( k + 1 )
95 *> by n part of the array A must contain the upper triangular
96 *> band part of the matrix of coefficients, supplied column by
97 *> column, with the leading diagonal of the matrix in row
98 *> ( k + 1 ) of the array, the first super-diagonal starting at
99 *> position 2 in row k, and so on. The top left k by k triangle
100 *> of the array A is not referenced.
101 *> The following program segment will transfer an upper
102 *> triangular band matrix from conventional full matrix storage
107 *> DO 10, I = MAX( 1, J - K ), J
108 *> A( M + I, J ) = matrix( I, J )
112 *> Before entry with UPLO = 'L' or 'l', the leading ( k + 1 )
113 *> by n part of the array A must contain the lower triangular
114 *> band part of the matrix of coefficients, supplied column by
115 *> column, with the leading diagonal of the matrix in row 1 of
116 *> the array, the first sub-diagonal starting at position 1 in
117 *> row 2, and so on. The bottom right k by k triangle of the
118 *> array A is not referenced.
119 *> The following program segment will transfer a lower
120 *> triangular band matrix from conventional full matrix storage
125 *> DO 10, I = J, MIN( N, J + K )
126 *> A( M + I, J ) = matrix( I, J )
130 *> Note that when DIAG = 'U' or 'u' the elements of the array A
131 *> corresponding to the diagonal elements of the matrix are not
132 *> referenced, but are assumed to be unity.
138 *> On entry, LDA specifies the first dimension of A as declared
139 *> in the calling (sub) program. LDA must be at least
145 *> X is REAL array of dimension at least
146 *> ( 1 + ( n - 1 )*abs( INCX ) ).
147 *> Before entry, the incremented array X must contain the n
148 *> element vector x. On exit, X is overwritten with the
149 *> transformed vector x.
155 *> On entry, INCX specifies the increment for the elements of
156 *> X. INCX must not be zero.
162 *> \author Univ. of Tennessee
163 *> \author Univ. of California Berkeley
164 *> \author Univ. of Colorado Denver
167 *> \date November 2011
169 *> \ingroup single_blas_level2
171 *> \par Further Details:
172 * =====================
176 *> Level 2 Blas routine.
177 *> The vector and matrix arguments are not referenced when N = 0, or M = 0
179 *> -- Written on 22-October-1986.
180 *> Jack Dongarra, Argonne National Lab.
181 *> Jeremy Du Croz, Nag Central Office.
182 *> Sven Hammarling, Nag Central Office.
183 *> Richard Hanson, Sandia National Labs.
186 * =====================================================================
187 SUBROUTINE STBMV(UPLO,TRANS,DIAG,N,K,A,LDA,X,INCX)
189 * -- Reference BLAS level2 routine (version 3.4.0) --
190 * -- Reference BLAS is a software package provided by Univ. of Tennessee, --
191 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
194 * .. Scalar Arguments ..
196 CHARACTER DIAG,TRANS,UPLO
198 * .. Array Arguments ..
202 * =====================================================================
206 PARAMETER (ZERO=0.0E+0)
208 * .. Local Scalars ..
210 INTEGER I,INFO,IX,J,JX,KPLUS1,KX,L
213 * .. External Functions ..
217 * .. External Subroutines ..
220 * .. Intrinsic Functions ..
224 * Test the input parameters.
227 IF (.NOT.LSAME(UPLO,'U') .AND. .NOT.LSAME(UPLO,'L')) THEN
229 ELSE IF (.NOT.LSAME(TRANS,'N') .AND. .NOT.LSAME(TRANS,'T') .AND.
230 + .NOT.LSAME(TRANS,'C')) THEN
232 ELSE IF (.NOT.LSAME(DIAG,'U') .AND. .NOT.LSAME(DIAG,'N')) THEN
234 ELSE IF (N.LT.0) THEN
236 ELSE IF (K.LT.0) THEN
238 ELSE IF (LDA.LT. (K+1)) THEN
240 ELSE IF (INCX.EQ.0) THEN
244 CALL XERBLA('STBMV ',INFO)
248 * Quick return if possible.
252 NOUNIT = LSAME(DIAG,'N')
254 * Set up the start point in X if the increment is not unity. This
255 * will be ( N - 1 )*INCX too small for descending loops.
259 ELSE IF (INCX.NE.1) THEN
263 * Start the operations. In this version the elements of A are
264 * accessed sequentially with one pass through A.
266 IF (LSAME(TRANS,'N')) THEN
270 IF (LSAME(UPLO,'U')) THEN
274 IF (X(J).NE.ZERO) THEN
277 DO 10 I = MAX(1,J-K),J - 1
278 X(I) = X(I) + TEMP*A(L+I,J)
280 IF (NOUNIT) X(J) = X(J)*A(KPLUS1,J)
286 IF (X(JX).NE.ZERO) THEN
290 DO 30 I = MAX(1,J-K),J - 1
291 X(IX) = X(IX) + TEMP*A(L+I,J)
294 IF (NOUNIT) X(JX) = X(JX)*A(KPLUS1,J)
297 IF (J.GT.K) KX = KX + INCX
303 IF (X(J).NE.ZERO) THEN
306 DO 50 I = MIN(N,J+K),J + 1,-1
307 X(I) = X(I) + TEMP*A(L+I,J)
309 IF (NOUNIT) X(J) = X(J)*A(1,J)
316 IF (X(JX).NE.ZERO) THEN
320 DO 70 I = MIN(N,J+K),J + 1,-1
321 X(IX) = X(IX) + TEMP*A(L+I,J)
324 IF (NOUNIT) X(JX) = X(JX)*A(1,J)
327 IF ((N-J).GE.K) KX = KX - INCX
335 IF (LSAME(UPLO,'U')) THEN
341 IF (NOUNIT) TEMP = TEMP*A(KPLUS1,J)
342 DO 90 I = J - 1,MAX(1,J-K),-1
343 TEMP = TEMP + A(L+I,J)*X(I)
355 IF (NOUNIT) TEMP = TEMP*A(KPLUS1,J)
356 DO 110 I = J - 1,MAX(1,J-K),-1
357 TEMP = TEMP + A(L+I,J)*X(IX)
369 IF (NOUNIT) TEMP = TEMP*A(1,J)
370 DO 130 I = J + 1,MIN(N,J+K)
371 TEMP = TEMP + A(L+I,J)*X(I)
382 IF (NOUNIT) TEMP = TEMP*A(1,J)
383 DO 150 I = J + 1,MIN(N,J+K)
384 TEMP = TEMP + A(L+I,J)*X(IX)