![]() |
LAPACK
3.4.1
LAPACK: Linear Algebra PACKage
|
00001 *> \brief \b STBMV 00002 * 00003 * =========== DOCUMENTATION =========== 00004 * 00005 * Online html documentation available at 00006 * http://www.netlib.org/lapack/explore-html/ 00007 * 00008 * Definition: 00009 * =========== 00010 * 00011 * SUBROUTINE STBMV(UPLO,TRANS,DIAG,N,K,A,LDA,X,INCX) 00012 * 00013 * .. Scalar Arguments .. 00014 * INTEGER INCX,K,LDA,N 00015 * CHARACTER DIAG,TRANS,UPLO 00016 * .. 00017 * .. Array Arguments .. 00018 * REAL A(LDA,*),X(*) 00019 * .. 00020 * 00021 * 00022 *> \par Purpose: 00023 * ============= 00024 *> 00025 *> \verbatim 00026 *> 00027 *> STBMV performs one of the matrix-vector operations 00028 *> 00029 *> x := A*x, or x := A**T*x, 00030 *> 00031 *> where x is an n element vector and A is an n by n unit, or non-unit, 00032 *> upper or lower triangular band matrix, with ( k + 1 ) diagonals. 00033 *> \endverbatim 00034 * 00035 * Arguments: 00036 * ========== 00037 * 00038 *> \param[in] UPLO 00039 *> \verbatim 00040 *> UPLO is CHARACTER*1 00041 *> On entry, UPLO specifies whether the matrix is an upper or 00042 *> lower triangular matrix as follows: 00043 *> 00044 *> UPLO = 'U' or 'u' A is an upper triangular matrix. 00045 *> 00046 *> UPLO = 'L' or 'l' A is a lower triangular matrix. 00047 *> \endverbatim 00048 *> 00049 *> \param[in] TRANS 00050 *> \verbatim 00051 *> TRANS is CHARACTER*1 00052 *> On entry, TRANS specifies the operation to be performed as 00053 *> follows: 00054 *> 00055 *> TRANS = 'N' or 'n' x := A*x. 00056 *> 00057 *> TRANS = 'T' or 't' x := A**T*x. 00058 *> 00059 *> TRANS = 'C' or 'c' x := A**T*x. 00060 *> \endverbatim 00061 *> 00062 *> \param[in] DIAG 00063 *> \verbatim 00064 *> DIAG is CHARACTER*1 00065 *> On entry, DIAG specifies whether or not A is unit 00066 *> triangular as follows: 00067 *> 00068 *> DIAG = 'U' or 'u' A is assumed to be unit triangular. 00069 *> 00070 *> DIAG = 'N' or 'n' A is not assumed to be unit 00071 *> triangular. 00072 *> \endverbatim 00073 *> 00074 *> \param[in] N 00075 *> \verbatim 00076 *> N is INTEGER 00077 *> On entry, N specifies the order of the matrix A. 00078 *> N must be at least zero. 00079 *> \endverbatim 00080 *> 00081 *> \param[in] K 00082 *> \verbatim 00083 *> K is INTEGER 00084 *> On entry with UPLO = 'U' or 'u', K specifies the number of 00085 *> super-diagonals of the matrix A. 00086 *> On entry with UPLO = 'L' or 'l', K specifies the number of 00087 *> sub-diagonals of the matrix A. 00088 *> K must satisfy 0 .le. K. 00089 *> \endverbatim 00090 *> 00091 *> \param[in] A 00092 *> \verbatim 00093 *> A is REAL array of DIMENSION ( LDA, n ). 00094 *> Before entry with UPLO = 'U' or 'u', the leading ( k + 1 ) 00095 *> by n part of the array A must contain the upper triangular 00096 *> band part of the matrix of coefficients, supplied column by 00097 *> column, with the leading diagonal of the matrix in row 00098 *> ( k + 1 ) of the array, the first super-diagonal starting at 00099 *> position 2 in row k, and so on. The top left k by k triangle 00100 *> of the array A is not referenced. 00101 *> The following program segment will transfer an upper 00102 *> triangular band matrix from conventional full matrix storage 00103 *> to band storage: 00104 *> 00105 *> DO 20, J = 1, N 00106 *> M = K + 1 - J 00107 *> DO 10, I = MAX( 1, J - K ), J 00108 *> A( M + I, J ) = matrix( I, J ) 00109 *> 10 CONTINUE 00110 *> 20 CONTINUE 00111 *> 00112 *> Before entry with UPLO = 'L' or 'l', the leading ( k + 1 ) 00113 *> by n part of the array A must contain the lower triangular 00114 *> band part of the matrix of coefficients, supplied column by 00115 *> column, with the leading diagonal of the matrix in row 1 of 00116 *> the array, the first sub-diagonal starting at position 1 in 00117 *> row 2, and so on. The bottom right k by k triangle of the 00118 *> array A is not referenced. 00119 *> The following program segment will transfer a lower 00120 *> triangular band matrix from conventional full matrix storage 00121 *> to band storage: 00122 *> 00123 *> DO 20, J = 1, N 00124 *> M = 1 - J 00125 *> DO 10, I = J, MIN( N, J + K ) 00126 *> A( M + I, J ) = matrix( I, J ) 00127 *> 10 CONTINUE 00128 *> 20 CONTINUE 00129 *> 00130 *> Note that when DIAG = 'U' or 'u' the elements of the array A 00131 *> corresponding to the diagonal elements of the matrix are not 00132 *> referenced, but are assumed to be unity. 00133 *> \endverbatim 00134 *> 00135 *> \param[in] LDA 00136 *> \verbatim 00137 *> LDA is INTEGER 00138 *> On entry, LDA specifies the first dimension of A as declared 00139 *> in the calling (sub) program. LDA must be at least 00140 *> ( k + 1 ). 00141 *> \endverbatim 00142 *> 00143 *> \param[in,out] X 00144 *> \verbatim 00145 *> X is REAL array of dimension at least 00146 *> ( 1 + ( n - 1 )*abs( INCX ) ). 00147 *> Before entry, the incremented array X must contain the n 00148 *> element vector x. On exit, X is overwritten with the 00149 *> tranformed vector x. 00150 *> \endverbatim 00151 *> 00152 *> \param[in] INCX 00153 *> \verbatim 00154 *> INCX is INTEGER 00155 *> On entry, INCX specifies the increment for the elements of 00156 *> X. INCX must not be zero. 00157 *> \endverbatim 00158 * 00159 * Authors: 00160 * ======== 00161 * 00162 *> \author Univ. of Tennessee 00163 *> \author Univ. of California Berkeley 00164 *> \author Univ. of Colorado Denver 00165 *> \author NAG Ltd. 00166 * 00167 *> \date November 2011 00168 * 00169 *> \ingroup single_blas_level2 00170 * 00171 *> \par Further Details: 00172 * ===================== 00173 *> 00174 *> \verbatim 00175 *> 00176 *> Level 2 Blas routine. 00177 *> The vector and matrix arguments are not referenced when N = 0, or M = 0 00178 *> 00179 *> -- Written on 22-October-1986. 00180 *> Jack Dongarra, Argonne National Lab. 00181 *> Jeremy Du Croz, Nag Central Office. 00182 *> Sven Hammarling, Nag Central Office. 00183 *> Richard Hanson, Sandia National Labs. 00184 *> \endverbatim 00185 *> 00186 * ===================================================================== 00187 SUBROUTINE STBMV(UPLO,TRANS,DIAG,N,K,A,LDA,X,INCX) 00188 * 00189 * -- Reference BLAS level2 routine (version 3.4.0) -- 00190 * -- Reference BLAS is a software package provided by Univ. of Tennessee, -- 00191 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 00192 * November 2011 00193 * 00194 * .. Scalar Arguments .. 00195 INTEGER INCX,K,LDA,N 00196 CHARACTER DIAG,TRANS,UPLO 00197 * .. 00198 * .. Array Arguments .. 00199 REAL A(LDA,*),X(*) 00200 * .. 00201 * 00202 * ===================================================================== 00203 * 00204 * .. Parameters .. 00205 REAL ZERO 00206 PARAMETER (ZERO=0.0E+0) 00207 * .. 00208 * .. Local Scalars .. 00209 REAL TEMP 00210 INTEGER I,INFO,IX,J,JX,KPLUS1,KX,L 00211 LOGICAL NOUNIT 00212 * .. 00213 * .. External Functions .. 00214 LOGICAL LSAME 00215 EXTERNAL LSAME 00216 * .. 00217 * .. External Subroutines .. 00218 EXTERNAL XERBLA 00219 * .. 00220 * .. Intrinsic Functions .. 00221 INTRINSIC MAX,MIN 00222 * .. 00223 * 00224 * Test the input parameters. 00225 * 00226 INFO = 0 00227 IF (.NOT.LSAME(UPLO,'U') .AND. .NOT.LSAME(UPLO,'L')) THEN 00228 INFO = 1 00229 ELSE IF (.NOT.LSAME(TRANS,'N') .AND. .NOT.LSAME(TRANS,'T') .AND. 00230 + .NOT.LSAME(TRANS,'C')) THEN 00231 INFO = 2 00232 ELSE IF (.NOT.LSAME(DIAG,'U') .AND. .NOT.LSAME(DIAG,'N')) THEN 00233 INFO = 3 00234 ELSE IF (N.LT.0) THEN 00235 INFO = 4 00236 ELSE IF (K.LT.0) THEN 00237 INFO = 5 00238 ELSE IF (LDA.LT. (K+1)) THEN 00239 INFO = 7 00240 ELSE IF (INCX.EQ.0) THEN 00241 INFO = 9 00242 END IF 00243 IF (INFO.NE.0) THEN 00244 CALL XERBLA('STBMV ',INFO) 00245 RETURN 00246 END IF 00247 * 00248 * Quick return if possible. 00249 * 00250 IF (N.EQ.0) RETURN 00251 * 00252 NOUNIT = LSAME(DIAG,'N') 00253 * 00254 * Set up the start point in X if the increment is not unity. This 00255 * will be ( N - 1 )*INCX too small for descending loops. 00256 * 00257 IF (INCX.LE.0) THEN 00258 KX = 1 - (N-1)*INCX 00259 ELSE IF (INCX.NE.1) THEN 00260 KX = 1 00261 END IF 00262 * 00263 * Start the operations. In this version the elements of A are 00264 * accessed sequentially with one pass through A. 00265 * 00266 IF (LSAME(TRANS,'N')) THEN 00267 * 00268 * Form x := A*x. 00269 * 00270 IF (LSAME(UPLO,'U')) THEN 00271 KPLUS1 = K + 1 00272 IF (INCX.EQ.1) THEN 00273 DO 20 J = 1,N 00274 IF (X(J).NE.ZERO) THEN 00275 TEMP = X(J) 00276 L = KPLUS1 - J 00277 DO 10 I = MAX(1,J-K),J - 1 00278 X(I) = X(I) + TEMP*A(L+I,J) 00279 10 CONTINUE 00280 IF (NOUNIT) X(J) = X(J)*A(KPLUS1,J) 00281 END IF 00282 20 CONTINUE 00283 ELSE 00284 JX = KX 00285 DO 40 J = 1,N 00286 IF (X(JX).NE.ZERO) THEN 00287 TEMP = X(JX) 00288 IX = KX 00289 L = KPLUS1 - J 00290 DO 30 I = MAX(1,J-K),J - 1 00291 X(IX) = X(IX) + TEMP*A(L+I,J) 00292 IX = IX + INCX 00293 30 CONTINUE 00294 IF (NOUNIT) X(JX) = X(JX)*A(KPLUS1,J) 00295 END IF 00296 JX = JX + INCX 00297 IF (J.GT.K) KX = KX + INCX 00298 40 CONTINUE 00299 END IF 00300 ELSE 00301 IF (INCX.EQ.1) THEN 00302 DO 60 J = N,1,-1 00303 IF (X(J).NE.ZERO) THEN 00304 TEMP = X(J) 00305 L = 1 - J 00306 DO 50 I = MIN(N,J+K),J + 1,-1 00307 X(I) = X(I) + TEMP*A(L+I,J) 00308 50 CONTINUE 00309 IF (NOUNIT) X(J) = X(J)*A(1,J) 00310 END IF 00311 60 CONTINUE 00312 ELSE 00313 KX = KX + (N-1)*INCX 00314 JX = KX 00315 DO 80 J = N,1,-1 00316 IF (X(JX).NE.ZERO) THEN 00317 TEMP = X(JX) 00318 IX = KX 00319 L = 1 - J 00320 DO 70 I = MIN(N,J+K),J + 1,-1 00321 X(IX) = X(IX) + TEMP*A(L+I,J) 00322 IX = IX - INCX 00323 70 CONTINUE 00324 IF (NOUNIT) X(JX) = X(JX)*A(1,J) 00325 END IF 00326 JX = JX - INCX 00327 IF ((N-J).GE.K) KX = KX - INCX 00328 80 CONTINUE 00329 END IF 00330 END IF 00331 ELSE 00332 * 00333 * Form x := A**T*x. 00334 * 00335 IF (LSAME(UPLO,'U')) THEN 00336 KPLUS1 = K + 1 00337 IF (INCX.EQ.1) THEN 00338 DO 100 J = N,1,-1 00339 TEMP = X(J) 00340 L = KPLUS1 - J 00341 IF (NOUNIT) TEMP = TEMP*A(KPLUS1,J) 00342 DO 90 I = J - 1,MAX(1,J-K),-1 00343 TEMP = TEMP + A(L+I,J)*X(I) 00344 90 CONTINUE 00345 X(J) = TEMP 00346 100 CONTINUE 00347 ELSE 00348 KX = KX + (N-1)*INCX 00349 JX = KX 00350 DO 120 J = N,1,-1 00351 TEMP = X(JX) 00352 KX = KX - INCX 00353 IX = KX 00354 L = KPLUS1 - J 00355 IF (NOUNIT) TEMP = TEMP*A(KPLUS1,J) 00356 DO 110 I = J - 1,MAX(1,J-K),-1 00357 TEMP = TEMP + A(L+I,J)*X(IX) 00358 IX = IX - INCX 00359 110 CONTINUE 00360 X(JX) = TEMP 00361 JX = JX - INCX 00362 120 CONTINUE 00363 END IF 00364 ELSE 00365 IF (INCX.EQ.1) THEN 00366 DO 140 J = 1,N 00367 TEMP = X(J) 00368 L = 1 - J 00369 IF (NOUNIT) TEMP = TEMP*A(1,J) 00370 DO 130 I = J + 1,MIN(N,J+K) 00371 TEMP = TEMP + A(L+I,J)*X(I) 00372 130 CONTINUE 00373 X(J) = TEMP 00374 140 CONTINUE 00375 ELSE 00376 JX = KX 00377 DO 160 J = 1,N 00378 TEMP = X(JX) 00379 KX = KX + INCX 00380 IX = KX 00381 L = 1 - J 00382 IF (NOUNIT) TEMP = TEMP*A(1,J) 00383 DO 150 I = J + 1,MIN(N,J+K) 00384 TEMP = TEMP + A(L+I,J)*X(IX) 00385 IX = IX + INCX 00386 150 CONTINUE 00387 X(JX) = TEMP 00388 JX = JX + INCX 00389 160 CONTINUE 00390 END IF 00391 END IF 00392 END IF 00393 * 00394 RETURN 00395 * 00396 * End of STBMV . 00397 * 00398 END