dsyevr.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 576 行 · 第 1/4 页
HTML
576 行
<span class="comment">*</span><span class="comment">
</span> LWMIN = MAX( 1, 26*N )
LIWMIN = MAX( 1, 10*N )
<span class="comment">*</span><span class="comment">
</span> INFO = 0
IF( .NOT.( WANTZ .OR. <a name="LSAME.275"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( JOBZ, <span class="string">'N'</span> ) ) ) THEN
INFO = -1
ELSE IF( .NOT.( ALLEIG .OR. VALEIG .OR. INDEIG ) ) THEN
INFO = -2
ELSE IF( .NOT.( LOWER .OR. <a name="LSAME.279"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( UPLO, <span class="string">'U'</span> ) ) ) THEN
INFO = -3
ELSE IF( N.LT.0 ) THEN
INFO = -4
ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
INFO = -6
ELSE
IF( VALEIG ) THEN
IF( N.GT.0 .AND. VU.LE.VL )
$ INFO = -8
ELSE IF( INDEIG ) THEN
IF( IL.LT.1 .OR. IL.GT.MAX( 1, N ) ) THEN
INFO = -9
ELSE IF( IU.LT.MIN( N, IL ) .OR. IU.GT.N ) THEN
INFO = -10
END IF
END IF
END IF
IF( INFO.EQ.0 ) THEN
IF( LDZ.LT.1 .OR. ( WANTZ .AND. LDZ.LT.N ) ) THEN
INFO = -15
ELSE IF( LWORK.LT.LWMIN .AND. .NOT.LQUERY ) THEN
INFO = -18
ELSE IF( LIWORK.LT.LIWMIN .AND. .NOT.LQUERY ) THEN
INFO = -20
END IF
END IF
<span class="comment">*</span><span class="comment">
</span> IF( INFO.EQ.0 ) THEN
NB = <a name="ILAENV.308"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="DSYTRD.308"></a><a href="dsytrd.f.html#DSYTRD.1">DSYTRD</a>'</span>, UPLO, N, -1, -1, -1 )
NB = MAX( NB, <a name="ILAENV.309"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="DORMTR.309"></a><a href="dormtr.f.html#DORMTR.1">DORMTR</a>'</span>, UPLO, N, -1, -1, -1 ) )
LWKOPT = MAX( ( NB+1 )*N, LWMIN )
WORK( 1 ) = LWKOPT
IWORK( 1 ) = LIWMIN
END IF
<span class="comment">*</span><span class="comment">
</span> IF( INFO.NE.0 ) THEN
CALL <a name="XERBLA.316"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="DSYEVR.316"></a><a href="dsyevr.f.html#DSYEVR.1">DSYEVR</a>'</span>, -INFO )
RETURN
ELSE IF( LQUERY ) THEN
RETURN
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Quick return if possible
</span><span class="comment">*</span><span class="comment">
</span> M = 0
IF( N.EQ.0 ) THEN
WORK( 1 ) = 1
RETURN
END IF
<span class="comment">*</span><span class="comment">
</span> IF( N.EQ.1 ) THEN
WORK( 1 ) = 7
IF( ALLEIG .OR. INDEIG ) THEN
M = 1
W( 1 ) = A( 1, 1 )
ELSE
IF( VL.LT.A( 1, 1 ) .AND. VU.GE.A( 1, 1 ) ) THEN
M = 1
W( 1 ) = A( 1, 1 )
END IF
END IF
IF( WANTZ )
$ Z( 1, 1 ) = ONE
RETURN
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Get machine constants.
</span><span class="comment">*</span><span class="comment">
</span> SAFMIN = <a name="DLAMCH.348"></a><a href="dlamch.f.html#DLAMCH.1">DLAMCH</a>( <span class="string">'Safe minimum'</span> )
EPS = <a name="DLAMCH.349"></a><a href="dlamch.f.html#DLAMCH.1">DLAMCH</a>( <span class="string">'Precision'</span> )
SMLNUM = SAFMIN / EPS
BIGNUM = ONE / SMLNUM
RMIN = SQRT( SMLNUM )
RMAX = MIN( SQRT( BIGNUM ), ONE / SQRT( SQRT( SAFMIN ) ) )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Scale matrix to allowable range, if necessary.
</span><span class="comment">*</span><span class="comment">
</span> ISCALE = 0
ABSTLL = ABSTOL
VLL = VL
VUU = VU
ANRM = <a name="DLANSY.361"></a><a href="dlansy.f.html#DLANSY.1">DLANSY</a>( <span class="string">'M'</span>, UPLO, N, A, LDA, WORK )
IF( ANRM.GT.ZERO .AND. ANRM.LT.RMIN ) THEN
ISCALE = 1
SIGMA = RMIN / ANRM
ELSE IF( ANRM.GT.RMAX ) THEN
ISCALE = 1
SIGMA = RMAX / ANRM
END IF
IF( ISCALE.EQ.1 ) THEN
IF( LOWER ) THEN
DO 10 J = 1, N
CALL DSCAL( N-J+1, SIGMA, A( J, J ), 1 )
10 CONTINUE
ELSE
DO 20 J = 1, N
CALL DSCAL( J, SIGMA, A( 1, J ), 1 )
20 CONTINUE
END IF
IF( ABSTOL.GT.0 )
$ ABSTLL = ABSTOL*SIGMA
IF( VALEIG ) THEN
VLL = VL*SIGMA
VUU = VU*SIGMA
END IF
END IF
<span class="comment">*</span><span class="comment"> Initialize indices into workspaces. Note: The IWORK indices are
</span><span class="comment">*</span><span class="comment"> used only if <a name="DSTERF.388"></a><a href="dsterf.f.html#DSTERF.1">DSTERF</a> or <a name="DSTEMR.388"></a><a href="dstemr.f.html#DSTEMR.1">DSTEMR</a> fail.
</span>
<span class="comment">*</span><span class="comment"> WORK(INDTAU:INDTAU+N-1) stores the scalar factors of the
</span><span class="comment">*</span><span class="comment"> elementary reflectors used in <a name="DSYTRD.391"></a><a href="dsytrd.f.html#DSYTRD.1">DSYTRD</a>.
</span> INDTAU = 1
<span class="comment">*</span><span class="comment"> WORK(INDD:INDD+N-1) stores the tridiagonal's diagonal entries.
</span> INDD = INDTAU + N
<span class="comment">*</span><span class="comment"> WORK(INDE:INDE+N-1) stores the off-diagonal entries of the
</span><span class="comment">*</span><span class="comment"> tridiagonal matrix from <a name="DSYTRD.396"></a><a href="dsytrd.f.html#DSYTRD.1">DSYTRD</a>.
</span> INDE = INDD + N
<span class="comment">*</span><span class="comment"> WORK(INDDD:INDDD+N-1) is a copy of the diagonal entries over
</span><span class="comment">*</span><span class="comment"> -written by <a name="DSTEMR.399"></a><a href="dstemr.f.html#DSTEMR.1">DSTEMR</a> (the <a name="DSTERF.399"></a><a href="dsterf.f.html#DSTERF.1">DSTERF</a> path copies the diagonal to W).
</span> INDDD = INDE + N
<span class="comment">*</span><span class="comment"> WORK(INDEE:INDEE+N-1) is a copy of the off-diagonal entries over
</span><span class="comment">*</span><span class="comment"> -written while computing the eigenvalues in <a name="DSTERF.402"></a><a href="dsterf.f.html#DSTERF.1">DSTERF</a> and <a name="DSTEMR.402"></a><a href="dstemr.f.html#DSTEMR.1">DSTEMR</a>.
</span> INDEE = INDDD + N
<span class="comment">*</span><span class="comment"> INDWK is the starting offset of the left-over workspace, and
</span><span class="comment">*</span><span class="comment"> LLWORK is the remaining workspace size.
</span> INDWK = INDEE + N
LLWORK = LWORK - INDWK + 1
<span class="comment">*</span><span class="comment"> IWORK(INDIBL:INDIBL+M-1) corresponds to IBLOCK in <a name="DSTEBZ.409"></a><a href="dstebz.f.html#DSTEBZ.1">DSTEBZ</a> and
</span><span class="comment">*</span><span class="comment"> stores the block indices of each of the M<=N eigenvalues.
</span> INDIBL = 1
<span class="comment">*</span><span class="comment"> IWORK(INDISP:INDISP+NSPLIT-1) corresponds to ISPLIT in <a name="DSTEBZ.412"></a><a href="dstebz.f.html#DSTEBZ.1">DSTEBZ</a> and
</span><span class="comment">*</span><span class="comment"> stores the starting and finishing indices of each block.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?