1 SUBROUTINE ZHPGST
( ITYPE
, UPLO
, N
, AP
, BP
, INFO
)
3 * -- LAPACK routine
(version
3.1) --
4 * Univ
. of Tennessee
, Univ
. of California Berkeley and NAG Ltd
..
7 * .. Scalar Arguments
..
11 * .. Array Arguments
..
12 COMPLEX*16 AP
( * ), BP
( * )
18 * ZHPGST reduces a
complex Hermitian
-definite generalized
19 * eigenproblem
to standard form
, using packed storage
.
21 * If ITYPE
= 1, the problem is A*x
= lambda*B*x
,
22 * and A is overwritten by inv
(U**H
)*A*inv
(U
) or inv
(L
)*A*inv
(L**H
)
24 * If ITYPE
= 2 or
3, the problem is A*B*x
= lambda*x or
25 * B*A*x
= lambda*x
, and A is overwritten by U*A*U**H or L**H*A*L
.
27 * B must have been previously factorized as U**H*U or L*L**H by ZPPTRF
.
32 * ITYPE
(input
) INTEGER
33 * = 1: compute inv
(U**H
)*A*inv
(U
) or inv
(L
)*A*inv
(L**H
);
34 * = 2 or
3: compute U*A*U**H or L**H*A*L
.
36 * UPLO
(input
) CHARACTER*1
37 * = 'U': Upper triangle of A is stored and B is factored as
39 * = 'L': Lower triangle of A is stored and B is factored as
43 * The order of the matrices A and B
. N
>= 0.
45 * AP
(input
/output
) COMPLEX*16 array
, dimension (N*
(N
+1)/2)
46 * On entry
, the upper or lower triangle of the Hermitian matrix
47 * A
, packed columnwise in a linear array
. The j
-th column of A
48 * is stored in the array AP as follows
:
49 * if UPLO
= 'U', AP
(i
+ (j
-1)*j
/2) = A
(i
,j
) for 1<=i
<=j
;
50 * if UPLO
= 'L', AP
(i
+ (j
-1)*(2n
-j
)/2) = A
(i
,j
) for j
<=i
<=n
.
52 * On exit
, if INFO
= 0, the transformed matrix
, stored in the
55 * BP
(input
) COMPLEX*16 array
, dimension (N*
(N
+1)/2)
56 * The triangular factor from the Cholesky factorization of B
,
57 * stored in the same
format as A
, as returned by ZPPTRF
.
59 * INFO
(output
) INTEGER
60 * = 0: successful exit
61 * < 0: if INFO
= -i
, the i
-th argument had an illegal value
63 * =====================================================================
66 DOUBLE PRECISION ONE
, HALF
67 PARAMETER ( ONE
= 1.0D
+0, HALF
= 0.5D
+0 )
69 PARAMETER ( CONE
= ( 1.0D
+0, 0.0D
+0 ) )
73 INTEGER J
, J1
, J1J1
, JJ
, K
, K1
, K1K1
, KK
74 DOUBLE PRECISION AJJ
, AKK
, BJJ
, BKK
77 * .. External Subroutines
..
78 EXTERNAL XERBLA
, ZAXPY
, ZDSCAL
, ZHPMV
, ZHPR2
, ZTPMV
,
81 * .. Intrinsic Functions
..
84 * .. External Functions
..
89 * .. Executable Statements
..
91 * Test the input parameters
.
94 UPPER
= LSAME
( UPLO
, 'U' )
95 IF( ITYPE
.LT
.1 .OR
. ITYPE
.GT
.3 ) THEN
97 ELSE IF( .NOT
.UPPER
.AND
. .NOT
.LSAME
( UPLO
, 'L' ) ) THEN
99 ELSE IF( N
.LT
.0 ) THEN
103 CALL XERBLA
( 'ZHPGST', -INFO
)
107 IF( ITYPE
.EQ
.1 ) THEN
110 * Compute inv
(U
')*A*inv(U)
112 * J1 and JJ are the indices of A(1,j) and A(j,j)
119 * Compute the j-th column of the upper triangle of A
121 AP( JJ ) = DBLE( AP( JJ ) )
123 CALL ZTPSV( UPLO, 'Conjugate transpose
', 'Non
-unit
', J,
125 CALL ZHPMV( UPLO, J-1, -CONE, AP, BP( J1 ), 1, CONE,
127 CALL ZDSCAL( J-1, ONE / BJJ, AP( J1 ), 1 )
128 AP( JJ ) = ( AP( JJ )-ZDOTC( J-1, AP( J1 ), 1, BP( J1 ),
133 * Compute inv(L)*A*inv(L')
135 * KK and K1K1 are the indices of A
(k
,k
) and A
(k
+1,k
+1)
139 K1K1
= KK
+ N
- K
+ 1
141 * Update the lower triangle of A
(k
:n
,k
:n
)
148 CALL ZDSCAL
( N
-K
, ONE
/ BKK
, AP
( KK
+1 ), 1 )
150 CALL ZAXPY
( N
-K
, CT
, BP
( KK
+1 ), 1, AP
( KK
+1 ), 1 )
151 CALL ZHPR2
( UPLO
, N
-K
, -CONE
, AP
( KK
+1 ), 1,
152 $ BP
( KK
+1 ), 1, AP
( K1K1
) )
153 CALL ZAXPY
( N
-K
, CT
, BP
( KK
+1 ), 1, AP
( KK
+1 ), 1 )
154 CALL ZTPSV
( UPLO
, 'No transpose', 'Non-unit', N
-K
,
155 $ BP
( K1K1
), AP
( KK
+1 ), 1 )
165 * K1 and KK are the indices of A(1,k) and A(k,k)
172 * Update the upper triangle of A(1:k,1:k)
176 CALL ZTPMV( UPLO, 'No transpose
', 'Non
-unit
', K-1, BP,
179 CALL ZAXPY( K-1, CT, BP( K1 ), 1, AP( K1 ), 1 )
180 CALL ZHPR2( UPLO, K-1, CONE, AP( K1 ), 1, BP( K1 ), 1,
182 CALL ZAXPY( K-1, CT, BP( K1 ), 1, AP( K1 ), 1 )
183 CALL ZDSCAL( K-1, BKK, AP( K1 ), 1 )
184 AP( KK ) = AKK*BKK**2
190 * JJ and J1J1 are the indices of A
(j
,j
) and A
(j
+1,j
+1)
194 J1J1
= JJ
+ N
- J
+ 1
196 * Compute the j
-th column of the lower triangle of A
200 AP
( JJ
) = AJJ*BJJ
+ ZDOTC
( N
-J
, AP
( JJ
+1 ), 1,
202 CALL ZDSCAL
( N
-J
, BJJ
, AP
( JJ
+1 ), 1 )
203 CALL ZHPMV
( UPLO
, N
-J
, CONE
, AP
( J1J1
), BP
( JJ
+1 ), 1,
204 $ CONE
, AP
( JJ
+1 ), 1 )
205 CALL ZTPMV
( UPLO
, 'Conjugate transpose', 'Non-unit',
206 $ N
-J
+1, BP
( JJ
), AP
( JJ
), 1 )