3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download ZHEGST + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zhegst.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zhegst.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zhegst.f">
21 * SUBROUTINE ZHEGST( ITYPE, UPLO, N, A, LDA, B, LDB, INFO )
23 * .. Scalar Arguments ..
25 * INTEGER INFO, ITYPE, LDA, LDB, N
27 * .. Array Arguments ..
28 * COMPLEX*16 A( LDA, * ), B( LDB, * )
37 *> ZHEGST reduces a complex Hermitian-definite generalized
38 *> eigenproblem to standard form.
40 *> If ITYPE = 1, the problem is A*x = lambda*B*x,
41 *> and A is overwritten by inv(U**H)*A*inv(U) or inv(L)*A*inv(L**H)
43 *> If ITYPE = 2 or 3, the problem is A*B*x = lambda*x or
44 *> B*A*x = lambda*x, and A is overwritten by U*A*U**H or L**H*A*L.
46 *> B must have been previously factorized as U**H*U or L*L**H by ZPOTRF.
55 *> = 1: compute inv(U**H)*A*inv(U) or inv(L)*A*inv(L**H);
56 *> = 2 or 3: compute U*A*U**H or L**H*A*L.
61 *> UPLO is CHARACTER*1
62 *> = 'U': Upper triangle of A is stored and B is factored as
64 *> = 'L': Lower triangle of A is stored and B is factored as
71 *> The order of the matrices A and B. N >= 0.
76 *> A is COMPLEX*16 array, dimension (LDA,N)
77 *> On entry, the Hermitian matrix A. If UPLO = 'U', the leading
78 *> N-by-N upper triangular part of A contains the upper
79 *> triangular part of the matrix A, and the strictly lower
80 *> triangular part of A is not referenced. If UPLO = 'L', the
81 *> leading N-by-N lower triangular part of A contains the lower
82 *> triangular part of the matrix A, and the strictly upper
83 *> triangular part of A is not referenced.
85 *> On exit, if INFO = 0, the transformed matrix, stored in the
92 *> The leading dimension of the array A. LDA >= max(1,N).
97 *> B is COMPLEX*16 array, dimension (LDB,N)
98 *> The triangular factor from the Cholesky factorization of B,
99 *> as returned by ZPOTRF.
105 *> The leading dimension of the array B. LDB >= max(1,N).
111 *> = 0: successful exit
112 *> < 0: if INFO = -i, the i-th argument had an illegal value
118 *> \author Univ. of Tennessee
119 *> \author Univ. of California Berkeley
120 *> \author Univ. of Colorado Denver
123 *> \date September 2012
125 *> \ingroup complex16HEcomputational
127 * =====================================================================
128 SUBROUTINE ZHEGST( ITYPE, UPLO, N, A, LDA, B, LDB, INFO )
130 * -- LAPACK computational routine (version 3.4.2) --
131 * -- LAPACK is a software package provided by Univ. of Tennessee, --
132 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
135 * .. Scalar Arguments ..
137 INTEGER INFO, ITYPE, LDA, LDB, N
139 * .. Array Arguments ..
140 COMPLEX*16 A( LDA, * ), B( LDB, * )
143 * =====================================================================
147 PARAMETER ( ONE = 1.0D+0 )
148 COMPLEX*16 CONE, HALF
149 PARAMETER ( CONE = ( 1.0D+0, 0.0D+0 ),
150 $ HALF = ( 0.5D+0, 0.0D+0 ) )
152 * .. Local Scalars ..
156 * .. External Subroutines ..
157 EXTERNAL XERBLA, ZHEGS2, ZHEMM, ZHER2K, ZTRMM, ZTRSM
159 * .. Intrinsic Functions ..
162 * .. External Functions ..
165 EXTERNAL LSAME, ILAENV
167 * .. Executable Statements ..
169 * Test the input parameters.
172 UPPER = LSAME( UPLO, 'U' )
173 IF( ITYPE.LT.1 .OR. ITYPE.GT.3 ) THEN
175 ELSE IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
177 ELSE IF( N.LT.0 ) THEN
179 ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
181 ELSE IF( LDB.LT.MAX( 1, N ) ) THEN
185 CALL XERBLA( 'ZHEGST', -INFO )
189 * Quick return if possible
194 * Determine the block size for this environment.
196 NB = ILAENV( 1, 'ZHEGST', UPLO, N, -1, -1, -1 )
198 IF( NB.LE.1 .OR. NB.GE.N ) THEN
202 CALL ZHEGS2( ITYPE, UPLO, N, A, LDA, B, LDB, INFO )
207 IF( ITYPE.EQ.1 ) THEN
210 * Compute inv(U**H)*A*inv(U)
213 KB = MIN( N-K+1, NB )
215 * Update the upper triangle of A(k:n,k:n)
217 CALL ZHEGS2( ITYPE, UPLO, KB, A( K, K ), LDA,
218 $ B( K, K ), LDB, INFO )
220 CALL ZTRSM( 'Left', UPLO, 'Conjugate transpose',
221 $ 'Non-unit', KB, N-K-KB+1, CONE,
222 $ B( K, K ), LDB, A( K, K+KB ), LDA )
223 CALL ZHEMM( 'Left', UPLO, KB, N-K-KB+1, -HALF,
224 $ A( K, K ), LDA, B( K, K+KB ), LDB,
225 $ CONE, A( K, K+KB ), LDA )
226 CALL ZHER2K( UPLO, 'Conjugate transpose', N-K-KB+1,
227 $ KB, -CONE, A( K, K+KB ), LDA,
228 $ B( K, K+KB ), LDB, ONE,
229 $ A( K+KB, K+KB ), LDA )
230 CALL ZHEMM( 'Left', UPLO, KB, N-K-KB+1, -HALF,
231 $ A( K, K ), LDA, B( K, K+KB ), LDB,
232 $ CONE, A( K, K+KB ), LDA )
233 CALL ZTRSM( 'Right', UPLO, 'No transpose',
234 $ 'Non-unit', KB, N-K-KB+1, CONE,
235 $ B( K+KB, K+KB ), LDB, A( K, K+KB ),
241 * Compute inv(L)*A*inv(L**H)
244 KB = MIN( N-K+1, NB )
246 * Update the lower triangle of A(k:n,k:n)
248 CALL ZHEGS2( ITYPE, UPLO, KB, A( K, K ), LDA,
249 $ B( K, K ), LDB, INFO )
251 CALL ZTRSM( 'Right', UPLO, 'Conjugate transpose',
252 $ 'Non-unit', N-K-KB+1, KB, CONE,
253 $ B( K, K ), LDB, A( K+KB, K ), LDA )
254 CALL ZHEMM( 'Right', UPLO, N-K-KB+1, KB, -HALF,
255 $ A( K, K ), LDA, B( K+KB, K ), LDB,
256 $ CONE, A( K+KB, K ), LDA )
257 CALL ZHER2K( UPLO, 'No transpose', N-K-KB+1, KB,
258 $ -CONE, A( K+KB, K ), LDA,
259 $ B( K+KB, K ), LDB, ONE,
260 $ A( K+KB, K+KB ), LDA )
261 CALL ZHEMM( 'Right', UPLO, N-K-KB+1, KB, -HALF,
262 $ A( K, K ), LDA, B( K+KB, K ), LDB,
263 $ CONE, A( K+KB, K ), LDA )
264 CALL ZTRSM( 'Left', UPLO, 'No transpose',
265 $ 'Non-unit', N-K-KB+1, KB, CONE,
266 $ B( K+KB, K+KB ), LDB, A( K+KB, K ),
277 KB = MIN( N-K+1, NB )
279 * Update the upper triangle of A(1:k+kb-1,1:k+kb-1)
281 CALL ZTRMM( 'Left', UPLO, 'No transpose', 'Non-unit',
282 $ K-1, KB, CONE, B, LDB, A( 1, K ), LDA )
283 CALL ZHEMM( 'Right', UPLO, K-1, KB, HALF, A( K, K ),
284 $ LDA, B( 1, K ), LDB, CONE, A( 1, K ),
286 CALL ZHER2K( UPLO, 'No transpose', K-1, KB, CONE,
287 $ A( 1, K ), LDA, B( 1, K ), LDB, ONE, A,
289 CALL ZHEMM( 'Right', UPLO, K-1, KB, HALF, A( K, K ),
290 $ LDA, B( 1, K ), LDB, CONE, A( 1, K ),
292 CALL ZTRMM( 'Right', UPLO, 'Conjugate transpose',
293 $ 'Non-unit', K-1, KB, CONE, B( K, K ), LDB,
295 CALL ZHEGS2( ITYPE, UPLO, KB, A( K, K ), LDA,
296 $ B( K, K ), LDB, INFO )
303 KB = MIN( N-K+1, NB )
305 * Update the lower triangle of A(1:k+kb-1,1:k+kb-1)
307 CALL ZTRMM( 'Right', UPLO, 'No transpose', 'Non-unit',
308 $ KB, K-1, CONE, B, LDB, A( K, 1 ), LDA )
309 CALL ZHEMM( 'Left', UPLO, KB, K-1, HALF, A( K, K ),
310 $ LDA, B( K, 1 ), LDB, CONE, A( K, 1 ),
312 CALL ZHER2K( UPLO, 'Conjugate transpose', K-1, KB,
313 $ CONE, A( K, 1 ), LDA, B( K, 1 ), LDB,
315 CALL ZHEMM( 'Left', UPLO, KB, K-1, HALF, A( K, K ),
316 $ LDA, B( K, 1 ), LDB, CONE, A( K, 1 ),
318 CALL ZTRMM( 'Left', UPLO, 'Conjugate transpose',
319 $ 'Non-unit', KB, K-1, CONE, B( K, K ), LDB,
321 CALL ZHEGS2( ITYPE, UPLO, KB, A( K, K ), LDA,
322 $ B( K, K ), LDB, INFO )