diff --git a/lapack-netlib/SRC/clarrv.f b/lapack-netlib/SRC/clarrv.f index d2a03fd241..ed9ae14fba 100644 --- a/lapack-netlib/SRC/clarrv.f +++ b/lapack-netlib/SRC/clarrv.f @@ -5,7 +5,6 @@ * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * -*> \htmlonly *> Download CLARRV + dependencies *> *> [TGZ] @@ -13,7 +12,6 @@ *> [ZIP] *> *> [TXT] -*> \endhtmlonly * * Definition: * =========== @@ -266,7 +264,7 @@ *> \author Univ. of Colorado Denver *> \author NAG Ltd. * -*> \ingroup complexOTHERauxiliary +*> \ingroup larrv * *> \par Contributors: * ================== @@ -283,6 +281,7 @@ SUBROUTINE CLARRV( N, VL, VU, D, L, PIVMIN, $ RTOL1, RTOL2, W, WERR, WGAP, $ IBLOCK, INDEXW, GERS, Z, LDZ, ISUPPZ, $ WORK, IWORK, INFO ) + IMPLICIT NONE * * -- LAPACK auxiliary routine -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- @@ -334,7 +333,8 @@ SUBROUTINE CLARRV( N, VL, VU, D, L, PIVMIN, EXTERNAL SLAMCH * .. * .. External Subroutines .. - EXTERNAL CLAR1V, CLASET, CSSCAL, SCOPY, SLARRB, + EXTERNAL CLAR1V, CLASET, CSSCAL, SCOPY, + $ SLARRB, $ SLARRF * .. * .. Intrinsic Functions .. @@ -348,7 +348,7 @@ SUBROUTINE CLARRV( N, VL, VU, D, L, PIVMIN, * * Quick return if possible * - IF( (N.LE.0) .OR. (M.LE.0) ) THEN + IF( (N.LE.0).OR.(M.LE.0) ) THEN RETURN END IF * @@ -702,6 +702,10 @@ SUBROUTINE CLARRV( N, VL, VU, D, L, PIVMIN, $ WERR(WBEGIN),WORK( INDWRK ), $ IWORK( IINDWK ), PIVMIN, SPDIAM, $ IN, IINFO ) + IF( IINFO.NE.0 ) THEN + INFO = -1 + RETURN + END IF 55 CONTINUE * IF((WBEGIN+NEWLST-1.LT.DOL).OR. diff --git a/lapack-netlib/SRC/cstemr.f b/lapack-netlib/SRC/cstemr.f index 46b20d880d..8ff54a2d4f 100644 --- a/lapack-netlib/SRC/cstemr.f +++ b/lapack-netlib/SRC/cstemr.f @@ -5,7 +5,6 @@ * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * -*> \htmlonly *> Download CSTEMR + dependencies *> *> [TGZ] @@ -13,7 +12,6 @@ *> [ZIP] *> *> [TXT] -*> \endhtmlonly * * Definition: * =========== @@ -306,10 +304,11 @@ *> = 0: successful exit *> < 0: if INFO = -i, the i-th argument had an illegal value *> > 0: if INFO = 1X, internal error in SLARRE, -*> if INFO = 2X, internal error in CLARRV. +*> if INFO = 2X, internal error in CLARRV, +*> if INFO = 3X, internal error in SLARRJ. *> Here, the digit X = ABS( IINFO ) < 10, where IINFO is -*> the nonzero error code returned by SLARRE or -*> CLARRV, respectively. +*> the nonzero error code returned by SLARRE, CLARRV +*> or SLARRJ, respectively. *> \endverbatim * * Authors: @@ -336,6 +335,7 @@ SUBROUTINE CSTEMR( JOBZ, RANGE, N, D, E, VL, VU, IL, IU, $ M, W, Z, LDZ, NZC, ISUPPZ, TRYRAC, WORK, LWORK, $ IWORK, LIWORK, INFO ) + IMPLICIT NONE * * -- LAPACK computational routine -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- @@ -377,10 +377,12 @@ SUBROUTINE CSTEMR( JOBZ, RANGE, N, D, E, VL, VU, IL, IU, * .. External Functions .. LOGICAL LSAME REAL SLAMCH, SLANST, SROUNDUP_LWORK - EXTERNAL LSAME, SLAMCH, SLANST, SROUNDUP_LWORK + EXTERNAL LSAME, SLAMCH, SLANST, + $ SROUNDUP_LWORK * .. * .. External Subroutines .. - EXTERNAL CLARRV, CSWAP, SCOPY, SLAE2, SLAEV2, SLARRC, + EXTERNAL CLARRV, CSWAP, SCOPY, SLAE2, SLAEV2, + $ SLARRC, $ SLARRE, SLARRJ, SLARRR, SLASRT, SSCAL, XERBLA * .. * .. Intrinsic Functions .. @@ -477,7 +479,7 @@ SUBROUTINE CSTEMR( JOBZ, RANGE, N, D, E, VL, VU, IL, IU, NZCMIN = 0 ENDIF IF( ZQUERY .AND. INFO.EQ.0 ) THEN - Z( 1,1 ) = NZCMIN + Z( 1,1 ) = CMPLX( NZCMIN ) ELSE IF( NZC.LT.NZCMIN .AND. .NOT.ZQUERY ) THEN INFO = -14 END IF @@ -751,6 +753,10 @@ SUBROUTINE CSTEMR( JOBZ, RANGE, N, D, E, VL, VU, IL, IU, $ WORK( INDERR+WBEGIN-1 ), $ WORK( INDWRK ), IWORK( IINDWK ), PIVMIN, $ TNRM, IINFO ) + IF( IINFO.NE.0 ) THEN + INFO = 30 + ABS( IINFO ) + RETURN + END IF IBEGIN = IEND + 1 WBEGIN = WEND + 1 39 CONTINUE diff --git a/lapack-netlib/SRC/dlarrb.f b/lapack-netlib/SRC/dlarrb.f index 839b1d41ba..c3a923aa6d 100644 --- a/lapack-netlib/SRC/dlarrb.f +++ b/lapack-netlib/SRC/dlarrb.f @@ -5,7 +5,6 @@ * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * -*> \htmlonly *> Download DLARRB + dependencies *> *> [TGZ] @@ -13,7 +12,6 @@ *> [ZIP] *> *> [TXT] -*> \endhtmlonly * * Definition: * =========== @@ -167,7 +165,11 @@ *> \param[out] INFO *> \verbatim *> INFO is INTEGER -*> Error flag. +*> = 0: successful exit +*> = 1: the interval around one of the eigenvalues could not +*> be widened to contain it: the Sturm counts of the +*> representation are inconsistent, as they are when it +*> contains a NaN or an Inf. *> \endverbatim * * Authors: @@ -178,7 +180,7 @@ *> \author Univ. of Colorado Denver *> \author NAG Ltd. * -*> \ingroup OTHERauxiliary +*> \ingroup larrb * *> \par Contributors: * ================== @@ -193,6 +195,7 @@ SUBROUTINE DLARRB( N, D, LLD, IFIRST, ILAST, RTOL1, $ RTOL2, OFFSET, W, WGAP, WERR, WORK, IWORK, $ PIVMIN, SPDIAM, TWIST, INFO ) + IMPLICIT NONE * * -- LAPACK auxiliary routine -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- @@ -275,10 +278,23 @@ SUBROUTINE DLARRB( N, D, LLD, IFIRST, ILAST, RTOL1, * * Do while( NEGCNT(LEFT).GT.I-1 ) * - BACK = WERR( II ) +* The interval is widened by BACK, doubled at every step, until +* the Sturm count agrees with the index. In exact arithmetic +* this terminates because the count is 0 below the spectrum and +* N above it. A NaN or an Inf in the representation is never +* counted, so the count can stay short of the index; stop once +* BACK has overflowed, when no further step can move the +* endpoint. BACK starts at no less than the minimum interval +* width so that a zero WERR still makes progress. +* + BACK = MAX( WERR( II ), MNWDTH ) 20 CONTINUE NEGCNT = DLANEG( N, D, LLD, LEFT, PIVMIN, R ) IF( NEGCNT.GT.I-1 ) THEN + IF( .NOT.( BACK.LT.TWO*BACK ) ) THEN + INFO = 1 + RETURN + END IF LEFT = LEFT - BACK BACK = TWO*BACK GO TO 20 @@ -287,15 +303,18 @@ SUBROUTINE DLARRB( N, D, LLD, IFIRST, ILAST, RTOL1, * Do while( NEGCNT(RIGHT).LT.I ) * Compute negcount from dstqds facto L+D+L+^T = L D L^T - RIGHT * - BACK = WERR( II ) + BACK = MAX( WERR( II ), MNWDTH ) 50 CONTINUE - NEGCNT = DLANEG( N, D, LLD, RIGHT, PIVMIN, R ) - IF( NEGCNT.LT.I ) THEN - RIGHT = RIGHT + BACK - BACK = TWO*BACK - GO TO 50 - END IF + IF( NEGCNT.LT.I ) THEN + IF( .NOT.( BACK.LT.TWO*BACK ) ) THEN + INFO = 1 + RETURN + END IF + RIGHT = RIGHT + BACK + BACK = TWO*BACK + GO TO 50 + END IF WIDTH = HALF*ABS( LEFT - RIGHT ) TMP = MAX( ABS( LEFT ), ABS( RIGHT ) ) CVRGD = MAX(RTOL1*GAP,RTOL2*TMP) diff --git a/lapack-netlib/SRC/dlarrj.f b/lapack-netlib/SRC/dlarrj.f index f6abd84e7f..5a8a43a813 100644 --- a/lapack-netlib/SRC/dlarrj.f +++ b/lapack-netlib/SRC/dlarrj.f @@ -5,7 +5,6 @@ * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * -*> \htmlonly *> Download DLARRJ + dependencies *> *> [TGZ] @@ -13,7 +12,6 @@ *> [ZIP] *> *> [TXT] -*> \endhtmlonly * * Definition: * =========== @@ -139,7 +137,11 @@ *> \param[out] INFO *> \verbatim *> INFO is INTEGER -*> Error flag. +*> = 0: successful exit +*> = 1: the interval around one of the eigenvalues could not +*> be widened to contain it: the Sturm counts of the +*> matrix are inconsistent, as they are when it contains +*> a NaN or an Inf. *> \endverbatim * * Authors: @@ -150,7 +152,7 @@ *> \author Univ. of Colorado Denver *> \author NAG Ltd. * -*> \ingroup OTHERauxiliary +*> \ingroup larrj * *> \par Contributors: * ================== @@ -165,6 +167,7 @@ SUBROUTINE DLARRJ( N, D, E2, IFIRST, ILAST, $ RTOL, OFFSET, W, WERR, WORK, IWORK, $ PIVMIN, SPDIAM, INFO ) + IMPLICIT NONE * * -- LAPACK auxiliary routine -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- @@ -191,7 +194,7 @@ SUBROUTINE DLARRJ( N, D, E2, IFIRST, ILAST, * .. Local Scalars .. INTEGER CNT, I, I1, I2, II, ITER, J, K, NEXT, NINT, $ OLNINT, P, PREV, SAVI1 - DOUBLE PRECISION DPLUS, FAC, LEFT, MID, RIGHT, S, TMP, WIDTH + DOUBLE PRECISION BACK, DPLUS, LEFT, MID, RIGHT, S, TMP, WIDTH * * .. * .. Intrinsic Functions .. @@ -250,7 +253,16 @@ SUBROUTINE DLARRJ( N, D, E2, IFIRST, ILAST, * * Do while( CNT(LEFT).GT.I-1 ) * - FAC = ONE +* The interval is widened by BACK, doubled at every step, +* until the Sturm count agrees with the index. In exact +* arithmetic this terminates because the count is 0 below the +* spectrum and N above it. A NaN or an Inf in the matrix is +* never counted, so the count can stay short of the index; +* stop once BACK has overflowed, when no further step can move +* the endpoint. BACK starts at no less than the minimum +* interval width so that a zero WERR still makes progress. +* + BACK = MAX( WERR( II ), TWO*PIVMIN ) 20 CONTINUE CNT = 0 S = LEFT @@ -261,14 +273,18 @@ SUBROUTINE DLARRJ( N, D, E2, IFIRST, ILAST, IF( DPLUS.LT.ZERO ) CNT = CNT + 1 30 CONTINUE IF( CNT.GT.I-1 ) THEN - LEFT = LEFT - WERR( II )*FAC - FAC = TWO*FAC + IF( .NOT.( BACK.LT.TWO*BACK ) ) THEN + INFO = 1 + RETURN + END IF + LEFT = LEFT - BACK + BACK = TWO*BACK GO TO 20 END IF * * Do while( CNT(RIGHT).LT.I ) * - FAC = ONE + BACK = MAX( WERR( II ), TWO*PIVMIN ) 50 CONTINUE CNT = 0 S = RIGHT @@ -279,8 +295,12 @@ SUBROUTINE DLARRJ( N, D, E2, IFIRST, ILAST, IF( DPLUS.LT.ZERO ) CNT = CNT + 1 60 CONTINUE IF( CNT.LT.I ) THEN - RIGHT = RIGHT + WERR( II )*FAC - FAC = TWO*FAC + IF( .NOT.( BACK.LT.TWO*BACK ) ) THEN + INFO = 1 + RETURN + END IF + RIGHT = RIGHT + BACK + BACK = TWO*BACK GO TO 50 END IF NINT = NINT + 1 diff --git a/lapack-netlib/SRC/dlarrv.f b/lapack-netlib/SRC/dlarrv.f index 2994303612..19fe245d42 100644 --- a/lapack-netlib/SRC/dlarrv.f +++ b/lapack-netlib/SRC/dlarrv.f @@ -5,7 +5,6 @@ * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * -*> \htmlonly *> Download DLARRV + dependencies *> *> [TGZ] @@ -13,7 +12,6 @@ *> [ZIP] *> *> [TXT] -*> \endhtmlonly * * Definition: * =========== @@ -272,7 +270,7 @@ *> \author Univ. of Colorado Denver *> \author NAG Ltd. * -*> \ingroup doubleOTHERauxiliary +*> \ingroup larrv * *> \par Contributors: * ================== @@ -289,6 +287,7 @@ SUBROUTINE DLARRV( N, VL, VU, D, L, PIVMIN, $ RTOL1, RTOL2, W, WERR, WGAP, $ IBLOCK, INDEXW, GERS, Z, LDZ, ISUPPZ, $ WORK, IWORK, INFO ) + IMPLICIT NONE * * -- LAPACK auxiliary routine -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- @@ -337,7 +336,8 @@ SUBROUTINE DLARRV( N, VL, VU, D, L, PIVMIN, EXTERNAL DLAMCH * .. * .. External Subroutines .. - EXTERNAL DCOPY, DLAR1V, DLARRB, DLARRF, DLASET, + EXTERNAL DCOPY, DLAR1V, DLARRB, DLARRF, + $ DLASET, $ DSCAL * .. * .. Intrinsic Functions .. @@ -698,6 +698,10 @@ SUBROUTINE DLARRV( N, VL, VU, D, L, PIVMIN, $ WERR(WBEGIN),WORK( INDWRK ), $ IWORK( IINDWK ), PIVMIN, SPDIAM, $ IN, IINFO ) + IF( IINFO.NE.0 ) THEN + INFO = -1 + RETURN + END IF 55 CONTINUE * IF((WBEGIN+NEWLST-1.LT.DOL).OR. diff --git a/lapack-netlib/SRC/dstemr.f b/lapack-netlib/SRC/dstemr.f index 44a33423e2..070a318de9 100644 --- a/lapack-netlib/SRC/dstemr.f +++ b/lapack-netlib/SRC/dstemr.f @@ -5,7 +5,6 @@ * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * -*> \htmlonly *> Download DSTEMR + dependencies *> *> [TGZ] @@ -13,7 +12,6 @@ *> [ZIP] *> *> [TXT] -*> \endhtmlonly * * Definition: * =========== @@ -289,10 +287,11 @@ *> = 0: successful exit *> < 0: if INFO = -i, the i-th argument had an illegal value *> > 0: if INFO = 1X, internal error in DLARRE, -*> if INFO = 2X, internal error in DLARRV. +*> if INFO = 2X, internal error in DLARRV, +*> if INFO = 3X, internal error in DLARRJ. *> Here, the digit X = ABS( IINFO ) < 10, where IINFO is -*> the nonzero error code returned by DLARRE or -*> DLARRV, respectively. +*> the nonzero error code returned by DLARRE, DLARRV +*> or DLARRJ, respectively. *> \endverbatim * * Authors: @@ -319,6 +318,7 @@ SUBROUTINE DSTEMR( JOBZ, RANGE, N, D, E, VL, VU, IL, IU, $ M, W, Z, LDZ, NZC, ISUPPZ, TRYRAC, WORK, LWORK, $ IWORK, LIWORK, INFO ) + IMPLICIT NONE * * -- LAPACK computational routine -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- @@ -363,7 +363,8 @@ SUBROUTINE DSTEMR( JOBZ, RANGE, N, D, E, VL, VU, IL, IU, EXTERNAL LSAME, DLAMCH, DLANST * .. * .. External Subroutines .. - EXTERNAL DCOPY, DLAE2, DLAEV2, DLARRC, DLARRE, DLARRJ, + EXTERNAL DCOPY, DLAE2, DLAEV2, DLARRC, DLARRE, + $ DLARRJ, $ DLARRR, DLARRV, DLASRT, DSCAL, DSWAP, XERBLA * .. * .. Intrinsic Functions .. @@ -735,6 +736,10 @@ SUBROUTINE DSTEMR( JOBZ, RANGE, N, D, E, VL, VU, IL, IU, $ WORK( INDERR+WBEGIN-1 ), $ WORK( INDWRK ), IWORK( IINDWK ), PIVMIN, $ TNRM, IINFO ) + IF( IINFO.NE.0 ) THEN + INFO = 30 + ABS( IINFO ) + RETURN + END IF IBEGIN = IEND + 1 WBEGIN = WEND + 1 39 CONTINUE diff --git a/lapack-netlib/SRC/slarrb.f b/lapack-netlib/SRC/slarrb.f index cf670dad9a..efa9e0410b 100644 --- a/lapack-netlib/SRC/slarrb.f +++ b/lapack-netlib/SRC/slarrb.f @@ -5,7 +5,6 @@ * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * -*> \htmlonly *> Download SLARRB + dependencies *> *> [TGZ] @@ -13,7 +12,6 @@ *> [ZIP] *> *> [TXT] -*> \endhtmlonly * * Definition: * =========== @@ -167,7 +165,11 @@ *> \param[out] INFO *> \verbatim *> INFO is INTEGER -*> Error flag. +*> = 0: successful exit +*> = 1: the interval around one of the eigenvalues could not +*> be widened to contain it: the Sturm counts of the +*> representation are inconsistent, as they are when it +*> contains a NaN or an Inf. *> \endverbatim * * Authors: @@ -178,7 +180,7 @@ *> \author Univ. of Colorado Denver *> \author NAG Ltd. * -*> \ingroup OTHERauxiliary +*> \ingroup larrb * *> \par Contributors: * ================== @@ -193,6 +195,7 @@ SUBROUTINE SLARRB( N, D, LLD, IFIRST, ILAST, RTOL1, $ RTOL2, OFFSET, W, WGAP, WERR, WORK, IWORK, $ PIVMIN, SPDIAM, TWIST, INFO ) + IMPLICIT NONE * * -- LAPACK auxiliary routine -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- @@ -275,10 +278,23 @@ SUBROUTINE SLARRB( N, D, LLD, IFIRST, ILAST, RTOL1, * * Do while( NEGCNT(LEFT).GT.I-1 ) * - BACK = WERR( II ) +* The interval is widened by BACK, doubled at every step, until +* the Sturm count agrees with the index. In exact arithmetic +* this terminates because the count is 0 below the spectrum and +* N above it. A NaN or an Inf in the representation is never +* counted, so the count can stay short of the index; stop once +* BACK has overflowed, when no further step can move the +* endpoint. BACK starts at no less than the minimum interval +* width so that a zero WERR still makes progress. +* + BACK = MAX( WERR( II ), MNWDTH ) 20 CONTINUE NEGCNT = SLANEG( N, D, LLD, LEFT, PIVMIN, R ) IF( NEGCNT.GT.I-1 ) THEN + IF( .NOT.( BACK.LT.TWO*BACK ) ) THEN + INFO = 1 + RETURN + END IF LEFT = LEFT - BACK BACK = TWO*BACK GO TO 20 @@ -287,15 +303,18 @@ SUBROUTINE SLARRB( N, D, LLD, IFIRST, ILAST, RTOL1, * Do while( NEGCNT(RIGHT).LT.I ) * Compute negcount from dstqds facto L+D+L+^T = L D L^T - RIGHT * - BACK = WERR( II ) + BACK = MAX( WERR( II ), MNWDTH ) 50 CONTINUE - NEGCNT = SLANEG( N, D, LLD, RIGHT, PIVMIN, R ) - IF( NEGCNT.LT.I ) THEN - RIGHT = RIGHT + BACK - BACK = TWO*BACK - GO TO 50 - END IF + IF( NEGCNT.LT.I ) THEN + IF( .NOT.( BACK.LT.TWO*BACK ) ) THEN + INFO = 1 + RETURN + END IF + RIGHT = RIGHT + BACK + BACK = TWO*BACK + GO TO 50 + END IF WIDTH = HALF*ABS( LEFT - RIGHT ) TMP = MAX( ABS( LEFT ), ABS( RIGHT ) ) CVRGD = MAX(RTOL1*GAP,RTOL2*TMP) diff --git a/lapack-netlib/SRC/slarrj.f b/lapack-netlib/SRC/slarrj.f index d56e62c1d6..5fc94ca5f3 100644 --- a/lapack-netlib/SRC/slarrj.f +++ b/lapack-netlib/SRC/slarrj.f @@ -5,7 +5,6 @@ * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * -*> \htmlonly *> Download SLARRJ + dependencies *> *> [TGZ] @@ -13,7 +12,6 @@ *> [ZIP] *> *> [TXT] -*> \endhtmlonly * * Definition: * =========== @@ -139,7 +137,11 @@ *> \param[out] INFO *> \verbatim *> INFO is INTEGER -*> Error flag. +*> = 0: successful exit +*> = 1: the interval around one of the eigenvalues could not +*> be widened to contain it: the Sturm counts of the +*> matrix are inconsistent, as they are when it contains +*> a NaN or an Inf. *> \endverbatim * * Authors: @@ -150,7 +152,7 @@ *> \author Univ. of Colorado Denver *> \author NAG Ltd. * -*> \ingroup OTHERauxiliary +*> \ingroup larrj * *> \par Contributors: * ================== @@ -165,6 +167,7 @@ SUBROUTINE SLARRJ( N, D, E2, IFIRST, ILAST, $ RTOL, OFFSET, W, WERR, WORK, IWORK, $ PIVMIN, SPDIAM, INFO ) + IMPLICIT NONE * * -- LAPACK auxiliary routine -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- @@ -191,7 +194,7 @@ SUBROUTINE SLARRJ( N, D, E2, IFIRST, ILAST, * .. Local Scalars .. INTEGER CNT, I, I1, I2, II, ITER, J, K, NEXT, NINT, $ OLNINT, P, PREV, SAVI1 - REAL DPLUS, FAC, LEFT, MID, RIGHT, S, TMP, WIDTH + REAL BACK, DPLUS, LEFT, MID, RIGHT, S, TMP, WIDTH * * .. * .. Intrinsic Functions .. @@ -250,7 +253,16 @@ SUBROUTINE SLARRJ( N, D, E2, IFIRST, ILAST, * * Do while( CNT(LEFT).GT.I-1 ) * - FAC = ONE +* The interval is widened by BACK, doubled at every step, +* until the Sturm count agrees with the index. In exact +* arithmetic this terminates because the count is 0 below the +* spectrum and N above it. A NaN or an Inf in the matrix is +* never counted, so the count can stay short of the index; +* stop once BACK has overflowed, when no further step can move +* the endpoint. BACK starts at no less than the minimum +* interval width so that a zero WERR still makes progress. +* + BACK = MAX( WERR( II ), TWO*PIVMIN ) 20 CONTINUE CNT = 0 S = LEFT @@ -261,14 +273,18 @@ SUBROUTINE SLARRJ( N, D, E2, IFIRST, ILAST, IF( DPLUS.LT.ZERO ) CNT = CNT + 1 30 CONTINUE IF( CNT.GT.I-1 ) THEN - LEFT = LEFT - WERR( II )*FAC - FAC = TWO*FAC + IF( .NOT.( BACK.LT.TWO*BACK ) ) THEN + INFO = 1 + RETURN + END IF + LEFT = LEFT - BACK + BACK = TWO*BACK GO TO 20 END IF * * Do while( CNT(RIGHT).LT.I ) * - FAC = ONE + BACK = MAX( WERR( II ), TWO*PIVMIN ) 50 CONTINUE CNT = 0 S = RIGHT @@ -279,8 +295,12 @@ SUBROUTINE SLARRJ( N, D, E2, IFIRST, ILAST, IF( DPLUS.LT.ZERO ) CNT = CNT + 1 60 CONTINUE IF( CNT.LT.I ) THEN - RIGHT = RIGHT + WERR( II )*FAC - FAC = TWO*FAC + IF( .NOT.( BACK.LT.TWO*BACK ) ) THEN + INFO = 1 + RETURN + END IF + RIGHT = RIGHT + BACK + BACK = TWO*BACK GO TO 50 END IF NINT = NINT + 1 diff --git a/lapack-netlib/SRC/slarrv.f b/lapack-netlib/SRC/slarrv.f index 95f94fd1bd..2734fb0d98 100644 --- a/lapack-netlib/SRC/slarrv.f +++ b/lapack-netlib/SRC/slarrv.f @@ -5,7 +5,6 @@ * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * -*> \htmlonly *> Download SLARRV + dependencies *> *> [TGZ] @@ -13,7 +12,6 @@ *> [ZIP] *> *> [TXT] -*> \endhtmlonly * * Definition: * =========== @@ -272,7 +270,7 @@ *> \author Univ. of Colorado Denver *> \author NAG Ltd. * -*> \ingroup realOTHERauxiliary +*> \ingroup larrv * *> \par Contributors: * ================== @@ -289,6 +287,7 @@ SUBROUTINE SLARRV( N, VL, VU, D, L, PIVMIN, $ RTOL1, RTOL2, W, WERR, WGAP, $ IBLOCK, INDEXW, GERS, Z, LDZ, ISUPPZ, $ WORK, IWORK, INFO ) + IMPLICIT NONE * * -- LAPACK auxiliary routine -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- @@ -337,7 +336,8 @@ SUBROUTINE SLARRV( N, VL, VU, D, L, PIVMIN, EXTERNAL SLAMCH * .. * .. External Subroutines .. - EXTERNAL SCOPY, SLAR1V, SLARRB, SLARRF, SLASET, + EXTERNAL SCOPY, SLAR1V, SLARRB, SLARRF, + $ SLASET, $ SSCAL * .. * .. Intrinsic Functions .. @@ -698,6 +698,10 @@ SUBROUTINE SLARRV( N, VL, VU, D, L, PIVMIN, $ WERR(WBEGIN),WORK( INDWRK ), $ IWORK( IINDWK ), PIVMIN, SPDIAM, $ IN, IINFO ) + IF( IINFO.NE.0 ) THEN + INFO = -1 + RETURN + END IF 55 CONTINUE * IF((WBEGIN+NEWLST-1.LT.DOL).OR. diff --git a/lapack-netlib/SRC/sstemr.f b/lapack-netlib/SRC/sstemr.f index 62cfa3d4dd..df8f6e59c6 100644 --- a/lapack-netlib/SRC/sstemr.f +++ b/lapack-netlib/SRC/sstemr.f @@ -5,7 +5,6 @@ * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * -*> \htmlonly *> Download SSTEMR + dependencies *> *> [TGZ] @@ -13,7 +12,6 @@ *> [ZIP] *> *> [TXT] -*> \endhtmlonly * * Definition: * =========== @@ -289,10 +287,11 @@ *> = 0: successful exit *> < 0: if INFO = -i, the i-th argument had an illegal value *> > 0: if INFO = 1X, internal error in SLARRE, -*> if INFO = 2X, internal error in SLARRV. +*> if INFO = 2X, internal error in SLARRV, +*> if INFO = 3X, internal error in SLARRJ. *> Here, the digit X = ABS( IINFO ) < 10, where IINFO is -*> the nonzero error code returned by SLARRE or -*> SLARRV, respectively. +*> the nonzero error code returned by SLARRE, SLARRV +*> or SLARRJ, respectively. *> \endverbatim * * Authors: @@ -319,6 +318,7 @@ SUBROUTINE SSTEMR( JOBZ, RANGE, N, D, E, VL, VU, IL, IU, $ M, W, Z, LDZ, NZC, ISUPPZ, TRYRAC, WORK, LWORK, $ IWORK, LIWORK, INFO ) + IMPLICIT NONE * * -- LAPACK computational routine -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- @@ -363,7 +363,8 @@ SUBROUTINE SSTEMR( JOBZ, RANGE, N, D, E, VL, VU, IL, IU, EXTERNAL LSAME, SLAMCH, SLANST, SROUNDUP_LWORK * .. * .. External Subroutines .. - EXTERNAL SCOPY, SLAE2, SLAEV2, SLARRC, SLARRE, SLARRJ, + EXTERNAL SCOPY, SLAE2, SLAEV2, SLARRC, SLARRE, + $ SLARRJ, $ SLARRR, SLARRV, SLASRT, SSCAL, SSWAP, XERBLA * .. * .. Intrinsic Functions .. @@ -458,7 +459,7 @@ SUBROUTINE SSTEMR( JOBZ, RANGE, N, D, E, VL, VU, IL, IU, NZCMIN = 0 ENDIF IF( ZQUERY .AND. INFO.EQ.0 ) THEN - Z( 1,1 ) = NZCMIN + Z( 1,1 ) = REAL( NZCMIN ) ELSE IF( NZC.LT.NZCMIN .AND. .NOT.ZQUERY ) THEN INFO = -14 END IF @@ -732,6 +733,10 @@ SUBROUTINE SSTEMR( JOBZ, RANGE, N, D, E, VL, VU, IL, IU, $ WORK( INDERR+WBEGIN-1 ), $ WORK( INDWRK ), IWORK( IINDWK ), PIVMIN, $ TNRM, IINFO ) + IF( IINFO.NE.0 ) THEN + INFO = 30 + ABS( IINFO ) + RETURN + END IF IBEGIN = IEND + 1 WBEGIN = WEND + 1 39 CONTINUE diff --git a/lapack-netlib/SRC/zlarrv.f b/lapack-netlib/SRC/zlarrv.f index e4be63e0db..a2ab33b757 100644 --- a/lapack-netlib/SRC/zlarrv.f +++ b/lapack-netlib/SRC/zlarrv.f @@ -5,7 +5,6 @@ * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * -*> \htmlonly *> Download ZLARRV + dependencies *> *> [TGZ] @@ -13,7 +12,6 @@ *> [ZIP] *> *> [TXT] -*> \endhtmlonly * * Definition: * =========== @@ -266,7 +264,7 @@ *> \author Univ. of Colorado Denver *> \author NAG Ltd. * -*> \ingroup complex16OTHERauxiliary +*> \ingroup larrv * *> \par Contributors: * ================== @@ -283,6 +281,7 @@ SUBROUTINE ZLARRV( N, VL, VU, D, L, PIVMIN, $ RTOL1, RTOL2, W, WERR, WGAP, $ IBLOCK, INDEXW, GERS, Z, LDZ, ISUPPZ, $ WORK, IWORK, INFO ) + IMPLICIT NONE * * -- LAPACK auxiliary routine -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- @@ -303,6 +302,8 @@ SUBROUTINE ZLARRV( N, VL, VU, D, L, PIVMIN, * ===================================================================== * * .. Parameters .. + INTEGER DP + PARAMETER ( DP = KIND( 0.0D0 ) ) INTEGER MAXITR PARAMETER ( MAXITR = 10 ) COMPLEX*16 CZERO @@ -334,12 +335,13 @@ SUBROUTINE ZLARRV( N, VL, VU, D, L, PIVMIN, EXTERNAL DLAMCH * .. * .. External Subroutines .. - EXTERNAL DCOPY, DLARRB, DLARRF, ZDSCAL, ZLAR1V, + EXTERNAL DCOPY, DLARRB, DLARRF, ZDSCAL, + $ ZLAR1V, $ ZLASET * .. * .. Intrinsic Functions .. INTRINSIC ABS, DBLE, MAX, MIN - INTRINSIC DCMPLX + INTRINSIC CMPLX * .. * .. Executable Statements .. * .. @@ -461,7 +463,7 @@ SUBROUTINE ZLARRV( N, VL, VU, D, L, PIVMIN, * This is for a 1x1 block IF( IBEGIN.EQ.IEND ) THEN DONE = DONE+1 - Z( IBEGIN, WBEGIN ) = DCMPLX( ONE, ZERO ) + Z( IBEGIN, WBEGIN ) = CMPLX( ONE, ZERO, KIND=DP ) ISUPPZ( 2*WBEGIN-1 ) = IBEGIN ISUPPZ( 2*WBEGIN ) = IBEGIN W( WBEGIN ) = W( WBEGIN ) + SIGMA @@ -702,6 +704,10 @@ SUBROUTINE ZLARRV( N, VL, VU, D, L, PIVMIN, $ WERR(WBEGIN),WORK( INDWRK ), $ IWORK( IINDWK ), PIVMIN, SPDIAM, $ IN, IINFO ) + IF( IINFO.NE.0 ) THEN + INFO = -1 + RETURN + END IF 55 CONTINUE * IF((WBEGIN+NEWLST-1.LT.DOL).OR. @@ -733,17 +739,18 @@ SUBROUTINE ZLARRV( N, VL, VU, D, L, PIVMIN, * workspace DO 56 K = 1, IN-1 Z( IBEGIN+K-1, NEWFTT ) = - $ DCMPLX( WORK( INDIN1+K-1 ), ZERO ) + $ CMPLX( WORK( INDIN1+K-1 ), ZERO, KIND=DP ) Z( IBEGIN+K-1, NEWFTT+1 ) = - $ DCMPLX( WORK( INDIN2+K-1 ), ZERO ) + $ CMPLX( WORK( INDIN2+K-1 ), ZERO, KIND=DP ) 56 CONTINUE Z( IEND, NEWFTT ) = - $ DCMPLX( WORK( INDIN1+IN-1 ), ZERO ) + $ CMPLX( WORK( INDIN1+IN-1 ), ZERO, KIND=DP ) IF( IINFO.EQ.0 ) THEN * a new RRR for the cluster was found by DLARRF * update shift and store it SSIGMA = SIGMA + TAU - Z( IEND, NEWFTT+1 ) = DCMPLX( SSIGMA, ZERO ) + Z( IEND, NEWFTT+1 ) = CMPLX( SSIGMA, ZERO, + $ KIND=DP ) * WORK() are the midpoints and WERR() the semi-width * Note that the entries in W are unchanged. DO 116 K = NEWFST, NEWLST diff --git a/lapack-netlib/SRC/zstemr.f b/lapack-netlib/SRC/zstemr.f index 4eaf5ef974..0ceae23087 100644 --- a/lapack-netlib/SRC/zstemr.f +++ b/lapack-netlib/SRC/zstemr.f @@ -5,7 +5,6 @@ * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * -*> \htmlonly *> Download ZSTEMR + dependencies *> *> [TGZ] @@ -13,7 +12,6 @@ *> [ZIP] *> *> [TXT] -*> \endhtmlonly * * Definition: * =========== @@ -306,10 +304,11 @@ *> = 0: successful exit *> < 0: if INFO = -i, the i-th argument had an illegal value *> > 0: if INFO = 1X, internal error in DLARRE, -*> if INFO = 2X, internal error in ZLARRV. +*> if INFO = 2X, internal error in ZLARRV, +*> if INFO = 3X, internal error in DLARRJ. *> Here, the digit X = ABS( IINFO ) < 10, where IINFO is -*> the nonzero error code returned by DLARRE or -*> ZLARRV, respectively. +*> the nonzero error code returned by DLARRE, ZLARRV +*> or DLARRJ, respectively. *> \endverbatim * * Authors: @@ -336,6 +335,7 @@ SUBROUTINE ZSTEMR( JOBZ, RANGE, N, D, E, VL, VU, IL, IU, $ M, W, Z, LDZ, NZC, ISUPPZ, TRYRAC, WORK, LWORK, $ IWORK, LIWORK, INFO ) + IMPLICIT NONE * * -- LAPACK computational routine -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- @@ -380,7 +380,8 @@ SUBROUTINE ZSTEMR( JOBZ, RANGE, N, D, E, VL, VU, IL, IU, EXTERNAL LSAME, DLAMCH, DLANST * .. * .. External Subroutines .. - EXTERNAL DCOPY, DLAE2, DLAEV2, DLARRC, DLARRE, DLARRJ, + EXTERNAL DCOPY, DLAE2, DLAEV2, DLARRC, DLARRE, + $ DLARRJ, $ DLARRR, DLASRT, DSCAL, XERBLA, ZLARRV, ZSWAP * .. * .. Intrinsic Functions .. @@ -751,6 +752,10 @@ SUBROUTINE ZSTEMR( JOBZ, RANGE, N, D, E, VL, VU, IL, IU, $ WORK( INDERR+WBEGIN-1 ), $ WORK( INDWRK ), IWORK( IINDWK ), PIVMIN, $ TNRM, IINFO ) + IF( IINFO.NE.0 ) THEN + INFO = 30 + ABS( IINFO ) + RETURN + END IF IBEGIN = IEND + 1 WBEGIN = WEND + 1 39 CONTINUE diff --git a/lapack-netlib/TESTING/EIG/cchkst.f b/lapack-netlib/TESTING/EIG/cchkst.f index c1a5fc449e..d64f2bc540 100644 --- a/lapack-netlib/TESTING/EIG/cchkst.f +++ b/lapack-netlib/TESTING/EIG/cchkst.f @@ -643,12 +643,15 @@ SUBROUTINE CCHKST( NSIZES, NN, NTYPES, DOTYPE, ISEED, THRESH, PARAMETER ( CREL = .FALSE. ) * .. * .. Local Scalars .. + CHARACTER JOBZ + INTEGER JOBNUM LOGICAL BADNN, TRYRAC INTEGER I, IINFO, IL, IMODE, INDE, INDRWK, ITEMP, $ ITYPE, IU, J, JC, JR, JSIZE, JTYPE, LGN, $ LIWEDC, LOG2UI, LRWEDC, LWEDC, M, M2, M3, $ MTYPES, N, NAP, NBLOCK, NERRS, NMATS, NMAX, $ NSPLIT, NTEST, NTESTT + REAL RNAN, RONE REAL ABSTOL, ANINV, ANORM, COND, OVFL, RTOVFL, $ RTUNFL, TEMP1, TEMP2, TEMP3, TEMP4, ULP, $ ULPINV, UNFL, VL, VU @@ -2049,10 +2052,58 @@ SUBROUTINE CCHKST( NSIZES, NN, NTYPES, DOTYPE, ISEED, THRESH, DEALLOCATE( DREG, EREG, D1REG, ZREG ) * * Summary +* +* +* CSTEMR must return for a tridiagonal matrix that contains a NaN +* instead of widening a bracket forever. A NaN pivot is never +* counted, so the Sturm count of such a matrix never reaches the +* index of the wanted eigenvalue, and the widening loops of +* SLARRB, which refines the eigenvalues of a representation, and +* of SLARRJ, which refines them on the matrix itself when no +* eigenvectors are wanted, can only be ended by a bound on the +* step. Any nonnegative INFO is accepted: the test is that the +* call returns at all. +* + IF( NMAX.GE.3 .AND. LRWORK.GE.18*NMAX .AND. + $ LIWORK.GE.12*NMAX .AND. + $ ILAENV( 10, 'CSTEMR', 'VA', 1, 0, 0, 0 ).EQ.1 .AND. + $ ILAENV( 11, 'CSTEMR', 'VA', 1, 0, 0, 0 ).EQ.1 ) THEN + N = NMAX + RONE = ONE + RNAN = SQRT( -RONE ) + DO 330 JOBNUM = 1, 2 + IF( JOBNUM.EQ.1 ) THEN + JOBZ = 'V' + ELSE + JOBZ = 'N' + END IF + DO 320 J = 1, N + SD( J ) = REAL( J ) + SE( J ) = ONE / REAL( J+1 ) + 320 CONTINUE + SD( 1 ) = RNAN + SE( N ) = ZERO + VL = ZERO + VU = ZERO + IL = 0 + IU = 0 + TRYRAC = .TRUE. + CALL CSTEMR( JOBZ, 'A', N, SD, SE, VL, VU, IL, IU, M, + $ WR, Z, LDU, N, IWORK( 1 ), TRYRAC, RWORK, + $ LRWORK, IWORK( 2*N+1 ), LIWORK-2*N, IINFO ) + IF( IINFO.LT.0 ) THEN + WRITE( NOUNIT, FMT = 9986 )JOBZ, IINFO + NERRS = NERRS + 1 + END IF + NTESTT = NTESTT + 1 + 330 CONTINUE + END IF * CALL SLASUM( 'CST', NOUNIT, NERRS, NTESTT ) RETURN * + 9986 FORMAT( ' CCHKST: CSTEMR( ', A1, ', A ) on a matrix with a', + $ ' NaN returned INFO=', I6 ) 9982 FORMAT( ' CCHKST: CSTEDC( V ) with N=', I5, ' returned INFO=', $ I6 ) 9981 FORMAT( ' CCHKST: CSTEDC( V ) with N=', I5, ' overwrote ', I6, diff --git a/lapack-netlib/TESTING/EIG/dchkst.f b/lapack-netlib/TESTING/EIG/dchkst.f index 4df709e239..2ebb7fe5cc 100644 --- a/lapack-netlib/TESTING/EIG/dchkst.f +++ b/lapack-netlib/TESTING/EIG/dchkst.f @@ -631,12 +631,15 @@ SUBROUTINE DCHKST( NSIZES, NN, NTYPES, DOTYPE, ISEED, THRESH, PARAMETER ( SREL = .FALSE. ) * .. * .. Local Scalars .. + CHARACTER JOBZ + INTEGER JOBNUM LOGICAL BADNN, TRYRAC INTEGER I, IINFO, IL, IMODE, ITEMP, ITYPE, IU, J, JC, $ JR, JSIZE, JSM, JTYPE, LGN, LIWEDC, LOG2UI, $ LWEDC, M, M2, M3, MTYPES, N, NAP, NBLOCK, $ NERRS, NMATS, NMAX, NSPLIT, NTEST, NTESTT, $ SMLSAV + DOUBLE PRECISION RNAN, RONE DOUBLE PRECISION ABSTOL, ANINV, ANORM, COND, OVFL, RTOVFL, $ RTUNFL, TEMP1, TEMP2, TEMP3, TEMP4, ULP, $ ULPINV, UNFL, VL, VU @@ -2017,10 +2020,57 @@ SUBROUTINE DCHKST( NSIZES, NN, NTYPES, DOTYPE, ISEED, THRESH, 310 CONTINUE * * Summary +* +* +* DSTEMR must return for a tridiagonal matrix that contains a NaN +* instead of widening a bracket forever. A NaN pivot is never +* counted, so the Sturm count of such a matrix never reaches the +* index of the wanted eigenvalue, and the widening loops of +* DLARRB, which refines the eigenvalues of a representation, and +* of DLARRJ, which refines them on the matrix itself when no +* eigenvectors are wanted, can only be ended by a bound on the +* step. Any nonnegative INFO is accepted: the test is that the +* call returns at all. +* + IF( NMAX.GE.3 .AND. LWORK.GE.18*NMAX .AND. LIWORK.GE.12*NMAX .AND. + $ ILAENV( 10, 'DSTEMR', 'VA', 1, 0, 0, 0 ).EQ.1 .AND. + $ ILAENV( 11, 'DSTEMR', 'VA', 1, 0, 0, 0 ).EQ.1 ) THEN + N = NMAX + RONE = ONE + RNAN = SQRT( -RONE ) + DO 330 JOBNUM = 1, 2 + IF( JOBNUM.EQ.1 ) THEN + JOBZ = 'V' + ELSE + JOBZ = 'N' + END IF + DO 320 J = 1, N + SD( J ) = DBLE( J ) + SE( J ) = ONE / DBLE( J+1 ) + 320 CONTINUE + SD( 1 ) = RNAN + SE( N ) = ZERO + VL = ZERO + VU = ZERO + IL = 0 + IU = 0 + TRYRAC = .TRUE. + CALL DSTEMR( JOBZ, 'A', N, SD, SE, VL, VU, IL, IU, M, + $ WR, Z, LDU, N, IWORK( 1 ), TRYRAC, WORK, + $ LWORK, IWORK( 2*N+1 ), LIWORK-2*N, IINFO ) + IF( IINFO.LT.0 ) THEN + WRITE( NOUNIT, FMT = 9986 )JOBZ, IINFO + NERRS = NERRS + 1 + END IF + NTESTT = NTESTT + 1 + 330 CONTINUE + END IF * CALL DLASUM( 'DST', NOUNIT, NERRS, NTESTT ) RETURN * + 9986 FORMAT( ' DCHKST: DSTEMR( ', A1, ', A ) on a matrix with a', + $ ' NaN returned INFO=', I6 ) 9999 FORMAT( ' DCHKST: ', A, ' returned INFO=', I6, '.', / 9X, 'N=', $ I6, ', JTYPE=', I6, ', ISEED=(', 3( I5, ',' ), I5, ')' ) * diff --git a/lapack-netlib/TESTING/EIG/schkst.f b/lapack-netlib/TESTING/EIG/schkst.f index da8ac3ed82..14383902aa 100644 --- a/lapack-netlib/TESTING/EIG/schkst.f +++ b/lapack-netlib/TESTING/EIG/schkst.f @@ -631,12 +631,15 @@ SUBROUTINE SCHKST( NSIZES, NN, NTYPES, DOTYPE, ISEED, THRESH, PARAMETER ( SREL = .FALSE. ) * .. * .. Local Scalars .. + CHARACTER JOBZ + INTEGER JOBNUM LOGICAL BADNN, TRYRAC INTEGER I, IINFO, IL, IMODE, ITEMP, ITYPE, IU, J, JC, $ JR, JSIZE, JSM, JTYPE, LGN, LIWEDC, LOG2UI, $ LWEDC, M, M2, M3, MTYPES, N, NAP, NBLOCK, $ NERRS, NMATS, NMAX, NSPLIT, NTEST, NTESTT, $ SMLSAV + REAL RNAN, RONE REAL ABSTOL, ANINV, ANORM, COND, OVFL, RTOVFL, $ RTUNFL, TEMP1, TEMP2, TEMP3, TEMP4, ULP, $ ULPINV, UNFL, VL, VU @@ -2017,10 +2020,57 @@ SUBROUTINE SCHKST( NSIZES, NN, NTYPES, DOTYPE, ISEED, THRESH, 310 CONTINUE * * Summary +* +* +* SSTEMR must return for a tridiagonal matrix that contains a NaN +* instead of widening a bracket forever. A NaN pivot is never +* counted, so the Sturm count of such a matrix never reaches the +* index of the wanted eigenvalue, and the widening loops of +* SLARRB, which refines the eigenvalues of a representation, and +* of SLARRJ, which refines them on the matrix itself when no +* eigenvectors are wanted, can only be ended by a bound on the +* step. Any nonnegative INFO is accepted: the test is that the +* call returns at all. +* + IF( NMAX.GE.3 .AND. LWORK.GE.18*NMAX .AND. LIWORK.GE.12*NMAX .AND. + $ ILAENV( 10, 'SSTEMR', 'VA', 1, 0, 0, 0 ).EQ.1 .AND. + $ ILAENV( 11, 'SSTEMR', 'VA', 1, 0, 0, 0 ).EQ.1 ) THEN + N = NMAX + RONE = ONE + RNAN = SQRT( -RONE ) + DO 330 JOBNUM = 1, 2 + IF( JOBNUM.EQ.1 ) THEN + JOBZ = 'V' + ELSE + JOBZ = 'N' + END IF + DO 320 J = 1, N + SD( J ) = REAL( J ) + SE( J ) = ONE / REAL( J+1 ) + 320 CONTINUE + SD( 1 ) = RNAN + SE( N ) = ZERO + VL = ZERO + VU = ZERO + IL = 0 + IU = 0 + TRYRAC = .TRUE. + CALL SSTEMR( JOBZ, 'A', N, SD, SE, VL, VU, IL, IU, M, + $ WR, Z, LDU, N, IWORK( 1 ), TRYRAC, WORK, + $ LWORK, IWORK( 2*N+1 ), LIWORK-2*N, IINFO ) + IF( IINFO.LT.0 ) THEN + WRITE( NOUNIT, FMT = 9986 )JOBZ, IINFO + NERRS = NERRS + 1 + END IF + NTESTT = NTESTT + 1 + 330 CONTINUE + END IF * CALL SLASUM( 'SST', NOUNIT, NERRS, NTESTT ) RETURN * + 9986 FORMAT( ' SCHKST: SSTEMR( ', A1, ', A ) on a matrix with a', + $ ' NaN returned INFO=', I6 ) 9999 FORMAT( ' SCHKST: ', A, ' returned INFO=', I6, '.', / 9X, 'N=', $ I6, ', JTYPE=', I6, ', ISEED=(', 3( I5, ',' ), I5, ')' ) * diff --git a/lapack-netlib/TESTING/EIG/zchkst.f b/lapack-netlib/TESTING/EIG/zchkst.f index 0bf3ff211c..ba65b18109 100644 --- a/lapack-netlib/TESTING/EIG/zchkst.f +++ b/lapack-netlib/TESTING/EIG/zchkst.f @@ -643,12 +643,15 @@ SUBROUTINE ZCHKST( NSIZES, NN, NTYPES, DOTYPE, ISEED, THRESH, PARAMETER ( CREL = .FALSE. ) * .. * .. Local Scalars .. + CHARACTER JOBZ + INTEGER JOBNUM LOGICAL BADNN, TRYRAC INTEGER I, IINFO, IL, IMODE, INDE, INDRWK, ITEMP, $ ITYPE, IU, J, JC, JR, JSIZE, JTYPE, LGN, $ LIWEDC, LOG2UI, LRWEDC, LWEDC, M, M2, M3, $ MTYPES, N, NAP, NBLOCK, NERRS, NMATS, NMAX, $ NSPLIT, NTEST, NTESTT + DOUBLE PRECISION RNAN, RONE DOUBLE PRECISION ABSTOL, ANINV, ANORM, COND, OVFL, RTOVFL, $ RTUNFL, TEMP1, TEMP2, TEMP3, TEMP4, ULP, $ ULPINV, UNFL, VL, VU @@ -675,7 +678,7 @@ SUBROUTINE ZCHKST( NSIZES, NN, NTYPES, DOTYPE, ISEED, THRESH, $ ZUNGTR, ZUPGTR * .. * .. Intrinsic Functions .. - INTRINSIC ABS, DBLE, DCONJG, INT, LOG, MAX, MIN, SQRT + INTRINSIC ABS, CONJG, DBLE, INT, LOG, MAX, MIN, SQRT * .. * .. Data statements .. DATA KTYPE / 1, 2, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 8, @@ -912,7 +915,7 @@ SUBROUTINE ZCHKST( NSIZES, NN, NTYPES, DOTYPE, ISEED, THRESH, IF( TEMP1.GT.HALF*TEMP2 ) THEN A( I-1, I ) = A( I-1, I )* $ ( HALF*TEMP2 / ( UNFL+TEMP1 ) ) - A( I, I-1 ) = DCONJG( A( I-1, I ) ) + A( I, I-1 ) = CONJG( A( I-1, I ) ) END IF 90 CONTINUE * @@ -2048,10 +2051,58 @@ SUBROUTINE ZCHKST( NSIZES, NN, NTYPES, DOTYPE, ISEED, THRESH, DEALLOCATE( DREG, EREG, D1REG, ZREG ) * * Summary +* +* +* ZSTEMR must return for a tridiagonal matrix that contains a NaN +* instead of widening a bracket forever. A NaN pivot is never +* counted, so the Sturm count of such a matrix never reaches the +* index of the wanted eigenvalue, and the widening loops of +* DLARRB, which refines the eigenvalues of a representation, and +* of DLARRJ, which refines them on the matrix itself when no +* eigenvectors are wanted, can only be ended by a bound on the +* step. Any nonnegative INFO is accepted: the test is that the +* call returns at all. +* + IF( NMAX.GE.3 .AND. LRWORK.GE.18*NMAX .AND. + $ LIWORK.GE.12*NMAX .AND. + $ ILAENV( 10, 'ZSTEMR', 'VA', 1, 0, 0, 0 ).EQ.1 .AND. + $ ILAENV( 11, 'ZSTEMR', 'VA', 1, 0, 0, 0 ).EQ.1 ) THEN + N = NMAX + RONE = ONE + RNAN = SQRT( -RONE ) + DO 330 JOBNUM = 1, 2 + IF( JOBNUM.EQ.1 ) THEN + JOBZ = 'V' + ELSE + JOBZ = 'N' + END IF + DO 320 J = 1, N + SD( J ) = DBLE( J ) + SE( J ) = ONE / DBLE( J+1 ) + 320 CONTINUE + SD( 1 ) = RNAN + SE( N ) = ZERO + VL = ZERO + VU = ZERO + IL = 0 + IU = 0 + TRYRAC = .TRUE. + CALL ZSTEMR( JOBZ, 'A', N, SD, SE, VL, VU, IL, IU, M, + $ WR, Z, LDU, N, IWORK( 1 ), TRYRAC, RWORK, + $ LRWORK, IWORK( 2*N+1 ), LIWORK-2*N, IINFO ) + IF( IINFO.LT.0 ) THEN + WRITE( NOUNIT, FMT = 9986 )JOBZ, IINFO + NERRS = NERRS + 1 + END IF + NTESTT = NTESTT + 1 + 330 CONTINUE + END IF * CALL DLASUM( 'ZST', NOUNIT, NERRS, NTESTT ) RETURN * + 9986 FORMAT( ' ZCHKST: ZSTEMR( ', A1, ', A ) on a matrix with a', + $ ' NaN returned INFO=', I6 ) 9982 FORMAT( ' ZCHKST: ZSTEDC( V ) with N=', I5, ' returned INFO=', $ I6 ) 9981 FORMAT( ' ZCHKST: ZSTEDC( V ) with N=', I5, ' overwrote ', I6,