source: pacpussensors/trunk/Vislab/lib3dv-1.2.0/lib3dv/eigen/blas/dtbmv.f@ 141

Last change on this file since 141 was 136, checked in by ldecherf, 8 years ago

Doc

File size: 10.9 KB
Line 
1 SUBROUTINE DTBMV(UPLO,TRANS,DIAG,N,K,A,LDA,X,INCX)
2* .. Scalar Arguments ..
3 INTEGER INCX,K,LDA,N
4 CHARACTER DIAG,TRANS,UPLO
5* ..
6* .. Array Arguments ..
7 DOUBLE PRECISION A(LDA,*),X(*)
8* ..
9*
10* Purpose
11* =======
12*
13* DTBMV performs one of the matrix-vector operations
14*
15* x := A*x, or x := A'*x,
16*
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.
19*
20* Arguments
21* ==========
22*
23* UPLO - CHARACTER*1.
24* On entry, UPLO specifies whether the matrix is an upper or
25* lower triangular matrix as follows:
26*
27* UPLO = 'U' or 'u' A is an upper triangular matrix.
28*
29* UPLO = 'L' or 'l' A is a lower triangular matrix.
30*
31* Unchanged on exit.
32*
33* TRANS - CHARACTER*1.
34* On entry, TRANS specifies the operation to be performed as
35* follows:
36*
37* TRANS = 'N' or 'n' x := A*x.
38*
39* TRANS = 'T' or 't' x := A'*x.
40*
41* TRANS = 'C' or 'c' x := A'*x.
42*
43* Unchanged on exit.
44*
45* DIAG - CHARACTER*1.
46* On entry, DIAG specifies whether or not A is unit
47* triangular as follows:
48*
49* DIAG = 'U' or 'u' A is assumed to be unit triangular.
50*
51* DIAG = 'N' or 'n' A is not assumed to be unit
52* triangular.
53*
54* Unchanged on exit.
55*
56* N - INTEGER.
57* On entry, N specifies the order of the matrix A.
58* N must be at least zero.
59* Unchanged on exit.
60*
61* K - INTEGER.
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.
67* Unchanged on exit.
68*
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
79* to band storage:
80*
81* DO 20, J = 1, N
82* M = K + 1 - J
83* DO 10, I = MAX( 1, J - K ), J
84* A( M + I, J ) = matrix( I, J )
85* 10 CONTINUE
86* 20 CONTINUE
87*
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
97* to band storage:
98*
99* DO 20, J = 1, N
100* M = 1 - J
101* DO 10, I = J, MIN( N, J + K )
102* A( M + I, J ) = matrix( I, J )
103* 10 CONTINUE
104* 20 CONTINUE
105*
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.
109* Unchanged on exit.
110*
111* LDA - INTEGER.
112* On entry, LDA specifies the first dimension of A as declared
113* in the calling (sub) program. LDA must be at least
114* ( k + 1 ).
115* Unchanged on exit.
116*
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.
122*
123* INCX - INTEGER.
124* On entry, INCX specifies the increment for the elements of
125* X. INCX must not be zero.
126* Unchanged on exit.
127*
128* Further Details
129* ===============
130*
131* Level 2 Blas routine.
132*
133* -- Written on 22-October-1986.
134* Jack Dongarra, Argonne National Lab.
135* Jeremy Du Croz, Nag Central Office.
136* Sven Hammarling, Nag Central Office.
137* Richard Hanson, Sandia National Labs.
138*
139* =====================================================================
140*
141* .. Parameters ..
142 DOUBLE PRECISION ZERO
143 PARAMETER (ZERO=0.0D+0)
144* ..
145* .. Local Scalars ..
146 DOUBLE PRECISION TEMP
147 INTEGER I,INFO,IX,J,JX,KPLUS1,KX,L
148 LOGICAL NOUNIT
149* ..
150* .. External Functions ..
151 LOGICAL LSAME
152 EXTERNAL LSAME
153* ..
154* .. External Subroutines ..
155 EXTERNAL XERBLA
156* ..
157* .. Intrinsic Functions ..
158 INTRINSIC MAX,MIN
159* ..
160*
161* Test the input parameters.
162*
163 INFO = 0
164 IF (.NOT.LSAME(UPLO,'U') .AND. .NOT.LSAME(UPLO,'L')) THEN
165 INFO = 1
166 ELSE IF (.NOT.LSAME(TRANS,'N') .AND. .NOT.LSAME(TRANS,'T') .AND.
167 + .NOT.LSAME(TRANS,'C')) THEN
168 INFO = 2
169 ELSE IF (.NOT.LSAME(DIAG,'U') .AND. .NOT.LSAME(DIAG,'N')) THEN
170 INFO = 3
171 ELSE IF (N.LT.0) THEN
172 INFO = 4
173 ELSE IF (K.LT.0) THEN
174 INFO = 5
175 ELSE IF (LDA.LT. (K+1)) THEN
176 INFO = 7
177 ELSE IF (INCX.EQ.0) THEN
178 INFO = 9
179 END IF
180 IF (INFO.NE.0) THEN
181 CALL XERBLA('DTBMV ',INFO)
182 RETURN
183 END IF
184*
185* Quick return if possible.
186*
187 IF (N.EQ.0) RETURN
188*
189 NOUNIT = LSAME(DIAG,'N')
190*
191* Set up the start point in X if the increment is not unity. This
192* will be ( N - 1 )*INCX too small for descending loops.
193*
194 IF (INCX.LE.0) THEN
195 KX = 1 - (N-1)*INCX
196 ELSE IF (INCX.NE.1) THEN
197 KX = 1
198 END IF
199*
200* Start the operations. In this version the elements of A are
201* accessed sequentially with one pass through A.
202*
203 IF (LSAME(TRANS,'N')) THEN
204*
205* Form x := A*x.
206*
207 IF (LSAME(UPLO,'U')) THEN
208 KPLUS1 = K + 1
209 IF (INCX.EQ.1) THEN
210 DO 20 J = 1,N
211 IF (X(J).NE.ZERO) THEN
212 TEMP = X(J)
213 L = KPLUS1 - J
214 DO 10 I = MAX(1,J-K),J - 1
215 X(I) = X(I) + TEMP*A(L+I,J)
216 10 CONTINUE
217 IF (NOUNIT) X(J) = X(J)*A(KPLUS1,J)
218 END IF
219 20 CONTINUE
220 ELSE
221 JX = KX
222 DO 40 J = 1,N
223 IF (X(JX).NE.ZERO) THEN
224 TEMP = X(JX)
225 IX = KX
226 L = KPLUS1 - J
227 DO 30 I = MAX(1,J-K),J - 1
228 X(IX) = X(IX) + TEMP*A(L+I,J)
229 IX = IX + INCX
230 30 CONTINUE
231 IF (NOUNIT) X(JX) = X(JX)*A(KPLUS1,J)
232 END IF
233 JX = JX + INCX
234 IF (J.GT.K) KX = KX + INCX
235 40 CONTINUE
236 END IF
237 ELSE
238 IF (INCX.EQ.1) THEN
239 DO 60 J = N,1,-1
240 IF (X(J).NE.ZERO) THEN
241 TEMP = X(J)
242 L = 1 - J
243 DO 50 I = MIN(N,J+K),J + 1,-1
244 X(I) = X(I) + TEMP*A(L+I,J)
245 50 CONTINUE
246 IF (NOUNIT) X(J) = X(J)*A(1,J)
247 END IF
248 60 CONTINUE
249 ELSE
250 KX = KX + (N-1)*INCX
251 JX = KX
252 DO 80 J = N,1,-1
253 IF (X(JX).NE.ZERO) THEN
254 TEMP = X(JX)
255 IX = KX
256 L = 1 - J
257 DO 70 I = MIN(N,J+K),J + 1,-1
258 X(IX) = X(IX) + TEMP*A(L+I,J)
259 IX = IX - INCX
260 70 CONTINUE
261 IF (NOUNIT) X(JX) = X(JX)*A(1,J)
262 END IF
263 JX = JX - INCX
264 IF ((N-J).GE.K) KX = KX - INCX
265 80 CONTINUE
266 END IF
267 END IF
268 ELSE
269*
270* Form x := A'*x.
271*
272 IF (LSAME(UPLO,'U')) THEN
273 KPLUS1 = K + 1
274 IF (INCX.EQ.1) THEN
275 DO 100 J = N,1,-1
276 TEMP = X(J)
277 L = KPLUS1 - J
278 IF (NOUNIT) TEMP = TEMP*A(KPLUS1,J)
279 DO 90 I = J - 1,MAX(1,J-K),-1
280 TEMP = TEMP + A(L+I,J)*X(I)
281 90 CONTINUE
282 X(J) = TEMP
283 100 CONTINUE
284 ELSE
285 KX = KX + (N-1)*INCX
286 JX = KX
287 DO 120 J = N,1,-1
288 TEMP = X(JX)
289 KX = KX - INCX
290 IX = KX
291 L = KPLUS1 - J
292 IF (NOUNIT) TEMP = TEMP*A(KPLUS1,J)
293 DO 110 I = J - 1,MAX(1,J-K),-1
294 TEMP = TEMP + A(L+I,J)*X(IX)
295 IX = IX - INCX
296 110 CONTINUE
297 X(JX) = TEMP
298 JX = JX - INCX
299 120 CONTINUE
300 END IF
301 ELSE
302 IF (INCX.EQ.1) THEN
303 DO 140 J = 1,N
304 TEMP = X(J)
305 L = 1 - J
306 IF (NOUNIT) TEMP = TEMP*A(1,J)
307 DO 130 I = J + 1,MIN(N,J+K)
308 TEMP = TEMP + A(L+I,J)*X(I)
309 130 CONTINUE
310 X(J) = TEMP
311 140 CONTINUE
312 ELSE
313 JX = KX
314 DO 160 J = 1,N
315 TEMP = X(JX)
316 KX = KX + INCX
317 IX = KX
318 L = 1 - J
319 IF (NOUNIT) TEMP = TEMP*A(1,J)
320 DO 150 I = J + 1,MIN(N,J+K)
321 TEMP = TEMP + A(L+I,J)*X(IX)
322 IX = IX + INCX
323 150 CONTINUE
324 X(JX) = TEMP
325 JX = JX + INCX
326 160 CONTINUE
327 END IF
328 END IF
329 END IF
330*
331 RETURN
332*
333* End of DTBMV .
334*
335 END
Note: See TracBrowser for help on using the repository browser.