ssbgvd.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 296 行 · 第 1/2 页
HTML
296 行
</span><span class="comment">*</span><span class="comment"> <= N: the algorithm failed to converge:
</span><span class="comment">*</span><span class="comment"> i off-diagonal elements of an intermediate
</span><span class="comment">*</span><span class="comment"> tridiagonal form did not converge to zero;
</span><span class="comment">*</span><span class="comment"> > N: if INFO = N + i, for 1 <= i <= N, then <a name="SPBSTF.133"></a><a href="spbstf.f.html#SPBSTF.1">SPBSTF</a>
</span><span class="comment">*</span><span class="comment"> returned INFO = i: B is not positive definite.
</span><span class="comment">*</span><span class="comment"> The factorization of B could not be completed and
</span><span class="comment">*</span><span class="comment"> no eigenvalues or eigenvectors were computed.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Further Details
</span><span class="comment">*</span><span class="comment"> ===============
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Based on contributions by
</span><span class="comment">*</span><span class="comment"> Mark Fahey, Department of Mathematics, Univ. of Kentucky, USA
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> =====================================================================
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> .. Parameters ..
</span> REAL ONE, ZERO
PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 )
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Local Scalars ..
</span> LOGICAL LQUERY, UPPER, WANTZ
CHARACTER VECT
INTEGER IINFO, INDE, INDWK2, INDWRK, LIWMIN, LLWRK2,
$ LWMIN
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Functions ..
</span> LOGICAL <a name="LSAME.157"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
EXTERNAL <a name="LSAME.158"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Subroutines ..
</span> EXTERNAL SGEMM, <a name="SLACPY.161"></a><a href="slacpy.f.html#SLACPY.1">SLACPY</a>, <a name="SPBSTF.161"></a><a href="spbstf.f.html#SPBSTF.1">SPBSTF</a>, <a name="SSBGST.161"></a><a href="ssbgst.f.html#SSBGST.1">SSBGST</a>, <a name="SSBTRD.161"></a><a href="ssbtrd.f.html#SSBTRD.1">SSBTRD</a>, <a name="SSTEDC.161"></a><a href="sstedc.f.html#SSTEDC.1">SSTEDC</a>,
$ <a name="SSTERF.162"></a><a href="ssterf.f.html#SSTERF.1">SSTERF</a>, <a name="XERBLA.162"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Executable Statements ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Test the input parameters.
</span><span class="comment">*</span><span class="comment">
</span> WANTZ = <a name="LSAME.168"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( JOBZ, <span class="string">'V'</span> )
UPPER = <a name="LSAME.169"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( UPLO, <span class="string">'U'</span> )
LQUERY = ( LWORK.EQ.-1 .OR. LIWORK.EQ.-1 )
<span class="comment">*</span><span class="comment">
</span> INFO = 0
IF( N.LE.1 ) THEN
LIWMIN = 1
LWMIN = 1
ELSE IF( WANTZ ) THEN
LIWMIN = 3 + 5*N
LWMIN = 1 + 5*N + 2*N**2
ELSE
LIWMIN = 1
LWMIN = 2*N
END IF
<span class="comment">*</span><span class="comment">
</span> IF( .NOT.( WANTZ .OR. <a name="LSAME.184"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( JOBZ, <span class="string">'N'</span> ) ) ) THEN
INFO = -1
ELSE IF( .NOT.( UPPER .OR. <a name="LSAME.186"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( UPLO, <span class="string">'L'</span> ) ) ) THEN
INFO = -2
ELSE IF( N.LT.0 ) THEN
INFO = -3
ELSE IF( KA.LT.0 ) THEN
INFO = -4
ELSE IF( KB.LT.0 .OR. KB.GT.KA ) THEN
INFO = -5
ELSE IF( LDAB.LT.KA+1 ) THEN
INFO = -7
ELSE IF( LDBB.LT.KB+1 ) THEN
INFO = -9
ELSE IF( LDZ.LT.1 .OR. ( WANTZ .AND. LDZ.LT.N ) ) THEN
INFO = -12
END IF
<span class="comment">*</span><span class="comment">
</span> IF( INFO.EQ.0 ) THEN
WORK( 1 ) = LWMIN
IWORK( 1 ) = LIWMIN
<span class="comment">*</span><span class="comment">
</span> IF( LWORK.LT.LWMIN .AND. .NOT.LQUERY ) THEN
INFO = -14
ELSE IF( LIWORK.LT.LIWMIN .AND. .NOT.LQUERY ) THEN
INFO = -16
END IF
END IF
<span class="comment">*</span><span class="comment">
</span> IF( INFO.NE.0 ) THEN
CALL <a name="XERBLA.214"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="SSBGVD.214"></a><a href="ssbgvd.f.html#SSBGVD.1">SSBGVD</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> IF( N.EQ.0 )
$ RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Form a split Cholesky factorization of B.
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="SPBSTF.227"></a><a href="spbstf.f.html#SPBSTF.1">SPBSTF</a>( UPLO, N, KB, BB, LDBB, INFO )
IF( INFO.NE.0 ) THEN
INFO = N + INFO
RETURN
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Transform problem to standard eigenvalue problem.
</span><span class="comment">*</span><span class="comment">
</span> INDE = 1
INDWRK = INDE + N
INDWK2 = INDWRK + N*N
LLWRK2 = LWORK - INDWK2 + 1
CALL <a name="SSBGST.239"></a><a href="ssbgst.f.html#SSBGST.1">SSBGST</a>( JOBZ, UPLO, N, KA, KB, AB, LDAB, BB, LDBB, Z, LDZ,
$ WORK( INDWRK ), IINFO )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Reduce to tridiagonal form.
</span><span class="comment">*</span><span class="comment">
</span> IF( WANTZ ) THEN
VECT = <span class="string">'U'</span>
ELSE
VECT = <span class="string">'N'</span>
END IF
CALL <a name="SSBTRD.249"></a><a href="ssbtrd.f.html#SSBTRD.1">SSBTRD</a>( VECT, UPLO, N, KA, AB, LDAB, W, WORK( INDE ), Z, LDZ,
$ WORK( INDWRK ), IINFO )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> For eigenvalues only, call <a name="SSTERF.252"></a><a href="ssterf.f.html#SSTERF.1">SSTERF</a>. For eigenvectors, call <a name="SSTEDC.252"></a><a href="sstedc.f.html#SSTEDC.1">SSTEDC</a>.
</span><span class="comment">*</span><span class="comment">
</span> IF( .NOT.WANTZ ) THEN
CALL <a name="SSTERF.255"></a><a href="ssterf.f.html#SSTERF.1">SSTERF</a>( N, W, WORK( INDE ), INFO )
ELSE
CALL <a name="SSTEDC.257"></a><a href="sstedc.f.html#SSTEDC.1">SSTEDC</a>( <span class="string">'I'</span>, N, W, WORK( INDE ), WORK( INDWRK ), N,
$ WORK( INDWK2 ), LLWRK2, IWORK, LIWORK, INFO )
CALL SGEMM( <span class="string">'N'</span>, <span class="string">'N'</span>, N, N, N, ONE, Z, LDZ, WORK( INDWRK ), N,
$ ZERO, WORK( INDWK2 ), N )
CALL <a name="SLACPY.261"></a><a href="slacpy.f.html#SLACPY.1">SLACPY</a>( <span class="string">'A'</span>, N, N, WORK( INDWK2 ), N, Z, LDZ )
END IF
<span class="comment">*</span><span class="comment">
</span> WORK( 1 ) = LWMIN
IWORK( 1 ) = LIWMIN
<span class="comment">*</span><span class="comment">
</span> RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> End of <a name="SSBGVD.269"></a><a href="ssbgvd.f.html#SSBGVD.1">SSBGVD</a>
</span><span class="comment">*</span><span class="comment">
</span> END
</pre>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?