LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
zheevr.f
Go to the documentation of this file.
1*> \brief <b> ZHEEVR computes the eigenvalues and, optionally, the left and/or right eigenvectors for HE matrices</b>
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download ZHEEVR + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zheevr.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zheevr.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zheevr.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE ZHEEVR( JOBZ, RANGE, UPLO, N, A, LDA, VL, VU, IL, IU,
20* ABSTOL, M, W, Z, LDZ, ISUPPZ, WORK, LWORK,
21* RWORK, LRWORK, IWORK, LIWORK, INFO )
22*
23* .. Scalar Arguments ..
24* CHARACTER JOBZ, RANGE, UPLO
25* INTEGER IL, INFO, IU, LDA, LDZ, LIWORK, LRWORK, LWORK,
26* $ M, N
27* DOUBLE PRECISION ABSTOL, VL, VU
28* ..
29* .. Array Arguments ..
30* INTEGER ISUPPZ( * ), IWORK( * )
31* DOUBLE PRECISION RWORK( * ), W( * )
32* COMPLEX*16 A( LDA, * ), WORK( * ), Z( LDZ, * )
33* ..
34*
35*
36*> \par Purpose:
37* =============
38*>
39*> \verbatim
40*>
41*> ZHEEVR computes selected eigenvalues and, optionally, eigenvectors
42*> of a complex Hermitian matrix A. Eigenvalues and eigenvectors can be
43*> selected by specifying either a range of values or a range of indices
44*> for the desired eigenvalues. Invocations with different choices for
45*> these parameters may result in the computation of slightly different
46*> eigenvalues and/or eigenvectors for the same matrix. The reason for
47*> this behavior is that there exists a variety of algorithms (each
48*> performing best for a particular set of options) with ZHEEVR
49*> attempting to select the best based on the various parameters. In all
50*> cases, the computed values are accurate within the limits of finite
51*> precision arithmetic.
52*>
53*> ZHEEVR first reduces the matrix A to tridiagonal form T with a call
54*> to ZHETRD. Then, whenever possible, ZHEEVR calls ZSTEMR to compute
55*> eigenspectrum using Relatively Robust Representations. ZSTEMR
56*> computes eigenvalues by the dqds algorithm, while orthogonal
57*> eigenvectors are computed from various "good" L D L^T representations
58*> (also known as Relatively Robust Representations). Gram-Schmidt
59*> orthogonalization is avoided as far as possible. More specifically,
60*> the various steps of the algorithm are as follows.
61*>
62*> For each unreduced block (submatrix) of T,
63*> (a) Compute T - sigma I = L D L^T, so that L and D
64*> define all the wanted eigenvalues to high relative accuracy.
65*> This means that small relative changes in the entries of D and L
66*> cause only small relative changes in the eigenvalues and
67*> eigenvectors. The standard (unfactored) representation of the
68*> tridiagonal matrix T does not have this property in general.
69*> (b) Compute the eigenvalues to suitable accuracy.
70*> If the eigenvectors are desired, the algorithm attains full
71*> accuracy of the computed eigenvalues only right before
72*> the corresponding vectors have to be computed, see steps c) and d).
73*> (c) For each cluster of close eigenvalues, select a new
74*> shift close to the cluster, find a new factorization, and refine
75*> the shifted eigenvalues to suitable accuracy.
76*> (d) For each eigenvalue with a large enough relative separation compute
77*> the corresponding eigenvector by forming a rank revealing twisted
78*> factorization. Go back to (c) for any clusters that remain.
79*>
80*> The desired accuracy of the output can be specified by the input
81*> parameter ABSTOL.
82*>
83*> For more details, see ZSTEMR's documentation and:
84*> - Inderjit S. Dhillon and Beresford N. Parlett: "Multiple representations
85*> to compute orthogonal eigenvectors of symmetric tridiagonal matrices,"
86*> Linear Algebra and its Applications, 387(1), pp. 1-28, August 2004.
87*> - Inderjit Dhillon and Beresford Parlett: "Orthogonal Eigenvectors and
88*> Relative Gaps," SIAM Journal on Matrix Analysis and Applications, Vol. 25,
89*> 2004. Also LAPACK Working Note 154.
90*> - Inderjit Dhillon: "A new O(n^2) algorithm for the symmetric
91*> tridiagonal eigenvalue/eigenvector problem",
92*> Computer Science Division Technical Report No. UCB/CSD-97-971,
93*> UC Berkeley, May 1997.
94*>
95*>
96*> Note 1 : ZHEEVR calls ZSTEMR when the full spectrum is requested
97*> on machines which conform to the ieee-754 floating point standard.
98*> ZHEEVR calls DSTEBZ and ZSTEIN on non-ieee machines and
99*> when partial spectrum requests are made.
100*>
101*> Normal execution of ZSTEMR may create NaNs and infinities and
102*> hence may abort due to a floating point exception in environments
103*> which do not handle NaNs and infinities in the ieee standard default
104*> manner.
105*> \endverbatim
106*
107* Arguments:
108* ==========
109*
110*> \param[in] JOBZ
111*> \verbatim
112*> JOBZ is CHARACTER*1
113*> = 'N': Compute eigenvalues only;
114*> = 'V': Compute eigenvalues and eigenvectors.
115*>
116*> This parameter influences the choice of the algorithm and
117*> may alter the computed values.
118*> \endverbatim
119*>
120*> \param[in] RANGE
121*> \verbatim
122*> RANGE is CHARACTER*1
123*> = 'A': all eigenvalues will be found.
124*> = 'V': all eigenvalues in the half-open interval (VL,VU]
125*> will be found.
126*> = 'I': the IL-th through IU-th eigenvalues will be found.
127*> For RANGE = 'V' or 'I' and IU - IL < N - 1, DSTEBZ and
128*> ZSTEIN are called
129*>
130*> This parameter influences the choice of the algorithm and
131*> may alter the computed values.
132*> \endverbatim
133*>
134*> \param[in] UPLO
135*> \verbatim
136*> UPLO is CHARACTER*1
137*> = 'U': Upper triangle of A is stored;
138*> = 'L': Lower triangle of A is stored.
139*> \endverbatim
140*>
141*> \param[in] N
142*> \verbatim
143*> N is INTEGER
144*> The order of the matrix A. N >= 0.
145*> \endverbatim
146*>
147*> \param[in,out] A
148*> \verbatim
149*> A is COMPLEX*16 array, dimension (LDA, N)
150*> On entry, the Hermitian matrix A. If UPLO = 'U', the
151*> leading N-by-N upper triangular part of A contains the
152*> upper triangular part of the matrix A. If UPLO = 'L',
153*> the leading N-by-N lower triangular part of A contains
154*> the lower triangular part of the matrix A.
155*> On exit, the lower triangle (if UPLO='L') or the upper
156*> triangle (if UPLO='U') of A, including the diagonal, is
157*> destroyed.
158*> \endverbatim
159*>
160*> \param[in] LDA
161*> \verbatim
162*> LDA is INTEGER
163*> The leading dimension of the array A. LDA >= max(1,N).
164*> \endverbatim
165*>
166*> \param[in] VL
167*> \verbatim
168*> VL is DOUBLE PRECISION
169*> If RANGE='V', the lower bound of the interval to
170*> be searched for eigenvalues. VL < VU.
171*> Not referenced if RANGE = 'A' or 'I'.
172*> \endverbatim
173*>
174*> \param[in] VU
175*> \verbatim
176*> VU is DOUBLE PRECISION
177*> If RANGE='V', the upper bound of the interval to
178*> be searched for eigenvalues. VL < VU.
179*> Not referenced if RANGE = 'A' or 'I'.
180*> \endverbatim
181*>
182*> \param[in] IL
183*> \verbatim
184*> IL is INTEGER
185*> If RANGE='I', the index of the
186*> smallest eigenvalue to be returned.
187*> 1 <= IL <= IU <= N, if N > 0; IL = 1 and IU = 0 if N = 0.
188*> Not referenced if RANGE = 'A' or 'V'.
189*> \endverbatim
190*>
191*> \param[in] IU
192*> \verbatim
193*> IU is INTEGER
194*> If RANGE='I', the index of the
195*> largest eigenvalue to be returned.
196*> 1 <= IL <= IU <= N, if N > 0; IL = 1 and IU = 0 if N = 0.
197*> Not referenced if RANGE = 'A' or 'V'.
198*> \endverbatim
199*>
200*> \param[in] ABSTOL
201*> \verbatim
202*> ABSTOL is DOUBLE PRECISION
203*> The absolute error tolerance for the eigenvalues.
204*> An approximate eigenvalue is accepted as converged
205*> when it is determined to lie in an interval [a,b]
206*> of width less than or equal to
207*>
208*> ABSTOL + EPS * max( |a|,|b| ) ,
209*>
210*> where EPS is the machine precision. If ABSTOL is less than
211*> or equal to zero, then EPS*|T| will be used in its place,
212*> where |T| is the 1-norm of the tridiagonal matrix obtained
213*> by reducing A to tridiagonal form.
214*>
215*> See "Computing Small Singular Values of Bidiagonal Matrices
216*> with Guaranteed High Relative Accuracy," by Demmel and
217*> Kahan, LAPACK Working Note #3.
218*>
219*> If high relative accuracy is important, set ABSTOL to
220*> DLAMCH( 'Safe minimum' ). Doing so will guarantee that
221*> eigenvalues are computed to high relative accuracy when
222*> possible in future releases. The current code does not
223*> make any guarantees about high relative accuracy, but
224*> future releases will. See J. Barlow and J. Demmel,
225*> "Computing Accurate Eigensystems of Scaled Diagonally
226*> Dominant Matrices", LAPACK Working Note #7, for a discussion
227*> of which matrices define their eigenvalues to high relative
228*> accuracy.
229*> \endverbatim
230*>
231*> \param[out] M
232*> \verbatim
233*> M is INTEGER
234*> The total number of eigenvalues found. 0 <= M <= N.
235*> If RANGE = 'A', M = N, and if RANGE = 'I', M = IU-IL+1.
236*> \endverbatim
237*>
238*> \param[out] W
239*> \verbatim
240*> W is DOUBLE PRECISION array, dimension (N)
241*> The first M elements contain the selected eigenvalues in
242*> ascending order.
243*> \endverbatim
244*>
245*> \param[out] Z
246*> \verbatim
247*> Z is COMPLEX*16 array, dimension (LDZ, max(1,M))
248*> If JOBZ = 'V', then if INFO = 0, the first M columns of Z
249*> contain the orthonormal eigenvectors of the matrix A
250*> corresponding to the selected eigenvalues, with the i-th
251*> column of Z holding the eigenvector associated with W(i).
252*> If JOBZ = 'N', then Z is not referenced.
253*> Note: the user must ensure that at least max(1,M) columns are
254*> supplied in the array Z; if RANGE = 'V', the exact value of M
255*> is not known in advance and an upper bound must be used.
256*> Supplying N columns is always safe.
257*> \endverbatim
258*>
259*> \param[in] LDZ
260*> \verbatim
261*> LDZ is INTEGER
262*> The leading dimension of the array Z. LDZ >= 1, and if
263*> JOBZ = 'V', LDZ >= max(1,N).
264*> \endverbatim
265*>
266*> \param[out] ISUPPZ
267*> \verbatim
268*> ISUPPZ is INTEGER array, dimension ( 2*max(1,M) )
269*> The support of the eigenvectors in Z, i.e., the indices
270*> indicating the nonzero elements in Z. The i-th eigenvector
271*> is nonzero only in elements ISUPPZ( 2*i-1 ) through
272*> ISUPPZ( 2*i ). This is an output of ZSTEMR (tridiagonal
273*> matrix). The support of the eigenvectors of A is typically
274*> 1:N because of the unitary transformations applied by ZUNMTR.
275*> Implemented only for RANGE = 'A' or 'I' and IU - IL = N - 1
276*> \endverbatim
277*>
278*> \param[out] WORK
279*> \verbatim
280*> WORK is COMPLEX*16 array, dimension (MAX(1,LWORK))
281*> On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
282*> \endverbatim
283*>
284*> \param[in] LWORK
285*> \verbatim
286*> LWORK is INTEGER
287*> The length of the array WORK.
288*> If N <= 1, LWORK >= 1, else LWORK >= 2*N.
289*> For optimal efficiency, LWORK >= (NB+1)*N,
290*> where NB is the max of the blocksize for ZHETRD and for
291*> ZUNMTR as returned by ILAENV.
292*>
293*> If LWORK = -1, then a workspace query is assumed; the routine
294*> only calculates the optimal sizes of the WORK, RWORK and
295*> IWORK arrays, returns these values as the first entries of
296*> the WORK, RWORK and IWORK arrays, and no error message
297*> related to LWORK or LRWORK or LIWORK is issued by XERBLA.
298*> \endverbatim
299*>
300*> \param[out] RWORK
301*> \verbatim
302*> RWORK is DOUBLE PRECISION array, dimension (MAX(1,LRWORK))
303*> On exit, if INFO = 0, RWORK(1) returns the optimal
304*> (and minimal) LRWORK.
305*> \endverbatim
306*>
307*> \param[in] LRWORK
308*> \verbatim
309*> LRWORK is INTEGER
310*> The length of the array RWORK.
311*> If N <= 1, LRWORK >= 1, else LRWORK >= 24*N.
312*>
313*> If LRWORK = -1, then a workspace query is assumed; the
314*> routine only calculates the optimal sizes of the WORK, RWORK
315*> and IWORK arrays, returns these values as the first entries
316*> of the WORK, RWORK and IWORK arrays, and no error message
317*> related to LWORK or LRWORK or LIWORK is issued by XERBLA.
318*> \endverbatim
319*>
320*> \param[out] IWORK
321*> \verbatim
322*> IWORK is INTEGER array, dimension (MAX(1,LIWORK))
323*> On exit, if INFO = 0, IWORK(1) returns the optimal
324*> (and minimal) LIWORK.
325*> \endverbatim
326*>
327*> \param[in] LIWORK
328*> \verbatim
329*> LIWORK is INTEGER
330*> The dimension of the array IWORK.
331*> If N <= 1, LIWORK >= 1, else LIWORK >= 10*N.
332*>
333*> If LIWORK = -1, then a workspace query is assumed; the
334*> routine only calculates the optimal sizes of the WORK, RWORK
335*> and IWORK arrays, returns these values as the first entries
336*> of the WORK, RWORK and IWORK arrays, and no error message
337*> related to LWORK or LRWORK or LIWORK is issued by XERBLA.
338*> \endverbatim
339*>
340*> \param[out] INFO
341*> \verbatim
342*> INFO is INTEGER
343*> = 0: successful exit
344*> < 0: if INFO = -i, the i-th argument had an illegal value
345*> > 0: Internal error
346*> \endverbatim
347*
348* Authors:
349* ========
350*
351*> \author Univ. of Tennessee
352*> \author Univ. of California Berkeley
353*> \author Univ. of Colorado Denver
354*> \author NAG Ltd.
355*
356*> \ingroup heevr
357*
358*> \par Contributors:
359* ==================
360*>
361*> Inderjit Dhillon, IBM Almaden, USA \n
362*> Osni Marques, LBNL/NERSC, USA \n
363*> Ken Stanley, Computer Science Division, University of
364*> California at Berkeley, USA \n
365*> Jason Riedy, Computer Science Division, University of
366*> California at Berkeley, USA \n
367*>
368* =====================================================================
369 SUBROUTINE zheevr( JOBZ, RANGE, UPLO, N, A, LDA, VL, VU, IL,
370 $ IU,
371 $ ABSTOL, M, W, Z, LDZ, ISUPPZ, WORK, LWORK,
372 $ RWORK, LRWORK, IWORK, LIWORK, INFO )
373*
374* -- LAPACK driver routine --
375* -- LAPACK is a software package provided by Univ. of Tennessee, --
376* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
377*
378* .. Scalar Arguments ..
379 CHARACTER JOBZ, RANGE, UPLO
380 INTEGER IL, INFO, IU, LDA, LDZ, LIWORK, LRWORK, LWORK,
381 $ M, N
382 DOUBLE PRECISION ABSTOL, VL, VU
383* ..
384* .. Array Arguments ..
385 INTEGER ISUPPZ( * ), IWORK( * )
386 DOUBLE PRECISION RWORK( * ), W( * )
387 COMPLEX*16 A( LDA, * ), WORK( * ), Z( LDZ, * )
388* ..
389*
390* =====================================================================
391*
392* .. Parameters ..
393 DOUBLE PRECISION ZERO, ONE, TWO
394 PARAMETER ( ZERO = 0.0d+0, one = 1.0d+0, two = 2.0d+0 )
395* ..
396* .. Local Scalars ..
397 LOGICAL ALLEIG, INDEIG, LOWER, LQUERY, TEST, VALEIG,
398 $ WANTZ, TRYRAC
399 CHARACTER ORDER
400 INTEGER I, IEEEOK, IINFO, IMAX, INDIBL, INDIFL, INDISP,
401 $ INDIWO, INDRD, INDRDD, INDRE, INDREE, INDRWK,
402 $ indtau, indwk, indwkn, iscale, itmp1, j, jj,
403 $ liwmin, llwork, llrwork, llwrkn, lrwmin,
404 $ lwkopt, lwmin, nb, nsplit
405 DOUBLE PRECISION ABSTLL, ANRM, BIGNUM, EPS, RMAX, RMIN, SAFMIN,
406 $ SIGMA, SMLNUM, TMP1, VLL, VUU
407* ..
408* .. External Functions ..
409 LOGICAL LSAME
410 INTEGER ILAENV
411 DOUBLE PRECISION DLAMCH, ZLANSY
412 EXTERNAL lsame, ilaenv, dlamch, zlansy
413* ..
414* .. External Subroutines ..
415 EXTERNAL dcopy, dscal, dstebz, dsterf, xerbla,
416 $ zdscal,
418* ..
419* .. Intrinsic Functions ..
420 INTRINSIC dble, max, min, sqrt
421* ..
422* .. Executable Statements ..
423*
424* Test the input parameters.
425*
426 ieeeok = ilaenv( 10, 'ZHEEVR', 'N', 1, 2, 3, 4 )
427*
428 lower = lsame( uplo, 'L' )
429 wantz = lsame( jobz, 'V' )
430 alleig = lsame( range, 'A' )
431 valeig = lsame( range, 'V' )
432 indeig = lsame( range, 'I' )
433*
434 lquery = ( ( lwork.EQ.-1 ) .OR. ( lrwork.EQ.-1 ) .OR.
435 $ ( liwork.EQ.-1 ) )
436*
437 IF( n.LE.1 ) THEN
438 lwmin = 1
439 lrwmin = 1
440 liwmin = 1
441 ELSE
442 lwmin = 2*n
443 lrwmin = 24*n
444 liwmin = 10*n
445 END IF
446*
447 info = 0
448 IF( .NOT.( wantz .OR. lsame( jobz, 'N' ) ) ) THEN
449 info = -1
450 ELSE IF( .NOT.( alleig .OR. valeig .OR. indeig ) ) THEN
451 info = -2
452 ELSE IF( .NOT.( lower .OR. lsame( uplo, 'U' ) ) ) THEN
453 info = -3
454 ELSE IF( n.LT.0 ) THEN
455 info = -4
456 ELSE IF( lda.LT.max( 1, n ) ) THEN
457 info = -6
458 ELSE
459 IF( valeig ) THEN
460 IF( n.GT.0 .AND. vu.LE.vl )
461 $ info = -8
462 ELSE IF( indeig ) THEN
463 IF( il.LT.1 .OR. il.GT.max( 1, n ) ) THEN
464 info = -9
465 ELSE IF( iu.LT.min( n, il ) .OR. iu.GT.n ) THEN
466 info = -10
467 END IF
468 END IF
469 END IF
470 IF( info.EQ.0 ) THEN
471 IF( ldz.LT.1 .OR. ( wantz .AND. ldz.LT.n ) ) THEN
472 info = -15
473 END IF
474 END IF
475*
476 IF( info.EQ.0 ) THEN
477 nb = ilaenv( 1, 'ZHETRD', uplo, n, -1, -1, -1 )
478 nb = max( nb, ilaenv( 1, 'ZUNMTR', uplo, n, -1, -1, -1 ) )
479 lwkopt = max( ( nb+1 )*n, lwmin )
480 work( 1 ) = lwkopt
481 rwork( 1 ) = real( lrwmin )
482 iwork( 1 ) = liwmin
483*
484 IF( lwork.LT.lwmin .AND. .NOT.lquery ) THEN
485 info = -18
486 ELSE IF( lrwork.LT.lrwmin .AND. .NOT.lquery ) THEN
487 info = -20
488 ELSE IF( liwork.LT.liwmin .AND. .NOT.lquery ) THEN
489 info = -22
490 END IF
491 END IF
492*
493 IF( info.NE.0 ) THEN
494 CALL xerbla( 'ZHEEVR', -info )
495 RETURN
496 ELSE IF( lquery ) THEN
497 RETURN
498 END IF
499*
500* Quick return if possible
501*
502 m = 0
503 IF( n.EQ.0 ) THEN
504 work( 1 ) = 1
505 RETURN
506 END IF
507*
508 IF( n.EQ.1 ) THEN
509 work( 1 ) = 1
510 IF( alleig .OR. indeig ) THEN
511 m = 1
512 w( 1 ) = dble( a( 1, 1 ) )
513 ELSE
514 IF( vl.LT.dble( a( 1, 1 ) ) .AND. vu.GE.dble( a( 1, 1 ) ) )
515 $ THEN
516 m = 1
517 w( 1 ) = dble( a( 1, 1 ) )
518 END IF
519 END IF
520 IF( wantz ) THEN
521 z( 1, 1 ) = one
522 isuppz( 1 ) = 1
523 isuppz( 2 ) = 1
524 END IF
525 RETURN
526 END IF
527*
528* Get machine constants.
529*
530 safmin = dlamch( 'Safe minimum' )
531 eps = dlamch( 'Precision' )
532 smlnum = safmin / eps
533 bignum = one / smlnum
534 rmin = sqrt( smlnum )
535 rmax = min( sqrt( bignum ), one / sqrt( sqrt( safmin ) ) )
536*
537* Scale matrix to allowable range, if necessary.
538*
539 iscale = 0
540 abstll = abstol
541 IF (valeig) THEN
542 vll = vl
543 vuu = vu
544 END IF
545 anrm = zlansy( 'M', uplo, n, a, lda, rwork )
546 IF( anrm.GT.zero .AND. anrm.LT.rmin ) THEN
547 iscale = 1
548 sigma = rmin / anrm
549 ELSE IF( anrm.GT.rmax ) THEN
550 iscale = 1
551 sigma = rmax / anrm
552 END IF
553 IF( iscale.EQ.1 ) THEN
554 IF( lower ) THEN
555 DO 10 j = 1, n
556 CALL zdscal( n-j+1, sigma, a( j, j ), 1 )
557 10 CONTINUE
558 ELSE
559 DO 20 j = 1, n
560 CALL zdscal( j, sigma, a( 1, j ), 1 )
561 20 CONTINUE
562 END IF
563 IF( abstol.GT.0 )
564 $ abstll = abstol*sigma
565 IF( valeig ) THEN
566 vll = vl*sigma
567 vuu = vu*sigma
568 END IF
569 END IF
570
571* Initialize indices into workspaces. Note: The IWORK indices are
572* used only if DSTERF or ZSTEMR fail.
573
574* WORK(INDTAU:INDTAU+N-1) stores the complex scalar factors of the
575* elementary reflectors used in ZHETRD.
576 indtau = 1
577* INDWK is the starting offset of the remaining complex workspace,
578* and LLWORK is the remaining complex workspace size.
579 indwk = indtau + n
580 llwork = lwork - indwk + 1
581
582* RWORK(INDRD:INDRD+N-1) stores the real tridiagonal's diagonal
583* entries.
584 indrd = 1
585* RWORK(INDRE:INDRE+N-1) stores the off-diagonal entries of the
586* tridiagonal matrix from ZHETRD.
587 indre = indrd + n
588* RWORK(INDRDD:INDRDD+N-1) is a copy of the diagonal entries over
589* -written by ZSTEMR (the DSTERF path copies the diagonal to W).
590 indrdd = indre + n
591* RWORK(INDREE:INDREE+N-1) is a copy of the off-diagonal entries over
592* -written while computing the eigenvalues in DSTERF and ZSTEMR.
593 indree = indrdd + n
594* INDRWK is the starting offset of the left-over real workspace, and
595* LLRWORK is the remaining workspace size.
596 indrwk = indree + n
597 llrwork = lrwork - indrwk + 1
598
599* IWORK(INDIBL:INDIBL+M-1) corresponds to IBLOCK in DSTEBZ and
600* stores the block indices of each of the M<=N eigenvalues.
601 indibl = 1
602* IWORK(INDISP:INDISP+NSPLIT-1) corresponds to ISPLIT in DSTEBZ and
603* stores the starting and finishing indices of each block.
604 indisp = indibl + n
605* IWORK(INDIFL:INDIFL+N-1) stores the indices of eigenvectors
606* that corresponding to eigenvectors that fail to converge in
607* DSTEIN. This information is discarded; if any fail, the driver
608* returns INFO > 0.
609 indifl = indisp + n
610* INDIWO is the offset of the remaining integer workspace.
611 indiwo = indifl + n
612
613*
614* Call ZHETRD to reduce Hermitian matrix to tridiagonal form.
615*
616 CALL zhetrd( uplo, n, a, lda, rwork( indrd ), rwork( indre ),
617 $ work( indtau ), work( indwk ), llwork, iinfo )
618*
619* If all eigenvalues are desired
620* then call DSTERF or ZSTEMR and ZUNMTR.
621*
622 test = .false.
623 IF( indeig ) THEN
624 IF( il.EQ.1 .AND. iu.EQ.n ) THEN
625 test = .true.
626 END IF
627 END IF
628 IF( ( alleig.OR.test ) .AND. ( ieeeok.EQ.1 ) ) THEN
629 IF( .NOT.wantz ) THEN
630 CALL dcopy( n, rwork( indrd ), 1, w, 1 )
631 CALL dcopy( n-1, rwork( indre ), 1, rwork( indree ), 1 )
632 CALL dsterf( n, w, rwork( indree ), info )
633 ELSE
634 CALL dcopy( n-1, rwork( indre ), 1, rwork( indree ), 1 )
635 CALL dcopy( n, rwork( indrd ), 1, rwork( indrdd ), 1 )
636*
637 IF (abstol .LE. two*n*eps) THEN
638 tryrac = .true.
639 ELSE
640 tryrac = .false.
641 END IF
642 CALL zstemr( jobz, 'A', n, rwork( indrdd ),
643 $ rwork( indree ), vl, vu, il, iu, m, w,
644 $ z, ldz, n, isuppz, tryrac,
645 $ rwork( indrwk ), llrwork,
646 $ iwork, liwork, info )
647*
648* Apply unitary matrix used in reduction to tridiagonal
649* form to eigenvectors returned by ZSTEMR.
650*
651 IF( wantz .AND. info.EQ.0 ) THEN
652 indwkn = indwk
653 llwrkn = lwork - indwkn + 1
654 CALL zunmtr( 'L', uplo, 'N', n, m, a, lda,
655 $ work( indtau ), z, ldz, work( indwkn ),
656 $ llwrkn, iinfo )
657 END IF
658 END IF
659*
660*
661 IF( info.EQ.0 ) THEN
662 m = n
663 GO TO 30
664 END IF
665 info = 0
666 END IF
667*
668* Otherwise, call DSTEBZ and, if eigenvectors are desired, ZSTEIN.
669* Also call DSTEBZ and ZSTEIN if ZSTEMR fails.
670*
671 IF( wantz ) THEN
672 order = 'B'
673 ELSE
674 order = 'E'
675 END IF
676
677 CALL dstebz( range, order, n, vll, vuu, il, iu, abstll,
678 $ rwork( indrd ), rwork( indre ), m, nsplit, w,
679 $ iwork( indibl ), iwork( indisp ), rwork( indrwk ),
680 $ iwork( indiwo ), info )
681*
682 IF( wantz ) THEN
683 CALL zstein( n, rwork( indrd ), rwork( indre ), m, w,
684 $ iwork( indibl ), iwork( indisp ), z, ldz,
685 $ rwork( indrwk ), iwork( indiwo ), iwork( indifl ),
686 $ info )
687*
688* Apply unitary matrix used in reduction to tridiagonal
689* form to eigenvectors returned by ZSTEIN.
690*
691 indwkn = indwk
692 llwrkn = lwork - indwkn + 1
693 CALL zunmtr( 'L', uplo, 'N', n, m, a, lda, work( indtau ),
694 $ z,
695 $ ldz, work( indwkn ), llwrkn, iinfo )
696 END IF
697*
698* If matrix was scaled, then rescale eigenvalues appropriately.
699*
700 30 CONTINUE
701 IF( iscale.EQ.1 ) THEN
702 IF( info.EQ.0 ) THEN
703 imax = m
704 ELSE
705 imax = info - 1
706 END IF
707 CALL dscal( imax, one / sigma, w, 1 )
708 END IF
709*
710* If eigenvalues are not in order, then sort them, along with
711* eigenvectors.
712*
713 IF( wantz ) THEN
714 DO 50 j = 1, m - 1
715 i = 0
716 tmp1 = w( j )
717 DO 40 jj = j + 1, m
718 IF( w( jj ).LT.tmp1 ) THEN
719 i = jj
720 tmp1 = w( jj )
721 END IF
722 40 CONTINUE
723*
724 IF( i.NE.0 ) THEN
725 itmp1 = iwork( indibl+i-1 )
726 w( i ) = w( j )
727 iwork( indibl+i-1 ) = iwork( indibl+j-1 )
728 w( j ) = tmp1
729 iwork( indibl+j-1 ) = itmp1
730 CALL zswap( n, z( 1, i ), 1, z( 1, j ), 1 )
731 END IF
732 50 CONTINUE
733 END IF
734*
735* Set WORK(1) to optimal workspace size.
736*
737 work( 1 ) = lwkopt
738 rwork( 1 ) = real( lrwmin )
739 iwork( 1 ) = liwmin
740*
741 RETURN
742*
743* End of ZHEEVR
744*
745 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine dcopy(n, dx, incx, dy, incy)
DCOPY
Definition dcopy.f:82
subroutine zheevr(jobz, range, uplo, n, a, lda, vl, vu, il, iu, abstol, m, w, z, ldz, isuppz, work, lwork, rwork, lrwork, iwork, liwork, info)
ZHEEVR computes the eigenvalues and, optionally, the left and/or right eigenvectors for HE matrices
Definition zheevr.f:373
subroutine zhetrd(uplo, n, a, lda, d, e, tau, work, lwork, info)
ZHETRD
Definition zhetrd.f:191
subroutine dscal(n, da, dx, incx)
DSCAL
Definition dscal.f:79
subroutine zdscal(n, da, zx, incx)
ZDSCAL
Definition zdscal.f:78
subroutine dstebz(range, order, n, vl, vu, il, iu, abstol, d, e, m, nsplit, w, iblock, isplit, work, iwork, info)
DSTEBZ
Definition dstebz.f:272
subroutine zstein(n, d, e, m, w, iblock, isplit, z, ldz, work, iwork, ifail, info)
ZSTEIN
Definition zstein.f:180
subroutine zstemr(jobz, range, n, d, e, vl, vu, il, iu, m, w, z, ldz, nzc, isuppz, tryrac, work, lwork, iwork, liwork, info)
ZSTEMR
Definition zstemr.f:337
subroutine dsterf(n, d, e, info)
DSTERF
Definition dsterf.f:84
subroutine zswap(n, zx, incx, zy, incy)
ZSWAP
Definition zswap.f:81
subroutine zunmtr(side, uplo, trans, m, n, a, lda, tau, c, ldc, work, lwork, info)
ZUNMTR
Definition zunmtr.f:170