Statistiques
| Révision :

root / src / blas / chbmv.f @ 11

Historique | Voir | Annoter | Télécharger (9,49 ko)

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