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