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