LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
zhpgvx.f
Go to the documentation of this file.
1*> \brief \b ZHPGVX
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download ZHPGVX + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zhpgvx.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zhpgvx.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zhpgvx.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE ZHPGVX( ITYPE, JOBZ, RANGE, UPLO, N, AP, BP, VL, VU,
20* IL, IU, ABSTOL, M, W, Z, LDZ, WORK, RWORK,
21* IWORK, IFAIL, INFO )
22*
23* .. Scalar Arguments ..
24* CHARACTER JOBZ, RANGE, UPLO
25* INTEGER IL, INFO, ITYPE, IU, LDZ, M, N
26* DOUBLE PRECISION ABSTOL, VL, VU
27* ..
28* .. Array Arguments ..
29* INTEGER IFAIL( * ), IWORK( * )
30* DOUBLE PRECISION RWORK( * ), W( * )
31* COMPLEX*16 AP( * ), BP( * ), WORK( * ), Z( LDZ, * )
32* ..
33*
34*
35*> \par Purpose:
36* =============
37*>
38*> \verbatim
39*>
40*> ZHPGVX computes selected eigenvalues and, optionally, eigenvectors
41*> of a complex generalized Hermitian-definite eigenproblem, of the form
42*> A*x=(lambda)*B*x, A*Bx=(lambda)*x, or B*A*x=(lambda)*x. Here A and
43*> B are assumed to be Hermitian, stored in packed format, and B is also
44*> positive definite. Eigenvalues and eigenvectors can be selected by
45*> specifying either a range of values or a range of indices for the
46*> desired eigenvalues.
47*> \endverbatim
48*
49* Arguments:
50* ==========
51*
52*> \param[in] ITYPE
53*> \verbatim
54*> ITYPE is INTEGER
55*> Specifies the problem type to be solved:
56*> = 1: A*x = (lambda)*B*x
57*> = 2: A*B*x = (lambda)*x
58*> = 3: B*A*x = (lambda)*x
59*> \endverbatim
60*>
61*> \param[in] JOBZ
62*> \verbatim
63*> JOBZ is CHARACTER*1
64*> = 'N': Compute eigenvalues only;
65*> = 'V': Compute eigenvalues and eigenvectors.
66*> \endverbatim
67*>
68*> \param[in] RANGE
69*> \verbatim
70*> RANGE is CHARACTER*1
71*> = 'A': all eigenvalues will be found;
72*> = 'V': all eigenvalues in the half-open interval (VL,VU]
73*> will be found;
74*> = 'I': the IL-th through IU-th eigenvalues will be found.
75*> \endverbatim
76*>
77*> \param[in] UPLO
78*> \verbatim
79*> UPLO is CHARACTER*1
80*> = 'U': Upper triangles of A and B are stored;
81*> = 'L': Lower triangles of A and B are stored.
82*> \endverbatim
83*>
84*> \param[in] N
85*> \verbatim
86*> N is INTEGER
87*> The order of the matrices A and B. N >= 0.
88*> \endverbatim
89*>
90*> \param[in,out] AP
91*> \verbatim
92*> AP is COMPLEX*16 array, dimension (N*(N+1)/2)
93*> On entry, the upper or lower triangle of the Hermitian matrix
94*> A, packed columnwise in a linear array. The j-th column of A
95*> is stored in the array AP as follows:
96*> if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
97*> if UPLO = 'L', AP(i + (j-1)*(2*n-j)/2) = A(i,j) for j<=i<=n.
98*>
99*> On exit, the contents of AP are destroyed.
100*> \endverbatim
101*>
102*> \param[in,out] BP
103*> \verbatim
104*> BP is COMPLEX*16 array, dimension (N*(N+1)/2)
105*> On entry, the upper or lower triangle of the Hermitian matrix
106*> B, packed columnwise in a linear array. The j-th column of B
107*> is stored in the array BP as follows:
108*> if UPLO = 'U', BP(i + (j-1)*j/2) = B(i,j) for 1<=i<=j;
109*> if UPLO = 'L', BP(i + (j-1)*(2*n-j)/2) = B(i,j) for j<=i<=n.
110*>
111*> On exit, the triangular factor U or L from the Cholesky
112*> factorization B = U**H*U or B = L*L**H, in the same storage
113*> format as B.
114*> \endverbatim
115*>
116*> \param[in] VL
117*> \verbatim
118*> VL is DOUBLE PRECISION
119*>
120*> If RANGE='V', the lower bound of the interval to
121*> be searched for eigenvalues. VL < VU.
122*> Not referenced if RANGE = 'A' or 'I'.
123*> \endverbatim
124*>
125*> \param[in] VU
126*> \verbatim
127*> VU is DOUBLE PRECISION
128*>
129*> If RANGE='V', the upper bound of the interval to
130*> be searched for eigenvalues. VL < VU.
131*> Not referenced if RANGE = 'A' or 'I'.
132*> \endverbatim
133*>
134*> \param[in] IL
135*> \verbatim
136*> IL is INTEGER
137*>
138*> If RANGE='I', the index of the
139*> smallest eigenvalue to be returned.
140*> 1 <= IL <= IU <= N, if N > 0; IL = 1 and IU = 0 if N = 0.
141*> Not referenced if RANGE = 'A' or 'V'.
142*> \endverbatim
143*>
144*> \param[in] IU
145*> \verbatim
146*> IU is INTEGER
147*>
148*> If RANGE='I', the index of the
149*> largest eigenvalue to be returned.
150*> 1 <= IL <= IU <= N, if N > 0; IL = 1 and IU = 0 if N = 0.
151*> Not referenced if RANGE = 'A' or 'V'.
152*> \endverbatim
153*>
154*> \param[in] ABSTOL
155*> \verbatim
156*> ABSTOL is DOUBLE PRECISION
157*> The absolute error tolerance for the eigenvalues.
158*> An approximate eigenvalue is accepted as converged
159*> when it is determined to lie in an interval [a,b]
160*> of width less than or equal to
161*>
162*> ABSTOL + EPS * max( |a|,|b| ) ,
163*>
164*> where EPS is the machine precision. If ABSTOL is less than
165*> or equal to zero, then EPS*|T| will be used in its place,
166*> where |T| is the 1-norm of the tridiagonal matrix obtained
167*> by reducing AP to tridiagonal form.
168*>
169*> Eigenvalues will be computed most accurately when ABSTOL is
170*> set to twice the underflow threshold 2*DLAMCH('S'), not zero.
171*> If this routine returns with INFO>0, indicating that some
172*> eigenvectors did not converge, try setting ABSTOL to
173*> 2*DLAMCH('S').
174*> \endverbatim
175*>
176*> \param[out] M
177*> \verbatim
178*> M is INTEGER
179*> The total number of eigenvalues found. 0 <= M <= N.
180*> If RANGE = 'A', M = N, and if RANGE = 'I', M = IU-IL+1.
181*> \endverbatim
182*>
183*> \param[out] W
184*> \verbatim
185*> W is DOUBLE PRECISION array, dimension (N)
186*> On normal exit, the first M elements contain the selected
187*> eigenvalues in ascending order.
188*> \endverbatim
189*>
190*> \param[out] Z
191*> \verbatim
192*> Z is COMPLEX*16 array, dimension (LDZ, N)
193*> If JOBZ = 'N', then Z is not referenced.
194*> If JOBZ = 'V', then if INFO = 0, the first M columns of Z
195*> contain the orthonormal eigenvectors of the matrix A
196*> corresponding to the selected eigenvalues, with the i-th
197*> column of Z holding the eigenvector associated with W(i).
198*> The eigenvectors are normalized as follows:
199*> if ITYPE = 1 or 2, Z**H*B*Z = I;
200*> if ITYPE = 3, Z**H*inv(B)*Z = I.
201*>
202*> If an eigenvector fails to converge, then that column of Z
203*> contains the latest approximation to the eigenvector, and the
204*> index of the eigenvector is returned in IFAIL.
205*> Note: the user must ensure that at least max(1,M) columns are
206*> supplied in the array Z; if RANGE = 'V', the exact value of M
207*> is not known in advance and an upper bound must be used.
208*> \endverbatim
209*>
210*> \param[in] LDZ
211*> \verbatim
212*> LDZ is INTEGER
213*> The leading dimension of the array Z. LDZ >= 1, and if
214*> JOBZ = 'V', LDZ >= max(1,N).
215*> \endverbatim
216*>
217*> \param[out] WORK
218*> \verbatim
219*> WORK is COMPLEX*16 array, dimension (2*N)
220*> \endverbatim
221*>
222*> \param[out] RWORK
223*> \verbatim
224*> RWORK is DOUBLE PRECISION array, dimension (7*N)
225*> \endverbatim
226*>
227*> \param[out] IWORK
228*> \verbatim
229*> IWORK is INTEGER array, dimension (5*N)
230*> \endverbatim
231*>
232*> \param[out] IFAIL
233*> \verbatim
234*> IFAIL is INTEGER array, dimension (N)
235*> If JOBZ = 'V', then if INFO = 0, the first M elements of
236*> IFAIL are zero. If INFO > 0, then IFAIL contains the
237*> indices of the eigenvectors that failed to converge.
238*> If JOBZ = 'N', then IFAIL is not referenced.
239*> \endverbatim
240*>
241*> \param[out] INFO
242*> \verbatim
243*> INFO is INTEGER
244*> = 0: successful exit
245*> < 0: if INFO = -i, the i-th argument had an illegal value
246*> > 0: ZPPTRF or ZHPEVX returned an error code:
247*> <= N: if INFO = i, ZHPEVX failed to converge;
248*> i eigenvectors failed to converge. Their indices
249*> are stored in array IFAIL.
250*> > N: if INFO = N + i, for 1 <= i <= n, then the leading
251*> principal minor of order i of B is not positive.
252*> The factorization of B could not be completed and
253*> no eigenvalues or eigenvectors were computed.
254*> \endverbatim
255*
256* Authors:
257* ========
258*
259*> \author Univ. of Tennessee
260*> \author Univ. of California Berkeley
261*> \author Univ. of Colorado Denver
262*> \author NAG Ltd.
263*
264*> \ingroup hpgvx
265*
266*> \par Contributors:
267* ==================
268*>
269*> Mark Fahey, Department of Mathematics, Univ. of Kentucky, USA
270*
271* =====================================================================
272 SUBROUTINE zhpgvx( ITYPE, JOBZ, RANGE, UPLO, N, AP, BP, VL, VU,
273 $ IL, IU, ABSTOL, M, W, Z, LDZ, WORK, RWORK,
274 $ IWORK, IFAIL, INFO )
275*
276* -- LAPACK driver routine --
277* -- LAPACK is a software package provided by Univ. of Tennessee, --
278* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
279*
280* .. Scalar Arguments ..
281 CHARACTER JOBZ, RANGE, UPLO
282 INTEGER IL, INFO, ITYPE, IU, LDZ, M, N
283 DOUBLE PRECISION ABSTOL, VL, VU
284* ..
285* .. Array Arguments ..
286 INTEGER IFAIL( * ), IWORK( * )
287 DOUBLE PRECISION RWORK( * ), W( * )
288 COMPLEX*16 AP( * ), BP( * ), WORK( * ), Z( LDZ, * )
289* ..
290*
291* =====================================================================
292*
293* .. Local Scalars ..
294 LOGICAL ALLEIG, INDEIG, UPPER, VALEIG, WANTZ
295 CHARACTER TRANS
296 INTEGER J
297* ..
298* .. External Functions ..
299 LOGICAL LSAME
300 EXTERNAL LSAME
301* ..
302* .. External Subroutines ..
303 EXTERNAL xerbla, zhpevx, zhpgst, zpptrf, ztpmv,
304 $ ztpsv
305* ..
306* .. Intrinsic Functions ..
307 INTRINSIC min
308* ..
309* .. Executable Statements ..
310*
311* Test the input parameters.
312*
313 wantz = lsame( jobz, 'V' )
314 upper = lsame( uplo, 'U' )
315 alleig = lsame( range, 'A' )
316 valeig = lsame( range, 'V' )
317 indeig = lsame( range, 'I' )
318*
319 info = 0
320 IF( itype.LT.1 .OR. itype.GT.3 ) THEN
321 info = -1
322 ELSE IF( .NOT.( wantz .OR. lsame( jobz, 'N' ) ) ) THEN
323 info = -2
324 ELSE IF( .NOT.( alleig .OR. valeig .OR. indeig ) ) THEN
325 info = -3
326 ELSE IF( .NOT.( upper .OR. lsame( uplo, 'L' ) ) ) THEN
327 info = -4
328 ELSE IF( n.LT.0 ) THEN
329 info = -5
330 ELSE
331 IF( valeig ) THEN
332 IF( n.GT.0 .AND. vu.LE.vl ) THEN
333 info = -9
334 END IF
335 ELSE IF( indeig ) THEN
336 IF( il.LT.1 ) THEN
337 info = -10
338 ELSE IF( iu.LT.min( n, il ) .OR. iu.GT.n ) THEN
339 info = -11
340 END IF
341 END IF
342 END IF
343 IF( info.EQ.0 ) THEN
344 IF( ldz.LT.1 .OR. ( wantz .AND. ldz.LT.n ) ) THEN
345 info = -16
346 END IF
347 END IF
348*
349 IF( info.NE.0 ) THEN
350 CALL xerbla( 'ZHPGVX', -info )
351 RETURN
352 END IF
353*
354* Quick return if possible
355*
356 IF( n.EQ.0 )
357 $ RETURN
358*
359* Form a Cholesky factorization of B.
360*
361 CALL zpptrf( uplo, n, bp, info )
362 IF( info.NE.0 ) THEN
363 info = n + info
364 RETURN
365 END IF
366*
367* Transform problem to standard eigenvalue problem and solve.
368*
369 CALL zhpgst( itype, uplo, n, ap, bp, info )
370 CALL zhpevx( jobz, range, uplo, n, ap, vl, vu, il, iu, abstol,
371 $ m,
372 $ w, z, ldz, work, rwork, iwork, ifail, info )
373*
374 IF( wantz ) THEN
375*
376* Backtransform eigenvectors to the original problem.
377*
378 IF( info.GT.0 )
379 $ m = info - 1
380 IF( itype.EQ.1 .OR. itype.EQ.2 ) THEN
381*
382* For A*x=(lambda)*B*x and A*B*x=(lambda)*x;
383* backtransform eigenvectors: x = inv(L)**H *y or inv(U)*y
384*
385 IF( upper ) THEN
386 trans = 'N'
387 ELSE
388 trans = 'C'
389 END IF
390*
391 DO 10 j = 1, m
392 CALL ztpsv( uplo, trans, 'Non-unit', n, bp, z( 1, j ),
393 $ 1 )
394 10 CONTINUE
395*
396 ELSE IF( itype.EQ.3 ) THEN
397*
398* For B*A*x=(lambda)*x;
399* backtransform eigenvectors: x = L*y or U**H *y
400*
401 IF( upper ) THEN
402 trans = 'C'
403 ELSE
404 trans = 'N'
405 END IF
406*
407 DO 20 j = 1, m
408 CALL ztpmv( uplo, trans, 'Non-unit', n, bp, z( 1, j ),
409 $ 1 )
410 20 CONTINUE
411 END IF
412 END IF
413*
414 RETURN
415*
416* End of ZHPGVX
417*
418 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine zhpevx(jobz, range, uplo, n, ap, vl, vu, il, iu, abstol, m, w, z, ldz, work, rwork, iwork, ifail, info)
ZHPEVX computes the eigenvalues and, optionally, the left and/or right eigenvectors for OTHER matrice...
Definition zhpevx.f:238
subroutine zhpgst(itype, uplo, n, ap, bp, info)
ZHPGST
Definition zhpgst.f:111
subroutine zhpgvx(itype, jobz, range, uplo, n, ap, bp, vl, vu, il, iu, abstol, m, w, z, ldz, work, rwork, iwork, ifail, info)
ZHPGVX
Definition zhpgvx.f:275
subroutine zpptrf(uplo, n, ap, info)
ZPPTRF
Definition zpptrf.f:117
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