LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ zhpgst()

subroutine zhpgst ( integer  itype,
character  uplo,
integer  n,
complex*16, dimension( * )  ap,
complex*16, dimension( * )  bp,
integer  info 
)

ZHPGST

Download ZHPGST + dependencies [TGZ] [ZIP] [TXT]

Purpose:
 ZHPGST reduces a complex Hermitian-definite generalized
 eigenproblem to standard form, using packed storage.

 If ITYPE = 1, the problem is A*x = lambda*B*x,
 and A is overwritten by inv(U**H)*A*inv(U) or inv(L)*A*inv(L**H)

 If ITYPE = 2 or 3, the problem is A*B*x = lambda*x or
 B*A*x = lambda*x, and A is overwritten by U*A*U**H or L**H*A*L.

 B must have been previously factorized as U**H*U or L*L**H by ZPPTRF.
Parameters
[in]ITYPE
          ITYPE is INTEGER
          = 1: compute inv(U**H)*A*inv(U) or inv(L)*A*inv(L**H);
          = 2 or 3: compute U*A*U**H or L**H*A*L.
[in]UPLO
          UPLO is CHARACTER*1
          = 'U':  Upper triangle of A is stored and B is factored as
                  U**H*U;
          = 'L':  Lower triangle of A is stored and B is factored as
                  L*L**H.
[in]N
          N is INTEGER
          The order of the matrices A and B.  N >= 0.
[in,out]AP
          AP is COMPLEX*16 array, dimension (N*(N+1)/2)
          On entry, the upper or lower triangle of the Hermitian matrix
          A, packed columnwise in a linear array.  The j-th column of A
          is stored in the array AP as follows:
          if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
          if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n.

          On exit, if INFO = 0, the transformed matrix, stored in the
          same format as A.
[in]BP
          BP is COMPLEX*16 array, dimension (N*(N+1)/2)
          The triangular factor from the Cholesky factorization of B,
          stored in the same format as A, as returned by ZPPTRF.
[out]INFO
          INFO is INTEGER
          = 0:  successful exit
          < 0:  if INFO = -i, the i-th argument had an illegal value
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 112 of file zhpgst.f.

113*
114* -- LAPACK computational routine --
115* -- LAPACK is a software package provided by Univ. of Tennessee, --
116* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
117*
118* .. Scalar Arguments ..
119 CHARACTER UPLO
120 INTEGER INFO, ITYPE, N
121* ..
122* .. Array Arguments ..
123 COMPLEX*16 AP( * ), BP( * )
124* ..
125*
126* =====================================================================
127*
128* .. Parameters ..
129 DOUBLE PRECISION ONE, HALF
130 parameter( one = 1.0d+0, half = 0.5d+0 )
131 COMPLEX*16 CONE
132 parameter( cone = ( 1.0d+0, 0.0d+0 ) )
133* ..
134* .. Local Scalars ..
135 LOGICAL UPPER
136 INTEGER J, J1, J1J1, JJ, K, K1, K1K1, KK
137 DOUBLE PRECISION AJJ, AKK, BJJ, BKK
138 COMPLEX*16 CT
139* ..
140* .. External Subroutines ..
141 EXTERNAL xerbla, zaxpy, zdscal, zhpmv, zhpr2, ztpmv,
142 $ ztpsv
143* ..
144* .. Intrinsic Functions ..
145 INTRINSIC dble
146* ..
147* .. External Functions ..
148 LOGICAL LSAME
149 COMPLEX*16 ZDOTC
150 EXTERNAL lsame, zdotc
151* ..
152* .. Executable Statements ..
153*
154* Test the input parameters.
155*
156 info = 0
157 upper = lsame( uplo, 'U' )
158 IF( itype.LT.1 .OR. itype.GT.3 ) THEN
159 info = -1
160 ELSE IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
161 info = -2
162 ELSE IF( n.LT.0 ) THEN
163 info = -3
164 END IF
165 IF( info.NE.0 ) THEN
166 CALL xerbla( 'ZHPGST', -info )
167 RETURN
168 END IF
169*
170 IF( itype.EQ.1 ) THEN
171 IF( upper ) THEN
172*
173* Compute inv(U**H)*A*inv(U)
174*
175* J1 and JJ are the indices of A(1,j) and A(j,j)
176*
177 jj = 0
178 DO 10 j = 1, n
179 j1 = jj + 1
180 jj = jj + j
181*
182* Compute the j-th column of the upper triangle of A
183*
184 ap( jj ) = dble( ap( jj ) )
185 bjj = dble( bp( jj ) )
186 CALL ztpsv( uplo, 'Conjugate transpose', 'Non-unit', j,
187 $ bp, ap( j1 ), 1 )
188 CALL zhpmv( uplo, j-1, -cone, ap, bp( j1 ), 1, cone,
189 $ ap( j1 ), 1 )
190 CALL zdscal( j-1, one / bjj, ap( j1 ), 1 )
191 ap( jj ) = ( ap( jj )-zdotc( j-1, ap( j1 ), 1, bp( j1 ),
192 $ 1 ) ) / bjj
193 10 CONTINUE
194 ELSE
195*
196* Compute inv(L)*A*inv(L**H)
197*
198* KK and K1K1 are the indices of A(k,k) and A(k+1,k+1)
199*
200 kk = 1
201 DO 20 k = 1, n
202 k1k1 = kk + n - k + 1
203*
204* Update the lower triangle of A(k:n,k:n)
205*
206 akk = dble( ap( kk ) )
207 bkk = dble( bp( kk ) )
208 akk = akk / bkk**2
209 ap( kk ) = akk
210 IF( k.LT.n ) THEN
211 CALL zdscal( n-k, one / bkk, ap( kk+1 ), 1 )
212 ct = -half*akk
213 CALL zaxpy( n-k, ct, bp( kk+1 ), 1, ap( kk+1 ), 1 )
214 CALL zhpr2( uplo, n-k, -cone, ap( kk+1 ), 1,
215 $ bp( kk+1 ), 1, ap( k1k1 ) )
216 CALL zaxpy( n-k, ct, bp( kk+1 ), 1, ap( kk+1 ), 1 )
217 CALL ztpsv( uplo, 'No transpose', 'Non-unit', n-k,
218 $ bp( k1k1 ), ap( kk+1 ), 1 )
219 END IF
220 kk = k1k1
221 20 CONTINUE
222 END IF
223 ELSE
224 IF( upper ) THEN
225*
226* Compute U*A*U**H
227*
228* K1 and KK are the indices of A(1,k) and A(k,k)
229*
230 kk = 0
231 DO 30 k = 1, n
232 k1 = kk + 1
233 kk = kk + k
234*
235* Update the upper triangle of A(1:k,1:k)
236*
237 akk = dble( ap( kk ) )
238 bkk = dble( bp( kk ) )
239 CALL ztpmv( uplo, 'No transpose', 'Non-unit', k-1, bp,
240 $ ap( k1 ), 1 )
241 ct = half*akk
242 CALL zaxpy( k-1, ct, bp( k1 ), 1, ap( k1 ), 1 )
243 CALL zhpr2( uplo, k-1, cone, ap( k1 ), 1, bp( k1 ), 1,
244 $ ap )
245 CALL zaxpy( k-1, ct, bp( k1 ), 1, ap( k1 ), 1 )
246 CALL zdscal( k-1, bkk, ap( k1 ), 1 )
247 ap( kk ) = akk*bkk**2
248 30 CONTINUE
249 ELSE
250*
251* Compute L**H *A*L
252*
253* JJ and J1J1 are the indices of A(j,j) and A(j+1,j+1)
254*
255 jj = 1
256 DO 40 j = 1, n
257 j1j1 = jj + n - j + 1
258*
259* Compute the j-th column of the lower triangle of A
260*
261 ajj = dble( ap( jj ) )
262 bjj = dble( bp( jj ) )
263 ap( jj ) = ajj*bjj + zdotc( n-j, ap( jj+1 ), 1,
264 $ bp( jj+1 ), 1 )
265 CALL zdscal( n-j, bjj, ap( jj+1 ), 1 )
266 CALL zhpmv( uplo, n-j, cone, ap( j1j1 ), bp( jj+1 ), 1,
267 $ cone, ap( jj+1 ), 1 )
268 CALL ztpmv( uplo, 'Conjugate transpose', 'Non-unit',
269 $ n-j+1, bp( jj ), ap( jj ), 1 )
270 jj = j1j1
271 40 CONTINUE
272 END IF
273 END IF
274 RETURN
275*
276* End of ZHPGST
277*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine zaxpy(n, za, zx, incx, zy, incy)
ZAXPY
Definition zaxpy.f:88
complex *16 function zdotc(n, zx, incx, zy, incy)
ZDOTC
Definition zdotc.f:83
subroutine zhpmv(uplo, n, alpha, ap, x, incx, beta, y, incy)
ZHPMV
Definition zhpmv.f:149
subroutine zhpr2(uplo, n, alpha, x, incx, y, incy, ap)
ZHPR2
Definition zhpr2.f:145
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
subroutine zdscal(n, da, zx, incx)
ZDSCAL
Definition zdscal.f:78
subroutine ztpmv(uplo, trans, diag, n, ap, x, incx)
ZTPMV
Definition ztpmv.f:142
subroutine ztpsv(uplo, trans, diag, n, ap, x, incx)
ZTPSV
Definition ztpsv.f:144
Here is the call graph for this function:
Here is the caller graph for this function: