LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
zhegst.f
Go to the documentation of this file.
1 *> \brief \b ZHEGST
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 *> \htmlonly
9 *> Download ZHEGST + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zhegst.f">
11 *> [TGZ]</a>
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zhegst.f">
13 *> [ZIP]</a>
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zhegst.f">
15 *> [TXT]</a>
16 *> \endhtmlonly
17 *
18 * Definition:
19 * ===========
20 *
21 * SUBROUTINE ZHEGST( ITYPE, UPLO, N, A, LDA, B, LDB, INFO )
22 *
23 * .. Scalar Arguments ..
24 * CHARACTER UPLO
25 * INTEGER INFO, ITYPE, LDA, LDB, N
26 * ..
27 * .. Array Arguments ..
28 * COMPLEX*16 A( LDA, * ), B( LDB, * )
29 * ..
30 *
31 *
32 *> \par Purpose:
33 * =============
34 *>
35 *> \verbatim
36 *>
37 *> ZHEGST reduces a complex Hermitian-definite generalized
38 *> eigenproblem to standard form.
39 *>
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)
42 *>
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.
45 *>
46 *> B must have been previously factorized as U**H*U or L*L**H by ZPOTRF.
47 *> \endverbatim
48 *
49 * Arguments:
50 * ==========
51 *
52 *> \param[in] ITYPE
53 *> \verbatim
54 *> ITYPE is INTEGER
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.
57 *> \endverbatim
58 *>
59 *> \param[in] UPLO
60 *> \verbatim
61 *> UPLO is CHARACTER*1
62 *> = 'U': Upper triangle of A is stored and B is factored as
63 *> U**H*U;
64 *> = 'L': Lower triangle of A is stored and B is factored as
65 *> L*L**H.
66 *> \endverbatim
67 *>
68 *> \param[in] N
69 *> \verbatim
70 *> N is INTEGER
71 *> The order of the matrices A and B. N >= 0.
72 *> \endverbatim
73 *>
74 *> \param[in,out] A
75 *> \verbatim
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.
84 *>
85 *> On exit, if INFO = 0, the transformed matrix, stored in the
86 *> same format as A.
87 *> \endverbatim
88 *>
89 *> \param[in] LDA
90 *> \verbatim
91 *> LDA is INTEGER
92 *> The leading dimension of the array A. LDA >= max(1,N).
93 *> \endverbatim
94 *>
95 *> \param[in,out] B
96 *> \verbatim
97 *> B is COMPLEX*16 array, dimension (LDB,N)
98 *> The triangular factor from the Cholesky factorization of B,
99 *> as returned by ZPOTRF.
100 *> \endverbatim
101 *>
102 *> \param[in] LDB
103 *> \verbatim
104 *> LDB is INTEGER
105 *> The leading dimension of the array B. LDB >= max(1,N).
106 *> \endverbatim
107 *>
108 *> \param[out] INFO
109 *> \verbatim
110 *> INFO is INTEGER
111 *> = 0: successful exit
112 *> < 0: if INFO = -i, the i-th argument had an illegal value
113 *> \endverbatim
114 *
115 * Authors:
116 * ========
117 *
118 *> \author Univ. of Tennessee
119 *> \author Univ. of California Berkeley
120 *> \author Univ. of Colorado Denver
121 *> \author NAG Ltd.
122 *
123 *> \date September 2012
124 *
125 *> \ingroup complex16HEcomputational
126 *
127 * =====================================================================
128  SUBROUTINE zhegst( ITYPE, UPLO, N, A, LDA, B, LDB, INFO )
129 *
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..--
133 * September 2012
134 *
135 * .. Scalar Arguments ..
136  CHARACTER UPLO
137  INTEGER INFO, ITYPE, LDA, LDB, N
138 * ..
139 * .. Array Arguments ..
140  COMPLEX*16 A( lda, * ), B( ldb, * )
141 * ..
142 *
143 * =====================================================================
144 *
145 * .. Parameters ..
146  DOUBLE PRECISION ONE
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 ) )
151 * ..
152 * .. Local Scalars ..
153  LOGICAL UPPER
154  INTEGER K, KB, NB
155 * ..
156 * .. External Subroutines ..
157  EXTERNAL xerbla, zhegs2, zhemm, zher2k, ztrmm, ztrsm
158 * ..
159 * .. Intrinsic Functions ..
160  INTRINSIC max, min
161 * ..
162 * .. External Functions ..
163  LOGICAL LSAME
164  INTEGER ILAENV
165  EXTERNAL lsame, ilaenv
166 * ..
167 * .. Executable Statements ..
168 *
169 * Test the input parameters.
170 *
171  info = 0
172  upper = lsame( uplo, 'U' )
173  IF( itype.LT.1 .OR. itype.GT.3 ) THEN
174  info = -1
175  ELSE IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
176  info = -2
177  ELSE IF( n.LT.0 ) THEN
178  info = -3
179  ELSE IF( lda.LT.max( 1, n ) ) THEN
180  info = -5
181  ELSE IF( ldb.LT.max( 1, n ) ) THEN
182  info = -7
183  END IF
184  IF( info.NE.0 ) THEN
185  CALL xerbla( 'ZHEGST', -info )
186  RETURN
187  END IF
188 *
189 * Quick return if possible
190 *
191  IF( n.EQ.0 )
192  $ RETURN
193 *
194 * Determine the block size for this environment.
195 *
196  nb = ilaenv( 1, 'ZHEGST', uplo, n, -1, -1, -1 )
197 *
198  IF( nb.LE.1 .OR. nb.GE.n ) THEN
199 *
200 * Use unblocked code
201 *
202  CALL zhegs2( itype, uplo, n, a, lda, b, ldb, info )
203  ELSE
204 *
205 * Use blocked code
206 *
207  IF( itype.EQ.1 ) THEN
208  IF( upper ) THEN
209 *
210 * Compute inv(U**H)*A*inv(U)
211 *
212  DO 10 k = 1, n, nb
213  kb = min( n-k+1, nb )
214 *
215 * Update the upper triangle of A(k:n,k:n)
216 *
217  CALL zhegs2( itype, uplo, kb, a( k, k ), lda,
218  $ b( k, k ), ldb, info )
219  IF( k+kb.LE.n ) THEN
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 ),
236  $ lda )
237  END IF
238  10 CONTINUE
239  ELSE
240 *
241 * Compute inv(L)*A*inv(L**H)
242 *
243  DO 20 k = 1, n, nb
244  kb = min( n-k+1, nb )
245 *
246 * Update the lower triangle of A(k:n,k:n)
247 *
248  CALL zhegs2( itype, uplo, kb, a( k, k ), lda,
249  $ b( k, k ), ldb, info )
250  IF( k+kb.LE.n ) THEN
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 ),
267  $ lda )
268  END IF
269  20 CONTINUE
270  END IF
271  ELSE
272  IF( upper ) THEN
273 *
274 * Compute U*A*U**H
275 *
276  DO 30 k = 1, n, nb
277  kb = min( n-k+1, nb )
278 *
279 * Update the upper triangle of A(1:k+kb-1,1:k+kb-1)
280 *
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 ),
285  $ lda )
286  CALL zher2k( uplo, 'No transpose', k-1, kb, cone,
287  $ a( 1, k ), lda, b( 1, k ), ldb, one, a,
288  $ lda )
289  CALL zhemm( 'Right', uplo, k-1, kb, half, a( k, k ),
290  $ lda, b( 1, k ), ldb, cone, a( 1, k ),
291  $ lda )
292  CALL ztrmm( 'Right', uplo, 'Conjugate transpose',
293  $ 'Non-unit', k-1, kb, cone, b( k, k ), ldb,
294  $ a( 1, k ), lda )
295  CALL zhegs2( itype, uplo, kb, a( k, k ), lda,
296  $ b( k, k ), ldb, info )
297  30 CONTINUE
298  ELSE
299 *
300 * Compute L**H*A*L
301 *
302  DO 40 k = 1, n, nb
303  kb = min( n-k+1, nb )
304 *
305 * Update the lower triangle of A(1:k+kb-1,1:k+kb-1)
306 *
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 ),
311  $ lda )
312  CALL zher2k( uplo, 'Conjugate transpose', k-1, kb,
313  $ cone, a( k, 1 ), lda, b( k, 1 ), ldb,
314  $ one, a, lda )
315  CALL zhemm( 'Left', uplo, kb, k-1, half, a( k, k ),
316  $ lda, b( k, 1 ), ldb, cone, a( k, 1 ),
317  $ lda )
318  CALL ztrmm( 'Left', uplo, 'Conjugate transpose',
319  $ 'Non-unit', kb, k-1, cone, b( k, k ), ldb,
320  $ a( k, 1 ), lda )
321  CALL zhegs2( itype, uplo, kb, a( k, k ), lda,
322  $ b( k, k ), ldb, info )
323  40 CONTINUE
324  END IF
325  END IF
326  END IF
327  RETURN
328 *
329 * End of ZHEGST
330 *
331  END
subroutine zhegst(ITYPE, UPLO, N, A, LDA, B, LDB, INFO)
ZHEGST
Definition: zhegst.f:129
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine ztrmm(SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA, B, LDB)
ZTRMM
Definition: ztrmm.f:179
subroutine zhemm(SIDE, UPLO, M, N, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
ZHEMM
Definition: zhemm.f:193
subroutine zhegs2(ITYPE, UPLO, N, A, LDA, B, LDB, INFO)
ZHEGS2 reduces a Hermitian definite generalized eigenproblem to standard form, using the factorizatio...
Definition: zhegs2.f:129
subroutine zher2k(UPLO, TRANS, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
ZHER2K
Definition: zher2k.f:200
subroutine ztrsm(SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA, B, LDB)
ZTRSM
Definition: ztrsm.f:182