Annotation of rpl/lapack/lapack/zheevx.f, revision 1.13

1.9       bertrand    1: *> \brief <b> ZHEEVX 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: *> \htmlonly
                      9: *> Download ZHEEVX + dependencies 
                     10: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zheevx.f"> 
                     11: *> [TGZ]</a> 
                     12: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zheevx.f"> 
                     13: *> [ZIP]</a> 
                     14: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zheevx.f"> 
                     15: *> [TXT]</a>
                     16: *> \endhtmlonly 
                     17: *
                     18: *  Definition:
                     19: *  ===========
                     20: *
                     21: *       SUBROUTINE ZHEEVX( JOBZ, RANGE, UPLO, N, A, LDA, VL, VU, IL, IU,
                     22: *                          ABSTOL, M, W, Z, LDZ, WORK, LWORK, RWORK,
                     23: *                          IWORK, IFAIL, INFO )
                     24: * 
                     25: *       .. Scalar Arguments ..
                     26: *       CHARACTER          JOBZ, RANGE, UPLO
                     27: *       INTEGER            IL, INFO, IU, LDA, LDZ, LWORK, M, N
                     28: *       DOUBLE PRECISION   ABSTOL, VL, VU
                     29: *       ..
                     30: *       .. Array Arguments ..
                     31: *       INTEGER            IFAIL( * ), IWORK( * )
                     32: *       DOUBLE PRECISION   RWORK( * ), W( * )
                     33: *       COMPLEX*16         A( LDA, * ), WORK( * ), Z( LDZ, * )
                     34: *       ..
                     35: *  
                     36: *
                     37: *> \par Purpose:
                     38: *  =============
                     39: *>
                     40: *> \verbatim
                     41: *>
                     42: *> ZHEEVX computes selected eigenvalues and, optionally, eigenvectors
                     43: *> of a complex Hermitian matrix A.  Eigenvalues and eigenvectors can
                     44: *> be selected by specifying either a range of values or a range of
                     45: *> indices for the desired eigenvalues.
                     46: *> \endverbatim
                     47: *
                     48: *  Arguments:
                     49: *  ==========
                     50: *
                     51: *> \param[in] JOBZ
                     52: *> \verbatim
                     53: *>          JOBZ is CHARACTER*1
                     54: *>          = 'N':  Compute eigenvalues only;
                     55: *>          = 'V':  Compute eigenvalues and eigenvectors.
                     56: *> \endverbatim
                     57: *>
                     58: *> \param[in] RANGE
                     59: *> \verbatim
                     60: *>          RANGE is CHARACTER*1
                     61: *>          = 'A': all eigenvalues will be found.
                     62: *>          = 'V': all eigenvalues in the half-open interval (VL,VU]
                     63: *>                 will be found.
                     64: *>          = 'I': the IL-th through IU-th eigenvalues will be found.
                     65: *> \endverbatim
                     66: *>
                     67: *> \param[in] UPLO
                     68: *> \verbatim
                     69: *>          UPLO is CHARACTER*1
                     70: *>          = 'U':  Upper triangle of A is stored;
                     71: *>          = 'L':  Lower triangle of A is stored.
                     72: *> \endverbatim
                     73: *>
                     74: *> \param[in] N
                     75: *> \verbatim
                     76: *>          N is INTEGER
                     77: *>          The order of the matrix A.  N >= 0.
                     78: *> \endverbatim
                     79: *>
                     80: *> \param[in,out] A
                     81: *> \verbatim
                     82: *>          A is COMPLEX*16 array, dimension (LDA, N)
                     83: *>          On entry, the Hermitian matrix A.  If UPLO = 'U', the
                     84: *>          leading N-by-N upper triangular part of A contains the
                     85: *>          upper triangular part of the matrix A.  If UPLO = 'L',
                     86: *>          the leading N-by-N lower triangular part of A contains
                     87: *>          the lower triangular part of the matrix A.
                     88: *>          On exit, the lower triangle (if UPLO='L') or the upper
                     89: *>          triangle (if UPLO='U') of A, including the diagonal, is
                     90: *>          destroyed.
                     91: *> \endverbatim
                     92: *>
                     93: *> \param[in] LDA
                     94: *> \verbatim
                     95: *>          LDA is INTEGER
                     96: *>          The leading dimension of the array A.  LDA >= max(1,N).
                     97: *> \endverbatim
                     98: *>
                     99: *> \param[in] VL
                    100: *> \verbatim
                    101: *>          VL is DOUBLE PRECISION
                    102: *> \endverbatim
                    103: *>
                    104: *> \param[in] VU
                    105: *> \verbatim
                    106: *>          VU is DOUBLE PRECISION
                    107: *>          If RANGE='V', the lower and upper bounds of the interval to
                    108: *>          be searched for eigenvalues. VL < VU.
                    109: *>          Not referenced if RANGE = 'A' or 'I'.
                    110: *> \endverbatim
                    111: *>
                    112: *> \param[in] IL
                    113: *> \verbatim
                    114: *>          IL is INTEGER
                    115: *> \endverbatim
                    116: *>
                    117: *> \param[in] IU
                    118: *> \verbatim
                    119: *>          IU is INTEGER
                    120: *>          If RANGE='I', the indices (in ascending order) of the
                    121: *>          smallest and largest eigenvalues to be returned.
                    122: *>          1 <= IL <= IU <= N, if N > 0; IL = 1 and IU = 0 if N = 0.
                    123: *>          Not referenced if RANGE = 'A' or 'V'.
                    124: *> \endverbatim
                    125: *>
                    126: *> \param[in] ABSTOL
                    127: *> \verbatim
                    128: *>          ABSTOL is DOUBLE PRECISION
                    129: *>          The absolute error tolerance for the eigenvalues.
                    130: *>          An approximate eigenvalue is accepted as converged
                    131: *>          when it is determined to lie in an interval [a,b]
                    132: *>          of width less than or equal to
                    133: *>
                    134: *>                  ABSTOL + EPS *   max( |a|,|b| ) ,
                    135: *>
                    136: *>          where EPS is the machine precision.  If ABSTOL is less than
                    137: *>          or equal to zero, then  EPS*|T|  will be used in its place,
                    138: *>          where |T| is the 1-norm of the tridiagonal matrix obtained
                    139: *>          by reducing A to tridiagonal form.
                    140: *>
                    141: *>          Eigenvalues will be computed most accurately when ABSTOL is
                    142: *>          set to twice the underflow threshold 2*DLAMCH('S'), not zero.
                    143: *>          If this routine returns with INFO>0, indicating that some
                    144: *>          eigenvectors did not converge, try setting ABSTOL to
                    145: *>          2*DLAMCH('S').
                    146: *>
                    147: *>          See "Computing Small Singular Values of Bidiagonal Matrices
                    148: *>          with Guaranteed High Relative Accuracy," by Demmel and
                    149: *>          Kahan, LAPACK Working Note #3.
                    150: *> \endverbatim
                    151: *>
                    152: *> \param[out] M
                    153: *> \verbatim
                    154: *>          M is INTEGER
                    155: *>          The total number of eigenvalues found.  0 <= M <= N.
                    156: *>          If RANGE = 'A', M = N, and if RANGE = 'I', M = IU-IL+1.
                    157: *> \endverbatim
                    158: *>
                    159: *> \param[out] W
                    160: *> \verbatim
                    161: *>          W is DOUBLE PRECISION array, dimension (N)
                    162: *>          On normal exit, the first M elements contain the selected
                    163: *>          eigenvalues in ascending order.
                    164: *> \endverbatim
                    165: *>
                    166: *> \param[out] Z
                    167: *> \verbatim
                    168: *>          Z is COMPLEX*16 array, dimension (LDZ, max(1,M))
                    169: *>          If JOBZ = 'V', then if INFO = 0, the first M columns of Z
                    170: *>          contain the orthonormal eigenvectors of the matrix A
                    171: *>          corresponding to the selected eigenvalues, with the i-th
                    172: *>          column of Z holding the eigenvector associated with W(i).
                    173: *>          If an eigenvector fails to converge, then that column of Z
                    174: *>          contains the latest approximation to the eigenvector, and the
                    175: *>          index of the eigenvector is returned in IFAIL.
                    176: *>          If JOBZ = 'N', then Z is not referenced.
                    177: *>          Note: the user must ensure that at least max(1,M) columns are
                    178: *>          supplied in the array Z; if RANGE = 'V', the exact value of M
                    179: *>          is not known in advance and an upper bound must be used.
                    180: *> \endverbatim
                    181: *>
                    182: *> \param[in] LDZ
                    183: *> \verbatim
                    184: *>          LDZ is INTEGER
                    185: *>          The leading dimension of the array Z.  LDZ >= 1, and if
                    186: *>          JOBZ = 'V', LDZ >= max(1,N).
                    187: *> \endverbatim
                    188: *>
                    189: *> \param[out] WORK
                    190: *> \verbatim
                    191: *>          WORK is COMPLEX*16 array, dimension (MAX(1,LWORK))
                    192: *>          On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
                    193: *> \endverbatim
                    194: *>
                    195: *> \param[in] LWORK
                    196: *> \verbatim
                    197: *>          LWORK is INTEGER
                    198: *>          The length of the array WORK.  LWORK >= 1, when N <= 1;
                    199: *>          otherwise 2*N.
                    200: *>          For optimal efficiency, LWORK >= (NB+1)*N,
                    201: *>          where NB is the max of the blocksize for ZHETRD and for
                    202: *>          ZUNMTR as returned by ILAENV.
                    203: *>
                    204: *>          If LWORK = -1, then a workspace query is assumed; the routine
                    205: *>          only calculates the optimal size of the WORK array, returns
                    206: *>          this value as the first entry of the WORK array, and no error
                    207: *>          message related to LWORK is issued by XERBLA.
                    208: *> \endverbatim
                    209: *>
                    210: *> \param[out] RWORK
                    211: *> \verbatim
                    212: *>          RWORK is DOUBLE PRECISION array, dimension (7*N)
                    213: *> \endverbatim
                    214: *>
                    215: *> \param[out] IWORK
                    216: *> \verbatim
                    217: *>          IWORK is INTEGER array, dimension (5*N)
                    218: *> \endverbatim
                    219: *>
                    220: *> \param[out] IFAIL
                    221: *> \verbatim
                    222: *>          IFAIL is INTEGER array, dimension (N)
                    223: *>          If JOBZ = 'V', then if INFO = 0, the first M elements of
                    224: *>          IFAIL are zero.  If INFO > 0, then IFAIL contains the
                    225: *>          indices of the eigenvectors that failed to converge.
                    226: *>          If JOBZ = 'N', then IFAIL is not referenced.
                    227: *> \endverbatim
                    228: *>
                    229: *> \param[out] INFO
                    230: *> \verbatim
                    231: *>          INFO is INTEGER
                    232: *>          = 0:  successful exit
                    233: *>          < 0:  if INFO = -i, the i-th argument had an illegal value
                    234: *>          > 0:  if INFO = i, then i eigenvectors failed to converge.
                    235: *>                Their indices are stored in array IFAIL.
                    236: *> \endverbatim
                    237: *
                    238: *  Authors:
                    239: *  ========
                    240: *
                    241: *> \author Univ. of Tennessee 
                    242: *> \author Univ. of California Berkeley 
                    243: *> \author Univ. of Colorado Denver 
                    244: *> \author NAG Ltd. 
                    245: *
                    246: *> \date November 2011
                    247: *
                    248: *> \ingroup complex16HEeigen
                    249: *
                    250: *  =====================================================================
1.1       bertrand  251:       SUBROUTINE ZHEEVX( JOBZ, RANGE, UPLO, N, A, LDA, VL, VU, IL, IU,
                    252:      $                   ABSTOL, M, W, Z, LDZ, WORK, LWORK, RWORK,
                    253:      $                   IWORK, IFAIL, INFO )
                    254: *
1.9       bertrand  255: *  -- LAPACK driver routine (version 3.4.0) --
1.1       bertrand  256: *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
                    257: *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
1.9       bertrand  258: *     November 2011
1.1       bertrand  259: *
                    260: *     .. Scalar Arguments ..
                    261:       CHARACTER          JOBZ, RANGE, UPLO
                    262:       INTEGER            IL, INFO, IU, LDA, LDZ, LWORK, M, N
                    263:       DOUBLE PRECISION   ABSTOL, VL, VU
                    264: *     ..
                    265: *     .. Array Arguments ..
                    266:       INTEGER            IFAIL( * ), IWORK( * )
                    267:       DOUBLE PRECISION   RWORK( * ), W( * )
                    268:       COMPLEX*16         A( LDA, * ), WORK( * ), Z( LDZ, * )
                    269: *     ..
                    270: *
                    271: *  =====================================================================
                    272: *
                    273: *     .. Parameters ..
                    274:       DOUBLE PRECISION   ZERO, ONE
                    275:       PARAMETER          ( ZERO = 0.0D+0, ONE = 1.0D+0 )
                    276:       COMPLEX*16         CONE
                    277:       PARAMETER          ( CONE = ( 1.0D+0, 0.0D+0 ) )
                    278: *     ..
                    279: *     .. Local Scalars ..
                    280:       LOGICAL            ALLEIG, INDEIG, LOWER, LQUERY, TEST, VALEIG,
                    281:      $                   WANTZ
                    282:       CHARACTER          ORDER
                    283:       INTEGER            I, IINFO, IMAX, INDD, INDE, INDEE, INDIBL,
                    284:      $                   INDISP, INDIWK, INDRWK, INDTAU, INDWRK, ISCALE,
                    285:      $                   ITMP1, J, JJ, LLWORK, LWKMIN, LWKOPT, NB,
                    286:      $                   NSPLIT
                    287:       DOUBLE PRECISION   ABSTLL, ANRM, BIGNUM, EPS, RMAX, RMIN, SAFMIN,
                    288:      $                   SIGMA, SMLNUM, TMP1, VLL, VUU
                    289: *     ..
                    290: *     .. External Functions ..
                    291:       LOGICAL            LSAME
                    292:       INTEGER            ILAENV
                    293:       DOUBLE PRECISION   DLAMCH, ZLANHE
                    294:       EXTERNAL           LSAME, ILAENV, DLAMCH, ZLANHE
                    295: *     ..
                    296: *     .. External Subroutines ..
                    297:       EXTERNAL           DCOPY, DSCAL, DSTEBZ, DSTERF, XERBLA, ZDSCAL,
                    298:      $                   ZHETRD, ZLACPY, ZSTEIN, ZSTEQR, ZSWAP, ZUNGTR,
                    299:      $                   ZUNMTR
                    300: *     ..
                    301: *     .. Intrinsic Functions ..
                    302:       INTRINSIC          DBLE, MAX, MIN, SQRT
                    303: *     ..
                    304: *     .. Executable Statements ..
                    305: *
                    306: *     Test the input parameters.
                    307: *
                    308:       LOWER = LSAME( UPLO, 'L' )
                    309:       WANTZ = LSAME( JOBZ, 'V' )
                    310:       ALLEIG = LSAME( RANGE, 'A' )
                    311:       VALEIG = LSAME( RANGE, 'V' )
                    312:       INDEIG = LSAME( RANGE, 'I' )
                    313:       LQUERY = ( LWORK.EQ.-1 )
                    314: *
                    315:       INFO = 0
                    316:       IF( .NOT.( WANTZ .OR. LSAME( JOBZ, 'N' ) ) ) THEN
                    317:          INFO = -1
                    318:       ELSE IF( .NOT.( ALLEIG .OR. VALEIG .OR. INDEIG ) ) THEN
                    319:          INFO = -2
                    320:       ELSE IF( .NOT.( LOWER .OR. LSAME( UPLO, 'U' ) ) ) THEN
                    321:          INFO = -3
                    322:       ELSE IF( N.LT.0 ) THEN
                    323:          INFO = -4
                    324:       ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
                    325:          INFO = -6
                    326:       ELSE
                    327:          IF( VALEIG ) THEN
                    328:             IF( N.GT.0 .AND. VU.LE.VL )
                    329:      $         INFO = -8
                    330:          ELSE IF( INDEIG ) THEN
                    331:             IF( IL.LT.1 .OR. IL.GT.MAX( 1, N ) ) THEN
                    332:                INFO = -9
                    333:             ELSE IF( IU.LT.MIN( N, IL ) .OR. IU.GT.N ) THEN
                    334:                INFO = -10
                    335:             END IF
                    336:          END IF
                    337:       END IF
                    338:       IF( INFO.EQ.0 ) THEN
                    339:          IF( LDZ.LT.1 .OR. ( WANTZ .AND. LDZ.LT.N ) ) THEN
                    340:             INFO = -15
                    341:          END IF
                    342:       END IF
                    343: *
                    344:       IF( INFO.EQ.0 ) THEN
                    345:          IF( N.LE.1 ) THEN
                    346:             LWKMIN = 1
                    347:             WORK( 1 ) = LWKMIN
                    348:          ELSE
                    349:             LWKMIN = 2*N
                    350:             NB = ILAENV( 1, 'ZHETRD', UPLO, N, -1, -1, -1 )
                    351:             NB = MAX( NB, ILAENV( 1, 'ZUNMTR', UPLO, N, -1, -1, -1 ) )
                    352:             LWKOPT = MAX( 1, ( NB + 1 )*N )
                    353:             WORK( 1 ) = LWKOPT
                    354:          END IF
                    355: *
1.8       bertrand  356:          IF( LWORK.LT.LWKMIN .AND. .NOT.LQUERY )
1.1       bertrand  357:      $      INFO = -17
                    358:       END IF
                    359: *
                    360:       IF( INFO.NE.0 ) THEN
                    361:          CALL XERBLA( 'ZHEEVX', -INFO )
                    362:          RETURN
                    363:       ELSE IF( LQUERY ) THEN
                    364:          RETURN
                    365:       END IF
                    366: *
                    367: *     Quick return if possible
                    368: *
                    369:       M = 0
                    370:       IF( N.EQ.0 ) THEN
                    371:          RETURN
                    372:       END IF
                    373: *
                    374:       IF( N.EQ.1 ) THEN
                    375:          IF( ALLEIG .OR. INDEIG ) THEN
                    376:             M = 1
                    377:             W( 1 ) = A( 1, 1 )
                    378:          ELSE IF( VALEIG ) THEN
                    379:             IF( VL.LT.DBLE( A( 1, 1 ) ) .AND. VU.GE.DBLE( A( 1, 1 ) ) )
                    380:      $           THEN
                    381:                M = 1
                    382:                W( 1 ) = A( 1, 1 )
                    383:             END IF
                    384:          END IF
                    385:          IF( WANTZ )
                    386:      $      Z( 1, 1 ) = CONE
                    387:          RETURN
                    388:       END IF
                    389: *
                    390: *     Get machine constants.
                    391: *
                    392:       SAFMIN = DLAMCH( 'Safe minimum' )
                    393:       EPS = DLAMCH( 'Precision' )
                    394:       SMLNUM = SAFMIN / EPS
                    395:       BIGNUM = ONE / SMLNUM
                    396:       RMIN = SQRT( SMLNUM )
                    397:       RMAX = MIN( SQRT( BIGNUM ), ONE / SQRT( SQRT( SAFMIN ) ) )
                    398: *
                    399: *     Scale matrix to allowable range, if necessary.
                    400: *
                    401:       ISCALE = 0
                    402:       ABSTLL = ABSTOL
                    403:       IF( VALEIG ) THEN
                    404:          VLL = VL
                    405:          VUU = VU
                    406:       END IF
                    407:       ANRM = ZLANHE( 'M', UPLO, N, A, LDA, RWORK )
                    408:       IF( ANRM.GT.ZERO .AND. ANRM.LT.RMIN ) THEN
                    409:          ISCALE = 1
                    410:          SIGMA = RMIN / ANRM
                    411:       ELSE IF( ANRM.GT.RMAX ) THEN
                    412:          ISCALE = 1
                    413:          SIGMA = RMAX / ANRM
                    414:       END IF
                    415:       IF( ISCALE.EQ.1 ) THEN
                    416:          IF( LOWER ) THEN
                    417:             DO 10 J = 1, N
                    418:                CALL ZDSCAL( N-J+1, SIGMA, A( J, J ), 1 )
                    419:    10       CONTINUE
                    420:          ELSE
                    421:             DO 20 J = 1, N
                    422:                CALL ZDSCAL( J, SIGMA, A( 1, J ), 1 )
                    423:    20       CONTINUE
                    424:          END IF
                    425:          IF( ABSTOL.GT.0 )
                    426:      $      ABSTLL = ABSTOL*SIGMA
                    427:          IF( VALEIG ) THEN
                    428:             VLL = VL*SIGMA
                    429:             VUU = VU*SIGMA
                    430:          END IF
                    431:       END IF
                    432: *
                    433: *     Call ZHETRD to reduce Hermitian matrix to tridiagonal form.
                    434: *
                    435:       INDD = 1
                    436:       INDE = INDD + N
                    437:       INDRWK = INDE + N
                    438:       INDTAU = 1
                    439:       INDWRK = INDTAU + N
                    440:       LLWORK = LWORK - INDWRK + 1
                    441:       CALL ZHETRD( UPLO, N, A, LDA, RWORK( INDD ), RWORK( INDE ),
                    442:      $             WORK( INDTAU ), WORK( INDWRK ), LLWORK, IINFO )
                    443: *
                    444: *     If all eigenvalues are desired and ABSTOL is less than or equal to
                    445: *     zero, then call DSTERF or ZUNGTR and ZSTEQR.  If this fails for
                    446: *     some eigenvalue, then try DSTEBZ.
                    447: *
                    448:       TEST = .FALSE.
                    449:       IF( INDEIG ) THEN
                    450:          IF( IL.EQ.1 .AND. IU.EQ.N ) THEN
                    451:             TEST = .TRUE.
                    452:          END IF
                    453:       END IF
                    454:       IF( ( ALLEIG .OR. TEST ) .AND. ( ABSTOL.LE.ZERO ) ) THEN
                    455:          CALL DCOPY( N, RWORK( INDD ), 1, W, 1 )
                    456:          INDEE = INDRWK + 2*N
                    457:          IF( .NOT.WANTZ ) THEN
                    458:             CALL DCOPY( N-1, RWORK( INDE ), 1, RWORK( INDEE ), 1 )
                    459:             CALL DSTERF( N, W, RWORK( INDEE ), INFO )
                    460:          ELSE
                    461:             CALL ZLACPY( 'A', N, N, A, LDA, Z, LDZ )
                    462:             CALL ZUNGTR( UPLO, N, Z, LDZ, WORK( INDTAU ),
                    463:      $                   WORK( INDWRK ), LLWORK, IINFO )
                    464:             CALL DCOPY( N-1, RWORK( INDE ), 1, RWORK( INDEE ), 1 )
                    465:             CALL ZSTEQR( JOBZ, N, W, RWORK( INDEE ), Z, LDZ,
                    466:      $                   RWORK( INDRWK ), INFO )
                    467:             IF( INFO.EQ.0 ) THEN
                    468:                DO 30 I = 1, N
                    469:                   IFAIL( I ) = 0
                    470:    30          CONTINUE
                    471:             END IF
                    472:          END IF
                    473:          IF( INFO.EQ.0 ) THEN
                    474:             M = N
                    475:             GO TO 40
                    476:          END IF
                    477:          INFO = 0
                    478:       END IF
                    479: *
                    480: *     Otherwise, call DSTEBZ and, if eigenvectors are desired, ZSTEIN.
                    481: *
                    482:       IF( WANTZ ) THEN
                    483:          ORDER = 'B'
                    484:       ELSE
                    485:          ORDER = 'E'
                    486:       END IF
                    487:       INDIBL = 1
                    488:       INDISP = INDIBL + N
                    489:       INDIWK = INDISP + N
                    490:       CALL DSTEBZ( RANGE, ORDER, N, VLL, VUU, IL, IU, ABSTLL,
                    491:      $             RWORK( INDD ), RWORK( INDE ), M, NSPLIT, W,
                    492:      $             IWORK( INDIBL ), IWORK( INDISP ), RWORK( INDRWK ),
                    493:      $             IWORK( INDIWK ), INFO )
                    494: *
                    495:       IF( WANTZ ) THEN
                    496:          CALL ZSTEIN( N, RWORK( INDD ), RWORK( INDE ), M, W,
                    497:      $                IWORK( INDIBL ), IWORK( INDISP ), Z, LDZ,
                    498:      $                RWORK( INDRWK ), IWORK( INDIWK ), IFAIL, INFO )
                    499: *
                    500: *        Apply unitary matrix used in reduction to tridiagonal
                    501: *        form to eigenvectors returned by ZSTEIN.
                    502: *
                    503:          CALL ZUNMTR( 'L', UPLO, 'N', N, M, A, LDA, WORK( INDTAU ), Z,
                    504:      $                LDZ, WORK( INDWRK ), LLWORK, IINFO )
                    505:       END IF
                    506: *
                    507: *     If matrix was scaled, then rescale eigenvalues appropriately.
                    508: *
                    509:    40 CONTINUE
                    510:       IF( ISCALE.EQ.1 ) THEN
                    511:          IF( INFO.EQ.0 ) THEN
                    512:             IMAX = M
                    513:          ELSE
                    514:             IMAX = INFO - 1
                    515:          END IF
                    516:          CALL DSCAL( IMAX, ONE / SIGMA, W, 1 )
                    517:       END IF
                    518: *
                    519: *     If eigenvalues are not in order, then sort them, along with
                    520: *     eigenvectors.
                    521: *
                    522:       IF( WANTZ ) THEN
                    523:          DO 60 J = 1, M - 1
                    524:             I = 0
                    525:             TMP1 = W( J )
                    526:             DO 50 JJ = J + 1, M
                    527:                IF( W( JJ ).LT.TMP1 ) THEN
                    528:                   I = JJ
                    529:                   TMP1 = W( JJ )
                    530:                END IF
                    531:    50       CONTINUE
                    532: *
                    533:             IF( I.NE.0 ) THEN
                    534:                ITMP1 = IWORK( INDIBL+I-1 )
                    535:                W( I ) = W( J )
                    536:                IWORK( INDIBL+I-1 ) = IWORK( INDIBL+J-1 )
                    537:                W( J ) = TMP1
                    538:                IWORK( INDIBL+J-1 ) = ITMP1
                    539:                CALL ZSWAP( N, Z( 1, I ), 1, Z( 1, J ), 1 )
                    540:                IF( INFO.NE.0 ) THEN
                    541:                   ITMP1 = IFAIL( I )
                    542:                   IFAIL( I ) = IFAIL( J )
                    543:                   IFAIL( J ) = ITMP1
                    544:                END IF
                    545:             END IF
                    546:    60    CONTINUE
                    547:       END IF
                    548: *
                    549: *     Set WORK(1) to optimal complex workspace size.
                    550: *
                    551:       WORK( 1 ) = LWKOPT
                    552: *
                    553:       RETURN
                    554: *
                    555: *     End of ZHEEVX
                    556: *
                    557:       END

CVSweb interface <joel.bertrand@systella.fr>