LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ 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.
Date
December 2016

Definition at line 115 of file zhpgst.f.

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