root / src / blas / zhpmv.f @ 11
Historique | Voir | Annoter | Télécharger (8,02 ko)
1 | 1 | pfleura2 | SUBROUTINE ZHPMV(UPLO,N,ALPHA,AP,X,INCX,BETA,Y,INCY) |
---|---|---|---|
2 | 1 | pfleura2 | * .. Scalar Arguments .. |
3 | 1 | pfleura2 | DOUBLE COMPLEX ALPHA,BETA |
4 | 1 | pfleura2 | INTEGER INCX,INCY,N |
5 | 1 | pfleura2 | CHARACTER UPLO |
6 | 1 | pfleura2 | * .. |
7 | 1 | pfleura2 | * .. Array Arguments .. |
8 | 1 | pfleura2 | DOUBLE COMPLEX AP(*),X(*),Y(*) |
9 | 1 | pfleura2 | * .. |
10 | 1 | pfleura2 | * |
11 | 1 | pfleura2 | * Purpose |
12 | 1 | pfleura2 | * ======= |
13 | 1 | pfleura2 | * |
14 | 1 | pfleura2 | * ZHPMV 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 matrix, supplied in packed form. |
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 matrix A is supplied in the packed |
27 | 1 | pfleura2 | * array AP as follows: |
28 | 1 | pfleura2 | * |
29 | 1 | pfleura2 | * UPLO = 'U' or 'u' The upper triangular part of A is |
30 | 1 | pfleura2 | * supplied in AP. |
31 | 1 | pfleura2 | * |
32 | 1 | pfleura2 | * UPLO = 'L' or 'l' The lower triangular part of A is |
33 | 1 | pfleura2 | * supplied in AP. |
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 | * ALPHA - COMPLEX*16 . |
43 | 1 | pfleura2 | * On entry, ALPHA specifies the scalar alpha. |
44 | 1 | pfleura2 | * Unchanged on exit. |
45 | 1 | pfleura2 | * |
46 | 1 | pfleura2 | * AP - COMPLEX*16 array of DIMENSION at least |
47 | 1 | pfleura2 | * ( ( n*( n + 1 ) )/2 ). |
48 | 1 | pfleura2 | * Before entry with UPLO = 'U' or 'u', the array AP must |
49 | 1 | pfleura2 | * contain the upper triangular part of the hermitian matrix |
50 | 1 | pfleura2 | * packed sequentially, column by column, so that AP( 1 ) |
51 | 1 | pfleura2 | * contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 1, 2 ) |
52 | 1 | pfleura2 | * and a( 2, 2 ) respectively, and so on. |
53 | 1 | pfleura2 | * Before entry with UPLO = 'L' or 'l', the array AP must |
54 | 1 | pfleura2 | * contain the lower triangular part of the hermitian matrix |
55 | 1 | pfleura2 | * packed sequentially, column by column, so that AP( 1 ) |
56 | 1 | pfleura2 | * contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 2, 1 ) |
57 | 1 | pfleura2 | * and a( 3, 1 ) respectively, and so on. |
58 | 1 | pfleura2 | * Note that the imaginary parts of the diagonal elements need |
59 | 1 | pfleura2 | * not be set and are assumed to be zero. |
60 | 1 | pfleura2 | * Unchanged on exit. |
61 | 1 | pfleura2 | * |
62 | 1 | pfleura2 | * X - COMPLEX*16 array of dimension at least |
63 | 1 | pfleura2 | * ( 1 + ( n - 1 )*abs( INCX ) ). |
64 | 1 | pfleura2 | * Before entry, the incremented array X must contain the n |
65 | 1 | pfleura2 | * element vector x. |
66 | 1 | pfleura2 | * Unchanged on exit. |
67 | 1 | pfleura2 | * |
68 | 1 | pfleura2 | * INCX - INTEGER. |
69 | 1 | pfleura2 | * On entry, INCX specifies the increment for the elements of |
70 | 1 | pfleura2 | * X. INCX must not be zero. |
71 | 1 | pfleura2 | * Unchanged on exit. |
72 | 1 | pfleura2 | * |
73 | 1 | pfleura2 | * BETA - COMPLEX*16 . |
74 | 1 | pfleura2 | * On entry, BETA specifies the scalar beta. When BETA is |
75 | 1 | pfleura2 | * supplied as zero then Y need not be set on input. |
76 | 1 | pfleura2 | * Unchanged on exit. |
77 | 1 | pfleura2 | * |
78 | 1 | pfleura2 | * Y - COMPLEX*16 array of dimension at least |
79 | 1 | pfleura2 | * ( 1 + ( n - 1 )*abs( INCY ) ). |
80 | 1 | pfleura2 | * Before entry, the incremented array Y must contain the n |
81 | 1 | pfleura2 | * element vector y. On exit, Y is overwritten by the updated |
82 | 1 | pfleura2 | * vector y. |
83 | 1 | pfleura2 | * |
84 | 1 | pfleura2 | * INCY - INTEGER. |
85 | 1 | pfleura2 | * On entry, INCY specifies the increment for the elements of |
86 | 1 | pfleura2 | * Y. INCY must not be zero. |
87 | 1 | pfleura2 | * Unchanged on exit. |
88 | 1 | pfleura2 | * |
89 | 1 | pfleura2 | * |
90 | 1 | pfleura2 | * Level 2 Blas routine. |
91 | 1 | pfleura2 | * |
92 | 1 | pfleura2 | * -- Written on 22-October-1986. |
93 | 1 | pfleura2 | * Jack Dongarra, Argonne National Lab. |
94 | 1 | pfleura2 | * Jeremy Du Croz, Nag Central Office. |
95 | 1 | pfleura2 | * Sven Hammarling, Nag Central Office. |
96 | 1 | pfleura2 | * Richard Hanson, Sandia National Labs. |
97 | 1 | pfleura2 | * |
98 | 1 | pfleura2 | * |
99 | 1 | pfleura2 | * .. Parameters .. |
100 | 1 | pfleura2 | DOUBLE COMPLEX ONE |
101 | 1 | pfleura2 | PARAMETER (ONE= (1.0D+0,0.0D+0)) |
102 | 1 | pfleura2 | DOUBLE COMPLEX ZERO |
103 | 1 | pfleura2 | PARAMETER (ZERO= (0.0D+0,0.0D+0)) |
104 | 1 | pfleura2 | * .. |
105 | 1 | pfleura2 | * .. Local Scalars .. |
106 | 1 | pfleura2 | DOUBLE COMPLEX TEMP1,TEMP2 |
107 | 1 | pfleura2 | INTEGER I,INFO,IX,IY,J,JX,JY,K,KK,KX,KY |
108 | 1 | pfleura2 | * .. |
109 | 1 | pfleura2 | * .. External Functions .. |
110 | 1 | pfleura2 | LOGICAL LSAME |
111 | 1 | pfleura2 | EXTERNAL LSAME |
112 | 1 | pfleura2 | * .. |
113 | 1 | pfleura2 | * .. External Subroutines .. |
114 | 1 | pfleura2 | EXTERNAL XERBLA |
115 | 1 | pfleura2 | * .. |
116 | 1 | pfleura2 | * .. Intrinsic Functions .. |
117 | 1 | pfleura2 | INTRINSIC DBLE,DCONJG |
118 | 1 | pfleura2 | * .. |
119 | 1 | pfleura2 | * |
120 | 1 | pfleura2 | * Test the input parameters. |
121 | 1 | pfleura2 | * |
122 | 1 | pfleura2 | INFO = 0 |
123 | 1 | pfleura2 | IF (.NOT.LSAME(UPLO,'U') .AND. .NOT.LSAME(UPLO,'L')) THEN |
124 | 1 | pfleura2 | INFO = 1 |
125 | 1 | pfleura2 | ELSE IF (N.LT.0) THEN |
126 | 1 | pfleura2 | INFO = 2 |
127 | 1 | pfleura2 | ELSE IF (INCX.EQ.0) THEN |
128 | 1 | pfleura2 | INFO = 6 |
129 | 1 | pfleura2 | ELSE IF (INCY.EQ.0) THEN |
130 | 1 | pfleura2 | INFO = 9 |
131 | 1 | pfleura2 | END IF |
132 | 1 | pfleura2 | IF (INFO.NE.0) THEN |
133 | 1 | pfleura2 | CALL XERBLA('ZHPMV ',INFO) |
134 | 1 | pfleura2 | RETURN |
135 | 1 | pfleura2 | END IF |
136 | 1 | pfleura2 | * |
137 | 1 | pfleura2 | * Quick return if possible. |
138 | 1 | pfleura2 | * |
139 | 1 | pfleura2 | IF ((N.EQ.0) .OR. ((ALPHA.EQ.ZERO).AND. (BETA.EQ.ONE))) RETURN |
140 | 1 | pfleura2 | * |
141 | 1 | pfleura2 | * Set up the start points in X and Y. |
142 | 1 | pfleura2 | * |
143 | 1 | pfleura2 | IF (INCX.GT.0) THEN |
144 | 1 | pfleura2 | KX = 1 |
145 | 1 | pfleura2 | ELSE |
146 | 1 | pfleura2 | KX = 1 - (N-1)*INCX |
147 | 1 | pfleura2 | END IF |
148 | 1 | pfleura2 | IF (INCY.GT.0) THEN |
149 | 1 | pfleura2 | KY = 1 |
150 | 1 | pfleura2 | ELSE |
151 | 1 | pfleura2 | KY = 1 - (N-1)*INCY |
152 | 1 | pfleura2 | END IF |
153 | 1 | pfleura2 | * |
154 | 1 | pfleura2 | * Start the operations. In this version the elements of the array AP |
155 | 1 | pfleura2 | * are accessed sequentially with one pass through AP. |
156 | 1 | pfleura2 | * |
157 | 1 | pfleura2 | * First form y := beta*y. |
158 | 1 | pfleura2 | * |
159 | 1 | pfleura2 | IF (BETA.NE.ONE) THEN |
160 | 1 | pfleura2 | IF (INCY.EQ.1) THEN |
161 | 1 | pfleura2 | IF (BETA.EQ.ZERO) THEN |
162 | 1 | pfleura2 | DO 10 I = 1,N |
163 | 1 | pfleura2 | Y(I) = ZERO |
164 | 1 | pfleura2 | 10 CONTINUE |
165 | 1 | pfleura2 | ELSE |
166 | 1 | pfleura2 | DO 20 I = 1,N |
167 | 1 | pfleura2 | Y(I) = BETA*Y(I) |
168 | 1 | pfleura2 | 20 CONTINUE |
169 | 1 | pfleura2 | END IF |
170 | 1 | pfleura2 | ELSE |
171 | 1 | pfleura2 | IY = KY |
172 | 1 | pfleura2 | IF (BETA.EQ.ZERO) THEN |
173 | 1 | pfleura2 | DO 30 I = 1,N |
174 | 1 | pfleura2 | Y(IY) = ZERO |
175 | 1 | pfleura2 | IY = IY + INCY |
176 | 1 | pfleura2 | 30 CONTINUE |
177 | 1 | pfleura2 | ELSE |
178 | 1 | pfleura2 | DO 40 I = 1,N |
179 | 1 | pfleura2 | Y(IY) = BETA*Y(IY) |
180 | 1 | pfleura2 | IY = IY + INCY |
181 | 1 | pfleura2 | 40 CONTINUE |
182 | 1 | pfleura2 | END IF |
183 | 1 | pfleura2 | END IF |
184 | 1 | pfleura2 | END IF |
185 | 1 | pfleura2 | IF (ALPHA.EQ.ZERO) RETURN |
186 | 1 | pfleura2 | KK = 1 |
187 | 1 | pfleura2 | IF (LSAME(UPLO,'U')) THEN |
188 | 1 | pfleura2 | * |
189 | 1 | pfleura2 | * Form y when AP contains the upper triangle. |
190 | 1 | pfleura2 | * |
191 | 1 | pfleura2 | IF ((INCX.EQ.1) .AND. (INCY.EQ.1)) THEN |
192 | 1 | pfleura2 | DO 60 J = 1,N |
193 | 1 | pfleura2 | TEMP1 = ALPHA*X(J) |
194 | 1 | pfleura2 | TEMP2 = ZERO |
195 | 1 | pfleura2 | K = KK |
196 | 1 | pfleura2 | DO 50 I = 1,J - 1 |
197 | 1 | pfleura2 | Y(I) = Y(I) + TEMP1*AP(K) |
198 | 1 | pfleura2 | TEMP2 = TEMP2 + DCONJG(AP(K))*X(I) |
199 | 1 | pfleura2 | K = K + 1 |
200 | 1 | pfleura2 | 50 CONTINUE |
201 | 1 | pfleura2 | Y(J) = Y(J) + TEMP1*DBLE(AP(KK+J-1)) + ALPHA*TEMP2 |
202 | 1 | pfleura2 | KK = KK + J |
203 | 1 | pfleura2 | 60 CONTINUE |
204 | 1 | pfleura2 | ELSE |
205 | 1 | pfleura2 | JX = KX |
206 | 1 | pfleura2 | JY = KY |
207 | 1 | pfleura2 | DO 80 J = 1,N |
208 | 1 | pfleura2 | TEMP1 = ALPHA*X(JX) |
209 | 1 | pfleura2 | TEMP2 = ZERO |
210 | 1 | pfleura2 | IX = KX |
211 | 1 | pfleura2 | IY = KY |
212 | 1 | pfleura2 | DO 70 K = KK,KK + J - 2 |
213 | 1 | pfleura2 | Y(IY) = Y(IY) + TEMP1*AP(K) |
214 | 1 | pfleura2 | TEMP2 = TEMP2 + DCONJG(AP(K))*X(IX) |
215 | 1 | pfleura2 | IX = IX + INCX |
216 | 1 | pfleura2 | IY = IY + INCY |
217 | 1 | pfleura2 | 70 CONTINUE |
218 | 1 | pfleura2 | Y(JY) = Y(JY) + TEMP1*DBLE(AP(KK+J-1)) + ALPHA*TEMP2 |
219 | 1 | pfleura2 | JX = JX + INCX |
220 | 1 | pfleura2 | JY = JY + INCY |
221 | 1 | pfleura2 | KK = KK + J |
222 | 1 | pfleura2 | 80 CONTINUE |
223 | 1 | pfleura2 | END IF |
224 | 1 | pfleura2 | ELSE |
225 | 1 | pfleura2 | * |
226 | 1 | pfleura2 | * Form y when AP contains the lower triangle. |
227 | 1 | pfleura2 | * |
228 | 1 | pfleura2 | IF ((INCX.EQ.1) .AND. (INCY.EQ.1)) THEN |
229 | 1 | pfleura2 | DO 100 J = 1,N |
230 | 1 | pfleura2 | TEMP1 = ALPHA*X(J) |
231 | 1 | pfleura2 | TEMP2 = ZERO |
232 | 1 | pfleura2 | Y(J) = Y(J) + TEMP1*DBLE(AP(KK)) |
233 | 1 | pfleura2 | K = KK + 1 |
234 | 1 | pfleura2 | DO 90 I = J + 1,N |
235 | 1 | pfleura2 | Y(I) = Y(I) + TEMP1*AP(K) |
236 | 1 | pfleura2 | TEMP2 = TEMP2 + DCONJG(AP(K))*X(I) |
237 | 1 | pfleura2 | K = K + 1 |
238 | 1 | pfleura2 | 90 CONTINUE |
239 | 1 | pfleura2 | Y(J) = Y(J) + ALPHA*TEMP2 |
240 | 1 | pfleura2 | KK = KK + (N-J+1) |
241 | 1 | pfleura2 | 100 CONTINUE |
242 | 1 | pfleura2 | ELSE |
243 | 1 | pfleura2 | JX = KX |
244 | 1 | pfleura2 | JY = KY |
245 | 1 | pfleura2 | DO 120 J = 1,N |
246 | 1 | pfleura2 | TEMP1 = ALPHA*X(JX) |
247 | 1 | pfleura2 | TEMP2 = ZERO |
248 | 1 | pfleura2 | Y(JY) = Y(JY) + TEMP1*DBLE(AP(KK)) |
249 | 1 | pfleura2 | IX = JX |
250 | 1 | pfleura2 | IY = JY |
251 | 1 | pfleura2 | DO 110 K = KK + 1,KK + N - J |
252 | 1 | pfleura2 | IX = IX + INCX |
253 | 1 | pfleura2 | IY = IY + INCY |
254 | 1 | pfleura2 | Y(IY) = Y(IY) + TEMP1*AP(K) |
255 | 1 | pfleura2 | TEMP2 = TEMP2 + DCONJG(AP(K))*X(IX) |
256 | 1 | pfleura2 | 110 CONTINUE |
257 | 1 | pfleura2 | Y(JY) = Y(JY) + ALPHA*TEMP2 |
258 | 1 | pfleura2 | JX = JX + INCX |
259 | 1 | pfleura2 | JY = JY + INCY |
260 | 1 | pfleura2 | KK = KK + (N-J+1) |
261 | 1 | pfleura2 | 120 CONTINUE |
262 | 1 | pfleura2 | END IF |
263 | 1 | pfleura2 | END IF |
264 | 1 | pfleura2 | * |
265 | 1 | pfleura2 | RETURN |
266 | 1 | pfleura2 | * |
267 | 1 | pfleura2 | * End of ZHPMV . |
268 | 1 | pfleura2 | * |
269 | 1 | pfleura2 | END |