1 SUBROUTINE ZHPMV
( UPLO
, N
, ALPHA
, AP
, X
, INCX
, BETA
, Y
, INCY
)
2 * .. Scalar Arguments
..
6 * .. Array Arguments
..
7 COMPLEX*16 AP
( * ), X
( * ), Y
( * )
13 * ZHPMV performs the matrix
-vector operation
15 * y
:= alpha*A*x
+ beta*y
,
17 * where alpha and beta are scalars
, x and y are n element vectors and
18 * A is an n by n hermitian matrix
, supplied in packed form
.
24 * On entry
, UPLO specifies whether the upper or lower
25 * triangular part of the matrix A is supplied in the packed
26 * array AP as follows
:
28 * UPLO
= 'U' or
'u' The upper triangular part of A is
31 * UPLO
= 'L' or
'l' The lower triangular part of A is
37 * On entry
, N specifies the order of the matrix A
.
38 * N must be at least zero
.
41 * ALPHA
- COMPLEX*16
.
42 * On entry
, ALPHA specifies the scalar alpha
.
45 * AP
- COMPLEX*16 array of
DIMENSION at least
46 * ( ( n*
( n
+ 1 ) )/2 ).
47 * Before entry with UPLO
= 'U' or
'u', the array AP must
48 * contain the upper triangular part of the hermitian matrix
49 * packed sequentially
, column by column
, so that AP
( 1 )
50 * contains a
( 1, 1 ), AP
( 2 ) and AP
( 3 ) contain a
( 1, 2 )
51 * and a
( 2, 2 ) respectively
, and so on
.
52 * Before entry with UPLO
= 'L' or
'l', the array AP must
53 * contain the lower triangular part of the hermitian matrix
54 * packed sequentially
, column by column
, so that AP
( 1 )
55 * contains a
( 1, 1 ), AP
( 2 ) and AP
( 3 ) contain a
( 2, 1 )
56 * and a
( 3, 1 ) respectively
, and so on
.
57 * Note that the imaginary parts of the diagonal elements need
58 * not be set and are assumed
to be zero
.
61 * X
- COMPLEX*16 array of
dimension at least
62 * ( 1 + ( n
- 1 )*abs
( INCX
) ).
63 * Before entry
, the incremented array X must contain the n
68 * On entry
, INCX specifies the increment
for the elements of
69 * X
. INCX must not be zero
.
73 * On entry
, BETA specifies the scalar beta
. When BETA is
74 * supplied as zero
then Y need not be set on input
.
77 * Y
- COMPLEX*16 array of
dimension at least
78 * ( 1 + ( n
- 1 )*abs
( INCY
) ).
79 * Before entry
, the incremented array Y must contain the n
80 * element vector y
. On exit
, Y is overwritten by the updated
84 * On entry
, INCY specifies the increment
for the elements of
85 * Y
. INCY must not be zero
.
89 * Level
2 Blas routine
.
91 * -- Written on
22-October
-1986.
92 * Jack Dongarra
, Argonne National Lab
.
93 * Jeremy Du Croz
, Nag Central Office
.
94 * Sven Hammarling
, Nag Central Office
.
95 * Richard Hanson
, Sandia National Labs
.
100 PARAMETER ( ONE
= ( 1.0D
+0, 0.0D
+0 ) )
102 PARAMETER ( ZERO
= ( 0.0D
+0, 0.0D
+0 ) )
103 * .. Local Scalars
..
104 COMPLEX*16 TEMP1
, TEMP2
105 INTEGER I
, INFO
, IX
, IY
, J
, JX
, JY
, K
, KK
, KX
, KY
106 * .. External Functions
..
109 * .. External Subroutines
..
111 * .. Intrinsic Functions
..
112 INTRINSIC DCONJG
, DBLE
114 * .. Executable Statements
..
116 * Test the input parameters
.
119 IF ( .NOT
.LSAME
( UPLO
, 'U' ).AND
.
120 $
.NOT
.LSAME
( UPLO
, 'L' ) )THEN
122 ELSE IF( N
.LT
.0 )THEN
124 ELSE IF( INCX
.EQ
.0 )THEN
126 ELSE IF( INCY
.EQ
.0 )THEN
130 CALL XERBLA
( 'ZHPMV ', INFO
)
134 * Quick
return if possible
.
136 IF( ( N
.EQ
.0 ).OR
.( ( ALPHA
.EQ
.ZERO
).AND
.( BETA
.EQ
.ONE
) ) )
139 * Set up the start points in X and Y
.
144 KX
= 1 - ( N
- 1 )*INCX
149 KY
= 1 - ( N
- 1 )*INCY
152 * Start the operations
. In this version the elements of the array AP
153 * are accessed sequentially with one pass through AP
.
155 * First form y
:= beta*y
.
157 IF( BETA
.NE
.ONE
)THEN
159 IF( BETA
.EQ
.ZERO
)THEN
170 IF( BETA
.EQ
.ZERO
)THEN
177 Y
( IY
) = BETA*Y
( IY
)
186 IF( LSAME
( UPLO
, 'U' ) )THEN
188 * Form y when AP contains the upper triangle
.
190 IF( ( INCX
.EQ
.1 ).AND
.( INCY
.EQ
.1 ) )THEN
196 Y
( I
) = Y
( I
) + TEMP1*AP
( K
)
197 TEMP2
= TEMP2
+ DCONJG
( AP
( K
) )*X
( I
)
200 Y
( J
) = Y
( J
) + TEMP1*DBLE
( AP
( KK
+ J
- 1 ) )
208 TEMP1
= ALPHA*X
( JX
)
212 DO 70, K
= KK
, KK
+ J
- 2
213 Y
( IY
) = Y
( IY
) + TEMP1*AP
( K
)
214 TEMP2
= TEMP2
+ DCONJG
( AP
( K
) )*X
( IX
)
218 Y
( JY
) = Y
( JY
) + TEMP1*DBLE
( AP
( KK
+ J
- 1 ) )
227 * Form y when AP contains the lower triangle
.
229 IF( ( INCX
.EQ
.1 ).AND
.( INCY
.EQ
.1 ) )THEN
233 Y
( J
) = Y
( J
) + TEMP1*DBLE
( AP
( KK
) )
236 Y
( I
) = Y
( I
) + TEMP1*AP
( K
)
237 TEMP2
= TEMP2
+ DCONJG
( AP
( K
) )*X
( I
)
240 Y
( J
) = Y
( J
) + ALPHA*TEMP2
241 KK
= KK
+ ( N
- J
+ 1 )
247 TEMP1
= ALPHA*X
( JX
)
249 Y
( JY
) = Y
( JY
) + TEMP1*DBLE
( AP
( KK
) )
252 DO 110, K
= KK
+ 1, KK
+ N
- J
255 Y
( IY
) = Y
( IY
) + TEMP1*AP
( K
)
256 TEMP2
= TEMP2
+ DCONJG
( AP
( K
) )*X
( IX
)
258 Y
( JY
) = Y
( JY
) + ALPHA*TEMP2
261 KK
= KK
+ ( N
- J
+ 1 )