3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
11 * SUBROUTINE SGBMV(TRANS,M,N,KL,KU,ALPHA,A,LDA,X,INCX,BETA,Y,INCY)
13 * .. Scalar Arguments ..
15 * INTEGER INCX,INCY,KL,KU,LDA,M,N
18 * .. Array Arguments ..
19 * REAL A(LDA,*),X(*),Y(*)
28 *> SGBMV performs one of the matrix-vector operations
30 *> y := alpha*A*x + beta*y, or y := alpha*A**T*x + beta*y,
32 *> where alpha and beta are scalars, x and y are vectors and A is an
33 *> m by n band matrix, with kl sub-diagonals and ku super-diagonals.
41 *> TRANS is CHARACTER*1
42 *> On entry, TRANS specifies the operation to be performed as
45 *> TRANS = 'N' or 'n' y := alpha*A*x + beta*y.
47 *> TRANS = 'T' or 't' y := alpha*A**T*x + beta*y.
49 *> TRANS = 'C' or 'c' y := alpha*A**T*x + beta*y.
55 *> On entry, M specifies the number of rows of the matrix A.
56 *> M must be at least zero.
62 *> On entry, N specifies the number of columns of the matrix A.
63 *> N must be at least zero.
69 *> On entry, KL specifies the number of sub-diagonals of the
70 *> matrix A. KL must satisfy 0 .le. KL.
76 *> On entry, KU specifies the number of super-diagonals of the
77 *> matrix A. KU must satisfy 0 .le. KU.
83 *> On entry, ALPHA specifies the scalar alpha.
88 *> A is REAL array of DIMENSION ( LDA, n ).
89 *> Before entry, the leading ( kl + ku + 1 ) by n part of the
90 *> array A must contain the matrix of coefficients, supplied
91 *> column by column, with the leading diagonal of the matrix in
92 *> row ( ku + 1 ) of the array, the first super-diagonal
93 *> starting at position 2 in row ku, the first sub-diagonal
94 *> starting at position 1 in row ( ku + 2 ), and so on.
95 *> Elements in the array A that do not correspond to elements
96 *> in the band matrix (such as the top left ku by ku triangle)
97 *> are not referenced.
98 *> The following program segment will transfer a band matrix
99 *> from conventional full matrix storage to band storage:
103 *> DO 10, I = MAX( 1, J - KU ), MIN( M, J + KL )
104 *> A( K + I, J ) = matrix( I, J )
112 *> On entry, LDA specifies the first dimension of A as declared
113 *> in the calling (sub) program. LDA must be at least
119 *> X is REAL array of DIMENSION at least
120 *> ( 1 + ( n - 1 )*abs( INCX ) ) when TRANS = 'N' or 'n'
122 *> ( 1 + ( m - 1 )*abs( INCX ) ) otherwise.
123 *> Before entry, the incremented array X must contain the
130 *> On entry, INCX specifies the increment for the elements of
131 *> X. INCX must not be zero.
137 *> On entry, BETA specifies the scalar beta. When BETA is
138 *> supplied as zero then Y need not be set on input.
143 *> Y is REAL array of DIMENSION at least
144 *> ( 1 + ( m - 1 )*abs( INCY ) ) when TRANS = 'N' or 'n'
146 *> ( 1 + ( n - 1 )*abs( INCY ) ) otherwise.
147 *> Before entry, the incremented array Y must contain the
148 *> vector y. On exit, Y is overwritten by the updated vector y.
154 *> On entry, INCY specifies the increment for the elements of
155 *> Y. INCY must not be zero.
161 *> \author Univ. of Tennessee
162 *> \author Univ. of California Berkeley
163 *> \author Univ. of Colorado Denver
166 *> \date November 2015
168 *> \ingroup single_blas_level2
170 *> \par Further Details:
171 * =====================
175 *> Level 2 Blas routine.
176 *> The vector and matrix arguments are not referenced when N = 0, or M = 0
178 *> -- Written on 22-October-1986.
179 *> Jack Dongarra, Argonne National Lab.
180 *> Jeremy Du Croz, Nag Central Office.
181 *> Sven Hammarling, Nag Central Office.
182 *> Richard Hanson, Sandia National Labs.
185 * =====================================================================
186 SUBROUTINE SGBMV(TRANS,M,N,KL,KU,ALPHA,A,LDA,X,INCX,BETA,Y,INCY)
188 * -- Reference BLAS level2 routine (version 3.6.0) --
189 * -- Reference BLAS is a software package provided by Univ. of Tennessee, --
190 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
193 * .. Scalar Arguments ..
195 INTEGER INCX,INCY,KL,KU,LDA,M,N
198 * .. Array Arguments ..
199 REAL A(LDA,*),X(*),Y(*)
202 * =====================================================================
206 PARAMETER (ONE=1.0E+0,ZERO=0.0E+0)
208 * .. Local Scalars ..
210 INTEGER I,INFO,IX,IY,J,JX,JY,K,KUP1,KX,KY,LENX,LENY
212 * .. External Functions ..
216 * .. External Subroutines ..
219 * .. Intrinsic Functions ..
223 * Test the input parameters.
226 IF (.NOT.LSAME(TRANS,'N') .AND. .NOT.LSAME(TRANS,'T') .AND.
227 + .NOT.LSAME(TRANS,'C')) THEN
229 ELSE IF (M.LT.0) THEN
231 ELSE IF (N.LT.0) THEN
233 ELSE IF (KL.LT.0) THEN
235 ELSE IF (KU.LT.0) THEN
237 ELSE IF (LDA.LT. (KL+KU+1)) THEN
239 ELSE IF (INCX.EQ.0) THEN
241 ELSE IF (INCY.EQ.0) THEN
245 CALL XERBLA('SGBMV ',INFO)
249 * Quick return if possible.
251 IF ((M.EQ.0) .OR. (N.EQ.0) .OR.
252 + ((ALPHA.EQ.ZERO).AND. (BETA.EQ.ONE))) RETURN
254 * Set LENX and LENY, the lengths of the vectors x and y, and set
255 * up the start points in X and Y.
257 IF (LSAME(TRANS,'N')) THEN
267 KX = 1 - (LENX-1)*INCX
272 KY = 1 - (LENY-1)*INCY
275 * Start the operations. In this version the elements of A are
276 * accessed sequentially with one pass through the band part of A.
278 * First form y := beta*y.
280 IF (BETA.NE.ONE) THEN
282 IF (BETA.EQ.ZERO) THEN
293 IF (BETA.EQ.ZERO) THEN
306 IF (ALPHA.EQ.ZERO) RETURN
308 IF (LSAME(TRANS,'N')) THEN
310 * Form y := alpha*A*x + y.
317 DO 50 I = MAX(1,J-KU),MIN(M,J+KL)
318 Y(I) = Y(I) + TEMP*A(K+I,J)
327 DO 70 I = MAX(1,J-KU),MIN(M,J+KL)
328 Y(IY) = Y(IY) + TEMP*A(K+I,J)
332 IF (J.GT.KU) KY = KY + INCY
337 * Form y := alpha*A**T*x + y.
344 DO 90 I = MAX(1,J-KU),MIN(M,J+KL)
345 TEMP = TEMP + A(K+I,J)*X(I)
347 Y(JY) = Y(JY) + ALPHA*TEMP
355 DO 110 I = MAX(1,J-KU),MIN(M,J+KL)
356 TEMP = TEMP + A(K+I,J)*X(IX)
359 Y(JY) = Y(JY) + ALPHA*TEMP
361 IF (J.GT.KU) KX = KX + INCX