cheevr.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 613 行 · 第 1/4 页
HTML
613 行
</span> LRWMIN = MAX( 1, 24*N )
LIWMIN = MAX( 1, 10*N )
LWMIN = MAX( 1, 2*N )
<span class="comment">*</span><span class="comment">
</span> INFO = 0
IF( .NOT.( WANTZ .OR. <a name="LSAME.295"></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.299"></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
END IF
END IF
<span class="comment">*</span><span class="comment">
</span> IF( INFO.EQ.0 ) THEN
NB = <a name="ILAENV.324"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="CHETRD.324"></a><a href="chetrd.f.html#CHETRD.1">CHETRD</a>'</span>, UPLO, N, -1, -1, -1 )
NB = MAX( NB, <a name="ILAENV.325"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="CUNMTR.325"></a><a href="cunmtr.f.html#CUNMTR.1">CUNMTR</a>'</span>, UPLO, N, -1, -1, -1 ) )
LWKOPT = MAX( ( NB+1 )*N, LWMIN )
WORK( 1 ) = LWKOPT
RWORK( 1 ) = LRWMIN
IWORK( 1 ) = LIWMIN
<span class="comment">*</span><span class="comment">
</span> IF( LWORK.LT.LWMIN .AND. .NOT.LQUERY ) THEN
INFO = -18
ELSE IF( LRWORK.LT.LRWMIN .AND. .NOT.LQUERY ) THEN
INFO = -20
ELSE IF( LIWORK.LT.LIWMIN .AND. .NOT.LQUERY ) THEN
INFO = -22
END IF
END IF
<span class="comment">*</span><span class="comment">
</span> IF( INFO.NE.0 ) THEN
CALL <a name="XERBLA.341"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="CHEEVR.341"></a><a href="cheevr.f.html#CHEEVR.1">CHEEVR</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 ) = 2
IF( ALLEIG .OR. INDEIG ) THEN
M = 1
W( 1 ) = REAL( A( 1, 1 ) )
ELSE
IF( VL.LT.REAL( A( 1, 1 ) ) .AND. VU.GE.REAL( A( 1, 1 ) ) )
$ THEN
M = 1
W( 1 ) = REAL( 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="SLAMCH.374"></a><a href="slamch.f.html#SLAMCH.1">SLAMCH</a>( <span class="string">'Safe minimum'</span> )
EPS = <a name="SLAMCH.375"></a><a href="slamch.f.html#SLAMCH.1">SLAMCH</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
IF (VALEIG) THEN
VLL = VL
VUU = VU
END IF
ANRM = <a name="CLANSY.389"></a><a href="clansy.f.html#CLANSY.1">CLANSY</a>( <span class="string">'M'</span>, UPLO, N, A, LDA, RWORK )
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 CSSCAL( N-J+1, SIGMA, A( J, J ), 1 )
10 CONTINUE
ELSE
DO 20 J = 1, N
CALL CSSCAL( 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="SSTERF.416"></a><a href="ssterf.f.html#SSTERF.1">SSTERF</a> or <a name="CSTEMR.416"></a><a href="cstemr.f.html#CSTEMR.1">CSTEMR</a> fail.
</span>
<span class="comment">*</span><span class="comment"> WORK(INDTAU:INDTAU+N-1) stores the complex scalar factors of the
</span><span class="comment">*</span><span class="comment"> elementary reflectors used in <a name="CHETRD.419"></a><a href="chetrd.f.html#CHETRD.1">CHETRD</a>.
</span> INDTAU = 1
<span class="comment">*</span><span class="comment"> INDWK is the starting offset of the remaining complex workspace,
</span><span class="comment">*</span><span class="comment"> and LLWORK is the remaining complex workspace size.
</span> INDWK = INDTAU + N
LLWORK = LWORK - INDWK + 1
<span class="comment">*</span><span class="comment"> RWORK(INDRD:INDRD+N-1) stores the real tridiagonal's diagonal
</span><span class="comment">*</span><span class="comment"> entries.
</span> INDRD = 1
<span class="comment">*</span><span class="comment"> RWORK(INDRE:INDRE+N-1) stores the off-diagonal entries of the
</span><span class="comment">*</span><span class="comment"> tridiagonal matrix from <a name="CHETRD.430"></a><a href="chetrd.f.html#CHETRD.1">CHETRD</a>.
</span> INDRE = INDRD + N
<span class="comment">*</span><span class="comment"> RWORK(INDRDD:INDRDD+N-1) is a copy of the diagonal entries over
</span><span class="comment">*</span><span class="comment"> -written by <a name="CSTEMR.433"></a><a href="cstemr.f.html#CSTEMR.1">CSTEMR</a> (the <a name="SSTERF.433"></a><a href="ssterf.f.html#SSTERF.1">SSTERF</a> path copies the diagonal to W).
</span> INDRDD = INDRE + N
<span class="comment">*</span><span class="comment"> RWORK(INDREE:INDREE+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="SSTERF.436"></a><a href="ssterf.f.html#SSTERF.1">SSTERF</a> and <a name="CSTEMR.436"></a><a href="cstemr.f.html#CSTEMR.1">CSTEMR</a>.
</span> INDREE = INDRDD + N
<span class="comment">*</span><span class="comment"> INDRWK is the starting offset of the left-over real workspace, and
</span><span class="comment">*</span><span class="comment"> LLRWORK is the remaining workspace size.
</span> INDRWK = INDREE + N
LLRWORK = LRWORK - INDRWK + 1
<span class="comment">*</span><span class="comment"> IWORK(INDIBL:INDIBL+M-1) corresponds to IBLOCK in <a name="SSTEBZ.443"></a><a href="sstebz.f.html#SSTEBZ.1">SSTEBZ</a> and
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?