1: *> \brief <b> ZHBEVX_2STAGE computes the eigenvalues and, optionally, the left and/or right eigenvectors for OTHER matrices</b>
2: *
3: * @precisions fortran z -> s d c
4: *
5: * =========== DOCUMENTATION ===========
6: *
7: * Online html documentation available at
8: * http://www.netlib.org/lapack/explore-html/
9: *
10: *> \htmlonly
11: *> Download ZHBEVX_2STAGE + dependencies
12: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zhbevx_2stage.f">
13: *> [TGZ]</a>
14: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zhbevx_2stage.f">
15: *> [ZIP]</a>
16: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zhbevx_2stage.f">
17: *> [TXT]</a>
18: *> \endhtmlonly
19: *
20: * Definition:
21: * ===========
22: *
23: * SUBROUTINE ZHBEVX_2STAGE( JOBZ, RANGE, UPLO, N, KD, AB, LDAB,
24: * Q, LDQ, VL, VU, IL, IU, ABSTOL, M, W,
25: * Z, LDZ, WORK, LWORK, RWORK, IWORK,
26: * IFAIL, INFO )
27: *
28: * IMPLICIT NONE
29: *
30: * .. Scalar Arguments ..
31: * CHARACTER JOBZ, RANGE, UPLO
32: * INTEGER IL, INFO, IU, KD, LDAB, LDQ, LDZ, M, N, LWORK
33: * DOUBLE PRECISION ABSTOL, VL, VU
34: * ..
35: * .. Array Arguments ..
36: * INTEGER IFAIL( * ), IWORK( * )
37: * DOUBLE PRECISION RWORK( * ), W( * )
38: * COMPLEX*16 AB( LDAB, * ), Q( LDQ, * ), WORK( * ),
39: * $ Z( LDZ, * )
40: * ..
41: *
42: *
43: *> \par Purpose:
44: * =============
45: *>
46: *> \verbatim
47: *>
48: *> ZHBEVX_2STAGE computes selected eigenvalues and, optionally, eigenvectors
49: *> of a complex Hermitian band matrix A using the 2stage technique for
50: *> the reduction to tridiagonal. Eigenvalues and eigenvectors
51: *> can be selected by specifying either a range of values or a range of
52: *> indices for the desired eigenvalues.
53: *> \endverbatim
54: *
55: * Arguments:
56: * ==========
57: *
58: *> \param[in] JOBZ
59: *> \verbatim
60: *> JOBZ is CHARACTER*1
61: *> = 'N': Compute eigenvalues only;
62: *> = 'V': Compute eigenvalues and eigenvectors.
63: *> Not available in this release.
64: *> \endverbatim
65: *>
66: *> \param[in] RANGE
67: *> \verbatim
68: *> RANGE is CHARACTER*1
69: *> = 'A': all eigenvalues will be found;
70: *> = 'V': all eigenvalues in the half-open interval (VL,VU]
71: *> will be found;
72: *> = 'I': the IL-th through IU-th eigenvalues will be found.
73: *> \endverbatim
74: *>
75: *> \param[in] UPLO
76: *> \verbatim
77: *> UPLO is CHARACTER*1
78: *> = 'U': Upper triangle of A is stored;
79: *> = 'L': Lower triangle of A is stored.
80: *> \endverbatim
81: *>
82: *> \param[in] N
83: *> \verbatim
84: *> N is INTEGER
85: *> The order of the matrix A. N >= 0.
86: *> \endverbatim
87: *>
88: *> \param[in] KD
89: *> \verbatim
90: *> KD is INTEGER
91: *> The number of superdiagonals of the matrix A if UPLO = 'U',
92: *> or the number of subdiagonals if UPLO = 'L'. KD >= 0.
93: *> \endverbatim
94: *>
95: *> \param[in,out] AB
96: *> \verbatim
97: *> AB is COMPLEX*16 array, dimension (LDAB, N)
98: *> On entry, the upper or lower triangle of the Hermitian band
99: *> matrix A, stored in the first KD+1 rows of the array. The
100: *> j-th column of A is stored in the j-th column of the array AB
101: *> as follows:
102: *> if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j;
103: *> if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+kd).
104: *>
105: *> On exit, AB is overwritten by values generated during the
106: *> reduction to tridiagonal form.
107: *> \endverbatim
108: *>
109: *> \param[in] LDAB
110: *> \verbatim
111: *> LDAB is INTEGER
112: *> The leading dimension of the array AB. LDAB >= KD + 1.
113: *> \endverbatim
114: *>
115: *> \param[out] Q
116: *> \verbatim
117: *> Q is COMPLEX*16 array, dimension (LDQ, N)
118: *> If JOBZ = 'V', the N-by-N unitary matrix used in the
119: *> reduction to tridiagonal form.
120: *> If JOBZ = 'N', the array Q is not referenced.
121: *> \endverbatim
122: *>
123: *> \param[in] LDQ
124: *> \verbatim
125: *> LDQ is INTEGER
126: *> The leading dimension of the array Q. If JOBZ = 'V', then
127: *> LDQ >= max(1,N).
128: *> \endverbatim
129: *>
130: *> \param[in] VL
131: *> \verbatim
132: *> VL is DOUBLE PRECISION
133: *> If RANGE='V', the lower bound of the interval to
134: *> be searched for eigenvalues. VL < VU.
135: *> Not referenced if RANGE = 'A' or 'I'.
136: *> \endverbatim
137: *>
138: *> \param[in] VU
139: *> \verbatim
140: *> VU is DOUBLE PRECISION
141: *> If RANGE='V', the upper bound of the interval to
142: *> be searched for eigenvalues. VL < VU.
143: *> Not referenced if RANGE = 'A' or 'I'.
144: *> \endverbatim
145: *>
146: *> \param[in] IL
147: *> \verbatim
148: *> IL is INTEGER
149: *> If RANGE='I', the index of the
150: *> smallest eigenvalue to be returned.
151: *> 1 <= IL <= IU <= N, if N > 0; IL = 1 and IU = 0 if N = 0.
152: *> Not referenced if RANGE = 'A' or 'V'.
153: *> \endverbatim
154: *>
155: *> \param[in] IU
156: *> \verbatim
157: *> IU is INTEGER
158: *> If RANGE='I', the index of the
159: *> largest eigenvalue to be returned.
160: *> 1 <= IL <= IU <= N, if N > 0; IL = 1 and IU = 0 if N = 0.
161: *> Not referenced if RANGE = 'A' or 'V'.
162: *> \endverbatim
163: *>
164: *> \param[in] ABSTOL
165: *> \verbatim
166: *> ABSTOL is DOUBLE PRECISION
167: *> The absolute error tolerance for the eigenvalues.
168: *> An approximate eigenvalue is accepted as converged
169: *> when it is determined to lie in an interval [a,b]
170: *> of width less than or equal to
171: *>
172: *> ABSTOL + EPS * max( |a|,|b| ) ,
173: *>
174: *> where EPS is the machine precision. If ABSTOL is less than
175: *> or equal to zero, then EPS*|T| will be used in its place,
176: *> where |T| is the 1-norm of the tridiagonal matrix obtained
177: *> by reducing AB to tridiagonal form.
178: *>
179: *> Eigenvalues will be computed most accurately when ABSTOL is
180: *> set to twice the underflow threshold 2*DLAMCH('S'), not zero.
181: *> If this routine returns with INFO>0, indicating that some
182: *> eigenvectors did not converge, try setting ABSTOL to
183: *> 2*DLAMCH('S').
184: *>
185: *> See "Computing Small Singular Values of Bidiagonal Matrices
186: *> with Guaranteed High Relative Accuracy," by Demmel and
187: *> Kahan, LAPACK Working Note #3.
188: *> \endverbatim
189: *>
190: *> \param[out] M
191: *> \verbatim
192: *> M is INTEGER
193: *> The total number of eigenvalues found. 0 <= M <= N.
194: *> If RANGE = 'A', M = N, and if RANGE = 'I', M = IU-IL+1.
195: *> \endverbatim
196: *>
197: *> \param[out] W
198: *> \verbatim
199: *> W is DOUBLE PRECISION array, dimension (N)
200: *> The first M elements contain the selected eigenvalues in
201: *> ascending order.
202: *> \endverbatim
203: *>
204: *> \param[out] Z
205: *> \verbatim
206: *> Z is COMPLEX*16 array, dimension (LDZ, max(1,M))
207: *> If JOBZ = 'V', then if INFO = 0, the first M columns of Z
208: *> contain the orthonormal eigenvectors of the matrix A
209: *> corresponding to the selected eigenvalues, with the i-th
210: *> column of Z holding the eigenvector associated with W(i).
211: *> If an eigenvector fails to converge, then that column of Z
212: *> contains the latest approximation to the eigenvector, and the
213: *> index of the eigenvector is returned in IFAIL.
214: *> If JOBZ = 'N', then Z is not referenced.
215: *> Note: the user must ensure that at least max(1,M) columns are
216: *> supplied in the array Z; if RANGE = 'V', the exact value of M
217: *> is not known in advance and an upper bound must be used.
218: *> \endverbatim
219: *>
220: *> \param[in] LDZ
221: *> \verbatim
222: *> LDZ is INTEGER
223: *> The leading dimension of the array Z. LDZ >= 1, and if
224: *> JOBZ = 'V', LDZ >= max(1,N).
225: *> \endverbatim
226: *>
227: *> \param[out] WORK
228: *> \verbatim
229: *> WORK is COMPLEX*16 array, dimension (LWORK)
230: *> \endverbatim
231: *>
232: *> \param[in] LWORK
233: *> \verbatim
234: *> LWORK is INTEGER
235: *> The length of the array WORK. LWORK >= 1, when N <= 1;
236: *> otherwise
237: *> If JOBZ = 'N' and N > 1, LWORK must be queried.
238: *> LWORK = MAX(1, dimension) where
239: *> dimension = (2KD+1)*N + KD*NTHREADS
240: *> where KD is the size of the band.
241: *> NTHREADS is the number of threads used when
242: *> openMP compilation is enabled, otherwise =1.
243: *> If JOBZ = 'V' and N > 1, LWORK must be queried. Not yet available.
244: *>
245: *> If LWORK = -1, then a workspace query is assumed; the routine
246: *> only calculates the optimal sizes of the WORK, RWORK and
247: *> IWORK arrays, returns these values as the first entries of
248: *> the WORK, RWORK and IWORK arrays, and no error message
249: *> related to LWORK or LRWORK or LIWORK is issued by XERBLA.
250: *> \endverbatim
251: *>
252: *> \param[out] RWORK
253: *> \verbatim
254: *> RWORK is DOUBLE PRECISION array, dimension (7*N)
255: *> \endverbatim
256: *>
257: *> \param[out] IWORK
258: *> \verbatim
259: *> IWORK is INTEGER array, dimension (5*N)
260: *> \endverbatim
261: *>
262: *> \param[out] IFAIL
263: *> \verbatim
264: *> IFAIL is INTEGER array, dimension (N)
265: *> If JOBZ = 'V', then if INFO = 0, the first M elements of
266: *> IFAIL are zero. If INFO > 0, then IFAIL contains the
267: *> indices of the eigenvectors that failed to converge.
268: *> If JOBZ = 'N', then IFAIL is not referenced.
269: *> \endverbatim
270: *>
271: *> \param[out] INFO
272: *> \verbatim
273: *> INFO is INTEGER
274: *> = 0: successful exit
275: *> < 0: if INFO = -i, the i-th argument had an illegal value
276: *> > 0: if INFO = i, then i eigenvectors failed to converge.
277: *> Their indices are stored in array IFAIL.
278: *> \endverbatim
279: *
280: * Authors:
281: * ========
282: *
283: *> \author Univ. of Tennessee
284: *> \author Univ. of California Berkeley
285: *> \author Univ. of Colorado Denver
286: *> \author NAG Ltd.
287: *
288: *> \date June 2016
289: *
290: *> \ingroup complex16OTHEReigen
291: *
292: *> \par Further Details:
293: * =====================
294: *>
295: *> \verbatim
296: *>
297: *> All details about the 2stage techniques are available in:
298: *>
299: *> Azzam Haidar, Hatem Ltaief, and Jack Dongarra.
300: *> Parallel reduction to condensed forms for symmetric eigenvalue problems
301: *> using aggregated fine-grained and memory-aware kernels. In Proceedings
302: *> of 2011 International Conference for High Performance Computing,
303: *> Networking, Storage and Analysis (SC '11), New York, NY, USA,
304: *> Article 8 , 11 pages.
305: *> http://doi.acm.org/10.1145/2063384.2063394
306: *>
307: *> A. Haidar, J. Kurzak, P. Luszczek, 2013.
308: *> An improved parallel singular value algorithm and its implementation
309: *> for multicore hardware, In Proceedings of 2013 International Conference
310: *> for High Performance Computing, Networking, Storage and Analysis (SC '13).
311: *> Denver, Colorado, USA, 2013.
312: *> Article 90, 12 pages.
313: *> http://doi.acm.org/10.1145/2503210.2503292
314: *>
315: *> A. Haidar, R. Solca, S. Tomov, T. Schulthess and J. Dongarra.
316: *> A novel hybrid CPU-GPU generalized eigensolver for electronic structure
317: *> calculations based on fine-grained memory aware tasks.
318: *> International Journal of High Performance Computing Applications.
319: *> Volume 28 Issue 2, Pages 196-209, May 2014.
320: *> http://hpc.sagepub.com/content/28/2/196
321: *>
322: *> \endverbatim
323: *
324: * =====================================================================
325: SUBROUTINE ZHBEVX_2STAGE( JOBZ, RANGE, UPLO, N, KD, AB, LDAB,
326: $ Q, LDQ, VL, VU, IL, IU, ABSTOL, M, W,
327: $ Z, LDZ, WORK, LWORK, RWORK, IWORK,
328: $ IFAIL, INFO )
329: *
330: IMPLICIT NONE
331: *
332: * -- LAPACK driver routine (version 3.8.0) --
333: * -- LAPACK is a software package provided by Univ. of Tennessee, --
334: * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
335: * June 2016
336: *
337: * .. Scalar Arguments ..
338: CHARACTER JOBZ, RANGE, UPLO
339: INTEGER IL, INFO, IU, KD, LDAB, LDQ, LDZ, M, N, LWORK
340: DOUBLE PRECISION ABSTOL, VL, VU
341: * ..
342: * .. Array Arguments ..
343: INTEGER IFAIL( * ), IWORK( * )
344: DOUBLE PRECISION RWORK( * ), W( * )
345: COMPLEX*16 AB( LDAB, * ), Q( LDQ, * ), WORK( * ),
346: $ Z( LDZ, * )
347: * ..
348: *
349: * =====================================================================
350: *
351: * .. Parameters ..
352: DOUBLE PRECISION ZERO, ONE
353: PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0 )
354: COMPLEX*16 CZERO, CONE
355: PARAMETER ( CZERO = ( 0.0D0, 0.0D0 ),
356: $ CONE = ( 1.0D0, 0.0D0 ) )
357: * ..
358: * .. Local Scalars ..
359: LOGICAL ALLEIG, INDEIG, LOWER, TEST, VALEIG, WANTZ,
360: $ LQUERY
361: CHARACTER ORDER
362: INTEGER I, IINFO, IMAX, INDD, INDE, INDEE, INDIBL,
363: $ INDISP, INDIWK, INDRWK, INDWRK, ISCALE, ITMP1,
364: $ LLWORK, LWMIN, LHTRD, LWTRD, IB, INDHOUS,
365: $ J, JJ, NSPLIT
366: DOUBLE PRECISION ABSTLL, ANRM, BIGNUM, EPS, RMAX, RMIN, SAFMIN,
367: $ SIGMA, SMLNUM, TMP1, VLL, VUU
368: COMPLEX*16 CTMP1
369: * ..
370: * .. External Functions ..
371: LOGICAL LSAME
372: INTEGER ILAENV2STAGE
373: DOUBLE PRECISION DLAMCH, ZLANHB
374: EXTERNAL LSAME, DLAMCH, ZLANHB, ILAENV2STAGE
375: * ..
376: * .. External Subroutines ..
377: EXTERNAL DCOPY, DSCAL, DSTEBZ, DSTERF, XERBLA, ZCOPY,
378: $ ZGEMV, ZLACPY, ZLASCL, ZSTEIN, ZSTEQR,
379: $ ZSWAP, ZHETRD_HB2ST
380: * ..
381: * .. Intrinsic Functions ..
382: INTRINSIC DBLE, MAX, MIN, SQRT
383: * ..
384: * .. Executable Statements ..
385: *
386: * Test the input parameters.
387: *
388: WANTZ = LSAME( JOBZ, 'V' )
389: ALLEIG = LSAME( RANGE, 'A' )
390: VALEIG = LSAME( RANGE, 'V' )
391: INDEIG = LSAME( RANGE, 'I' )
392: LOWER = LSAME( UPLO, 'L' )
393: LQUERY = ( LWORK.EQ.-1 )
394: *
395: INFO = 0
396: IF( .NOT.( LSAME( JOBZ, 'N' ) ) ) THEN
397: INFO = -1
398: ELSE IF( .NOT.( ALLEIG .OR. VALEIG .OR. INDEIG ) ) THEN
399: INFO = -2
400: ELSE IF( .NOT.( LOWER .OR. LSAME( UPLO, 'U' ) ) ) THEN
401: INFO = -3
402: ELSE IF( N.LT.0 ) THEN
403: INFO = -4
404: ELSE IF( KD.LT.0 ) THEN
405: INFO = -5
406: ELSE IF( LDAB.LT.KD+1 ) THEN
407: INFO = -7
408: ELSE IF( WANTZ .AND. LDQ.LT.MAX( 1, N ) ) THEN
409: INFO = -9
410: ELSE
411: IF( VALEIG ) THEN
412: IF( N.GT.0 .AND. VU.LE.VL )
413: $ INFO = -11
414: ELSE IF( INDEIG ) THEN
415: IF( IL.LT.1 .OR. IL.GT.MAX( 1, N ) ) THEN
416: INFO = -12
417: ELSE IF( IU.LT.MIN( N, IL ) .OR. IU.GT.N ) THEN
418: INFO = -13
419: END IF
420: END IF
421: END IF
422: IF( INFO.EQ.0 ) THEN
423: IF( LDZ.LT.1 .OR. ( WANTZ .AND. LDZ.LT.N ) )
424: $ INFO = -18
425: END IF
426: *
427: IF( INFO.EQ.0 ) THEN
428: IF( N.LE.1 ) THEN
429: LWMIN = 1
430: WORK( 1 ) = LWMIN
431: ELSE
432: IB = ILAENV2STAGE( 2, 'ZHETRD_HB2ST', JOBZ,
433: $ N, KD, -1, -1 )
434: LHTRD = ILAENV2STAGE( 3, 'ZHETRD_HB2ST', JOBZ,
435: $ N, KD, IB, -1 )
436: LWTRD = ILAENV2STAGE( 4, 'ZHETRD_HB2ST', JOBZ,
437: $ N, KD, IB, -1 )
438: LWMIN = LHTRD + LWTRD
439: WORK( 1 ) = LWMIN
440: ENDIF
441: *
442: IF( LWORK.LT.LWMIN .AND. .NOT.LQUERY )
443: $ INFO = -20
444: END IF
445: *
446: IF( INFO.NE.0 ) THEN
447: CALL XERBLA( 'ZHBEVX_2STAGE', -INFO )
448: RETURN
449: ELSE IF( LQUERY ) THEN
450: RETURN
451: END IF
452: *
453: * Quick return if possible
454: *
455: M = 0
456: IF( N.EQ.0 )
457: $ RETURN
458: *
459: IF( N.EQ.1 ) THEN
460: M = 1
461: IF( LOWER ) THEN
462: CTMP1 = AB( 1, 1 )
463: ELSE
464: CTMP1 = AB( KD+1, 1 )
465: END IF
466: TMP1 = DBLE( CTMP1 )
467: IF( VALEIG ) THEN
468: IF( .NOT.( VL.LT.TMP1 .AND. VU.GE.TMP1 ) )
469: $ M = 0
470: END IF
471: IF( M.EQ.1 ) THEN
472: W( 1 ) = DBLE( CTMP1 )
473: IF( WANTZ )
474: $ Z( 1, 1 ) = CONE
475: END IF
476: RETURN
477: END IF
478: *
479: * Get machine constants.
480: *
481: SAFMIN = DLAMCH( 'Safe minimum' )
482: EPS = DLAMCH( 'Precision' )
483: SMLNUM = SAFMIN / EPS
484: BIGNUM = ONE / SMLNUM
485: RMIN = SQRT( SMLNUM )
486: RMAX = MIN( SQRT( BIGNUM ), ONE / SQRT( SQRT( SAFMIN ) ) )
487: *
488: * Scale matrix to allowable range, if necessary.
489: *
490: ISCALE = 0
491: ABSTLL = ABSTOL
492: IF( VALEIG ) THEN
493: VLL = VL
494: VUU = VU
495: ELSE
496: VLL = ZERO
497: VUU = ZERO
498: END IF
499: ANRM = ZLANHB( 'M', UPLO, N, KD, AB, LDAB, RWORK )
500: IF( ANRM.GT.ZERO .AND. ANRM.LT.RMIN ) THEN
501: ISCALE = 1
502: SIGMA = RMIN / ANRM
503: ELSE IF( ANRM.GT.RMAX ) THEN
504: ISCALE = 1
505: SIGMA = RMAX / ANRM
506: END IF
507: IF( ISCALE.EQ.1 ) THEN
508: IF( LOWER ) THEN
509: CALL ZLASCL( 'B', KD, KD, ONE, SIGMA, N, N, AB, LDAB, INFO )
510: ELSE
511: CALL ZLASCL( 'Q', KD, KD, ONE, SIGMA, N, N, AB, LDAB, INFO )
512: END IF
513: IF( ABSTOL.GT.0 )
514: $ ABSTLL = ABSTOL*SIGMA
515: IF( VALEIG ) THEN
516: VLL = VL*SIGMA
517: VUU = VU*SIGMA
518: END IF
519: END IF
520: *
521: * Call ZHBTRD_HB2ST to reduce Hermitian band matrix to tridiagonal form.
522: *
523: INDD = 1
524: INDE = INDD + N
525: INDRWK = INDE + N
526: *
527: INDHOUS = 1
528: INDWRK = INDHOUS + LHTRD
529: LLWORK = LWORK - INDWRK + 1
530: *
531: CALL ZHETRD_HB2ST( 'N', JOBZ, UPLO, N, KD, AB, LDAB,
532: $ RWORK( INDD ), RWORK( INDE ), WORK( INDHOUS ),
533: $ LHTRD, WORK( INDWRK ), LLWORK, IINFO )
534: *
535: * If all eigenvalues are desired and ABSTOL is less than or equal
536: * to zero, then call DSTERF or ZSTEQR. If this fails for some
537: * eigenvalue, then try DSTEBZ.
538: *
539: TEST = .FALSE.
540: IF (INDEIG) THEN
541: IF (IL.EQ.1 .AND. IU.EQ.N) THEN
542: TEST = .TRUE.
543: END IF
544: END IF
545: IF ((ALLEIG .OR. TEST) .AND. (ABSTOL.LE.ZERO)) THEN
546: CALL DCOPY( N, RWORK( INDD ), 1, W, 1 )
547: INDEE = INDRWK + 2*N
548: IF( .NOT.WANTZ ) THEN
549: CALL DCOPY( N-1, RWORK( INDE ), 1, RWORK( INDEE ), 1 )
550: CALL DSTERF( N, W, RWORK( INDEE ), INFO )
551: ELSE
552: CALL ZLACPY( 'A', N, N, Q, LDQ, Z, LDZ )
553: CALL DCOPY( N-1, RWORK( INDE ), 1, RWORK( INDEE ), 1 )
554: CALL ZSTEQR( JOBZ, N, W, RWORK( INDEE ), Z, LDZ,
555: $ RWORK( INDRWK ), INFO )
556: IF( INFO.EQ.0 ) THEN
557: DO 10 I = 1, N
558: IFAIL( I ) = 0
559: 10 CONTINUE
560: END IF
561: END IF
562: IF( INFO.EQ.0 ) THEN
563: M = N
564: GO TO 30
565: END IF
566: INFO = 0
567: END IF
568: *
569: * Otherwise, call DSTEBZ and, if eigenvectors are desired, ZSTEIN.
570: *
571: IF( WANTZ ) THEN
572: ORDER = 'B'
573: ELSE
574: ORDER = 'E'
575: END IF
576: INDIBL = 1
577: INDISP = INDIBL + N
578: INDIWK = INDISP + N
579: CALL DSTEBZ( RANGE, ORDER, N, VLL, VUU, IL, IU, ABSTLL,
580: $ RWORK( INDD ), RWORK( INDE ), M, NSPLIT, W,
581: $ IWORK( INDIBL ), IWORK( INDISP ), RWORK( INDRWK ),
582: $ IWORK( INDIWK ), INFO )
583: *
584: IF( WANTZ ) THEN
585: CALL ZSTEIN( N, RWORK( INDD ), RWORK( INDE ), M, W,
586: $ IWORK( INDIBL ), IWORK( INDISP ), Z, LDZ,
587: $ RWORK( INDRWK ), IWORK( INDIWK ), IFAIL, INFO )
588: *
589: * Apply unitary matrix used in reduction to tridiagonal
590: * form to eigenvectors returned by ZSTEIN.
591: *
592: DO 20 J = 1, M
593: CALL ZCOPY( N, Z( 1, J ), 1, WORK( 1 ), 1 )
594: CALL ZGEMV( 'N', N, N, CONE, Q, LDQ, WORK, 1, CZERO,
595: $ Z( 1, J ), 1 )
596: 20 CONTINUE
597: END IF
598: *
599: * If matrix was scaled, then rescale eigenvalues appropriately.
600: *
601: 30 CONTINUE
602: IF( ISCALE.EQ.1 ) THEN
603: IF( INFO.EQ.0 ) THEN
604: IMAX = M
605: ELSE
606: IMAX = INFO - 1
607: END IF
608: CALL DSCAL( IMAX, ONE / SIGMA, W, 1 )
609: END IF
610: *
611: * If eigenvalues are not in order, then sort them, along with
612: * eigenvectors.
613: *
614: IF( WANTZ ) THEN
615: DO 50 J = 1, M - 1
616: I = 0
617: TMP1 = W( J )
618: DO 40 JJ = J + 1, M
619: IF( W( JJ ).LT.TMP1 ) THEN
620: I = JJ
621: TMP1 = W( JJ )
622: END IF
623: 40 CONTINUE
624: *
625: IF( I.NE.0 ) THEN
626: ITMP1 = IWORK( INDIBL+I-1 )
627: W( I ) = W( J )
628: IWORK( INDIBL+I-1 ) = IWORK( INDIBL+J-1 )
629: W( J ) = TMP1
630: IWORK( INDIBL+J-1 ) = ITMP1
631: CALL ZSWAP( N, Z( 1, I ), 1, Z( 1, J ), 1 )
632: IF( INFO.NE.0 ) THEN
633: ITMP1 = IFAIL( I )
634: IFAIL( I ) = IFAIL( J )
635: IFAIL( J ) = ITMP1
636: END IF
637: END IF
638: 50 CONTINUE
639: END IF
640: *
641: * Set WORK(1) to optimal workspace size.
642: *
643: WORK( 1 ) = LWMIN
644: *
645: RETURN
646: *
647: * End of ZHBEVX_2STAGE
648: *
649: END
CVSweb interface <joel.bertrand@systella.fr>