1 SUBROUTINE ZHBMV
( UPLO
, N
, K
, ALPHA
, A
, LDA
, X
, INCX
,
3 * .. Scalar Arguments
..
5 INTEGER INCX
, INCY
, K
, LDA
, N
7 * .. Array Arguments
..
8 COMPLEX*16 A
( LDA
, * ), X
( * ), Y
( * )
14 * ZHBMV performs the matrix
-vector operation
16 * y
:= alpha*A*x
+ beta*y
,
18 * where alpha and beta are scalars
, x and y are n element vectors and
19 * A is an n by n hermitian band matrix
, with k super
-diagonals
.
25 * On entry
, UPLO specifies whether the upper or lower
26 * triangular part of the band matrix A is being supplied as
29 * UPLO
= 'U' or
'u' The upper triangular part of A is
32 * UPLO
= 'L' or
'l' The lower triangular part of A is
38 * On entry
, N specifies the order of the matrix A
.
39 * N must be at least zero
.
43 * On entry
, K specifies the number of super
-diagonals of the
44 * matrix A
. K must satisfy
0 .le
. K
.
47 * ALPHA
- COMPLEX*16
.
48 * On entry
, ALPHA specifies the scalar alpha
.
51 * A
- COMPLEX*16 array of
DIMENSION ( LDA
, n
).
52 * Before entry with UPLO
= 'U' or
'u', the leading
( k
+ 1 )
53 * by n part of the array A must contain the upper triangular
54 * band part of the hermitian matrix
, supplied column by
55 * column
, with the leading diagonal of the matrix in row
56 * ( k
+ 1 ) of the array
, the first super
-diagonal starting at
57 * position
2 in row k
, and so on
. The top left k by k triangle
58 * of the array A is not referenced
.
59 * The following
program segment will transfer the upper
60 * triangular part of a hermitian band matrix from conventional
61 * full matrix storage
to band storage
:
65 * DO 10, I
= MAX
( 1, J
- K
), J
66 * A
( M
+ I
, J
) = matrix
( I
, J
)
70 * Before entry with UPLO
= 'L' or
'l', the leading
( k
+ 1 )
71 * by n part of the array A must contain the lower triangular
72 * band part of the hermitian matrix
, supplied column by
73 * column
, with the leading diagonal of the matrix in row
1 of
74 * the array
, the first sub
-diagonal starting at position
1 in
75 * row
2, and so on
. The bottom right k by k triangle of the
76 * array A is not referenced
.
77 * The following
program segment will transfer the lower
78 * triangular part of a hermitian band matrix from conventional
79 * full matrix storage
to band storage
:
83 * DO 10, I
= J
, MIN
( N
, J
+ K
)
84 * A
( M
+ I
, J
) = matrix
( I
, J
)
88 * Note that the imaginary parts of the diagonal elements need
89 * not be set and are assumed
to be zero
.
93 * On entry
, LDA specifies the first
dimension of A as declared
94 * in the calling
(sub
) program. LDA must be at least
98 * X
- COMPLEX*16 array of
DIMENSION at least
99 * ( 1 + ( n
- 1 )*abs
( INCX
) ).
100 * Before entry
, the incremented array X must contain the
105 * On entry
, INCX specifies the increment
for the elements of
106 * X
. INCX must not be zero
.
109 * BETA
- COMPLEX*16
.
110 * On entry
, BETA specifies the scalar beta
.
113 * Y
- COMPLEX*16 array of
DIMENSION at least
114 * ( 1 + ( n
- 1 )*abs
( INCY
) ).
115 * Before entry
, the incremented array Y must contain the
116 * vector y
. On exit
, Y is overwritten by the updated vector y
.
119 * On entry
, INCY specifies the increment
for the elements of
120 * Y
. INCY must not be zero
.
124 * Level
2 Blas routine
.
126 * -- Written on
22-October
-1986.
127 * Jack Dongarra
, Argonne National Lab
.
128 * Jeremy Du Croz
, Nag Central Office
.
129 * Sven Hammarling
, Nag Central Office
.
130 * Richard Hanson
, Sandia National Labs
.
135 PARAMETER ( ONE
= ( 1.0D
+0, 0.0D
+0 ) )
137 PARAMETER ( ZERO
= ( 0.0D
+0, 0.0D
+0 ) )
138 * .. Local Scalars
..
139 COMPLEX*16 TEMP1
, TEMP2
140 INTEGER I
, INFO
, IX
, IY
, J
, JX
, JY
, KPLUS1
, KX
, KY
, L
141 * .. External Functions
..
144 * .. External Subroutines
..
146 * .. Intrinsic Functions
..
147 INTRINSIC DCONJG
, MAX
, MIN
, DBLE
149 * .. Executable Statements
..
151 * Test the input parameters
.
154 IF ( .NOT
.LSAME
( UPLO
, 'U' ).AND
.
155 $
.NOT
.LSAME
( UPLO
, 'L' ) )THEN
157 ELSE IF( N
.LT
.0 )THEN
159 ELSE IF( K
.LT
.0 )THEN
161 ELSE IF( LDA
.LT
.( K
+ 1 ) )THEN
163 ELSE IF( INCX
.EQ
.0 )THEN
165 ELSE IF( INCY
.EQ
.0 )THEN
169 CALL XERBLA
( 'ZHBMV ', INFO
)
173 * Quick
return if possible
.
175 IF( ( N
.EQ
.0 ).OR
.( ( ALPHA
.EQ
.ZERO
).AND
.( BETA
.EQ
.ONE
) ) )
178 * Set up the start points in X and Y
.
183 KX
= 1 - ( N
- 1 )*INCX
188 KY
= 1 - ( N
- 1 )*INCY
191 * Start the operations
. In this version the elements of the array A
192 * are accessed sequentially with one pass through A
.
194 * First form y
:= beta*y
.
196 IF( BETA
.NE
.ONE
)THEN
198 IF( BETA
.EQ
.ZERO
)THEN
209 IF( BETA
.EQ
.ZERO
)THEN
216 Y
( IY
) = BETA*Y
( IY
)
224 IF( LSAME
( UPLO
, 'U' ) )THEN
226 * Form y when upper triangle of A is stored
.
229 IF( ( INCX
.EQ
.1 ).AND
.( INCY
.EQ
.1 ) )THEN
234 DO 50, I
= MAX
( 1, J
- K
), J
- 1
235 Y
( I
) = Y
( I
) + TEMP1*A
( L
+ I
, J
)
236 TEMP2
= TEMP2
+ DCONJG
( A
( L
+ I
, J
) )*X
( I
)
238 Y
( J
) = Y
( J
) + TEMP1*DBLE
( A
( KPLUS1
, J
) )
245 TEMP1
= ALPHA*X
( JX
)
250 DO 70, I
= MAX
( 1, J
- K
), J
- 1
251 Y
( IY
) = Y
( IY
) + TEMP1*A
( L
+ I
, J
)
252 TEMP2
= TEMP2
+ DCONJG
( A
( L
+ I
, J
) )*X
( IX
)
256 Y
( JY
) = Y
( JY
) + TEMP1*DBLE
( A
( KPLUS1
, J
) )
268 * Form y when lower triangle of A is stored
.
270 IF( ( INCX
.EQ
.1 ).AND
.( INCY
.EQ
.1 ) )THEN
274 Y
( J
) = Y
( J
) + TEMP1*DBLE
( A
( 1, J
) )
276 DO 90, I
= J
+ 1, MIN
( N
, J
+ K
)
277 Y
( I
) = Y
( I
) + TEMP1*A
( L
+ I
, J
)
278 TEMP2
= TEMP2
+ DCONJG
( A
( L
+ I
, J
) )*X
( I
)
280 Y
( J
) = Y
( J
) + ALPHA*TEMP2
286 TEMP1
= ALPHA*X
( JX
)
288 Y
( JY
) = Y
( JY
) + TEMP1*DBLE
( A
( 1, J
) )
292 DO 110, I
= J
+ 1, MIN
( N
, J
+ K
)
295 Y
( IY
) = Y
( IY
) + TEMP1*A
( L
+ I
, J
)
296 TEMP2
= TEMP2
+ DCONJG
( A
( L
+ I
, J
) )*X
( IX
)
298 Y
( JY
) = Y
( JY
) + ALPHA*TEMP2