dsygvx.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 358 行 · 第 1/2 页
HTML
358 行
</span><span class="comment">*</span><span class="comment"> If JOBZ = 'V', then if INFO = 0, the first M elements of
</span><span class="comment">*</span><span class="comment"> IFAIL are zero. If INFO > 0, then IFAIL contains the
</span><span class="comment">*</span><span class="comment"> indices of the eigenvectors that failed to converge.
</span><span class="comment">*</span><span class="comment"> If JOBZ = 'N', then IFAIL is not referenced.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> INFO (output) INTEGER
</span><span class="comment">*</span><span class="comment"> = 0: successful exit
</span><span class="comment">*</span><span class="comment"> < 0: if INFO = -i, the i-th argument had an illegal value
</span><span class="comment">*</span><span class="comment"> > 0: <a name="DPOTRF.169"></a><a href="dpotrf.f.html#DPOTRF.1">DPOTRF</a> or <a name="DSYEVX.169"></a><a href="dsyevx.f.html#DSYEVX.1">DSYEVX</a> returned an error code:
</span><span class="comment">*</span><span class="comment"> <= N: if INFO = i, <a name="DSYEVX.170"></a><a href="dsyevx.f.html#DSYEVX.1">DSYEVX</a> failed to converge;
</span><span class="comment">*</span><span class="comment"> i eigenvectors failed to converge. Their indices
</span><span class="comment">*</span><span class="comment"> are stored in array IFAIL.
</span><span class="comment">*</span><span class="comment"> > N: if INFO = N + i, for 1 <= i <= N, then the leading
</span><span class="comment">*</span><span class="comment"> minor of order i of 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> DOUBLE PRECISION ONE
PARAMETER ( ONE = 1.0D+0 )
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Local Scalars ..
</span> LOGICAL ALLEIG, INDEIG, LQUERY, UPPER, VALEIG, WANTZ
CHARACTER TRANS
INTEGER LWKMIN, LWKOPT, NB
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Functions ..
</span> LOGICAL <a name="LSAME.196"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
INTEGER <a name="ILAENV.197"></a><a href="hfy-index.html#ILAENV">ILAENV</a>
EXTERNAL <a name="LSAME.198"></a><a href="lsame.f.html#LSAME.1">LSAME</a>, <a name="ILAENV.198"></a><a href="hfy-index.html#ILAENV">ILAENV</a>
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Subroutines ..
</span> EXTERNAL <a name="DPOTRF.201"></a><a href="dpotrf.f.html#DPOTRF.1">DPOTRF</a>, <a name="DSYEVX.201"></a><a href="dsyevx.f.html#DSYEVX.1">DSYEVX</a>, <a name="DSYGST.201"></a><a href="dsygst.f.html#DSYGST.1">DSYGST</a>, DTRMM, DTRSM, <a name="XERBLA.201"></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"> .. Intrinsic Functions ..
</span> INTRINSIC MAX, MIN
<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> UPPER = <a name="LSAME.210"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( UPLO, <span class="string">'U'</span> )
WANTZ = <a name="LSAME.211"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( JOBZ, <span class="string">'V'</span> )
ALLEIG = <a name="LSAME.212"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( RANGE, <span class="string">'A'</span> )
VALEIG = <a name="LSAME.213"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( RANGE, <span class="string">'V'</span> )
INDEIG = <a name="LSAME.214"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( RANGE, <span class="string">'I'</span> )
LQUERY = ( LWORK.EQ.-1 )
<span class="comment">*</span><span class="comment">
</span> INFO = 0
IF( ITYPE.LT.1 .OR. ITYPE.GT.3 ) THEN
INFO = -1
ELSE IF( .NOT.( WANTZ .OR. <a name="LSAME.220"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( JOBZ, <span class="string">'N'</span> ) ) ) THEN
INFO = -2
ELSE IF( .NOT.( ALLEIG .OR. VALEIG .OR. INDEIG ) ) THEN
INFO = -3
ELSE IF( .NOT.( UPPER .OR. <a name="LSAME.224"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( UPLO, <span class="string">'L'</span> ) ) ) THEN
INFO = -4
ELSE IF( N.LT.0 ) THEN
INFO = -5
ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
INFO = -7
ELSE IF( LDB.LT.MAX( 1, N ) ) THEN
INFO = -9
ELSE
IF( VALEIG ) THEN
IF( N.GT.0 .AND. VU.LE.VL )
$ INFO = -11
ELSE IF( INDEIG ) THEN
IF( IL.LT.1 .OR. IL.GT.MAX( 1, N ) ) THEN
INFO = -12
ELSE IF( IU.LT.MIN( N, IL ) .OR. IU.GT.N ) THEN
INFO = -13
END IF
END IF
END IF
IF (INFO.EQ.0) THEN
IF (LDZ.LT.1 .OR. (WANTZ .AND. LDZ.LT.N)) THEN
INFO = -18
END IF
END IF
<span class="comment">*</span><span class="comment">
</span> IF( INFO.EQ.0 ) THEN
LWKMIN = MAX( 1, 8*N )
NB = <a name="ILAENV.252"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="DSYTRD.252"></a><a href="dsytrd.f.html#DSYTRD.1">DSYTRD</a>'</span>, UPLO, N, -1, -1, -1 )
LWKOPT = MAX( LWKMIN, ( NB + 3 )*N )
WORK( 1 ) = LWKOPT
<span class="comment">*</span><span class="comment">
</span> IF( LWORK.LT.LWKMIN .AND. .NOT.LQUERY ) THEN
INFO = -20
END IF
END IF
<span class="comment">*</span><span class="comment">
</span> IF( INFO.NE.0 ) THEN
CALL <a name="XERBLA.262"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="DSYGVX.262"></a><a href="dsygvx.f.html#DSYGVX.1">DSYGVX</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
RETURN
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Form a Cholesky factorization of B.
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="DPOTRF.277"></a><a href="dpotrf.f.html#DPOTRF.1">DPOTRF</a>( UPLO, N, B, LDB, 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 and solve.
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="DSYGST.285"></a><a href="dsygst.f.html#DSYGST.1">DSYGST</a>( ITYPE, UPLO, N, A, LDA, B, LDB, INFO )
CALL <a name="DSYEVX.286"></a><a href="dsyevx.f.html#DSYEVX.1">DSYEVX</a>( JOBZ, RANGE, UPLO, N, A, LDA, VL, VU, IL, IU, ABSTOL,
$ M, W, Z, LDZ, WORK, LWORK, IWORK, IFAIL, INFO )
<span class="comment">*</span><span class="comment">
</span> IF( WANTZ ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Backtransform eigenvectors to the original problem.
</span><span class="comment">*</span><span class="comment">
</span> IF( INFO.GT.0 )
$ M = INFO - 1
IF( ITYPE.EQ.1 .OR. ITYPE.EQ.2 ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> For A*x=(lambda)*B*x and A*B*x=(lambda)*x;
</span><span class="comment">*</span><span class="comment"> backtransform eigenvectors: x = inv(L)'*y or inv(U)*y
</span><span class="comment">*</span><span class="comment">
</span> IF( UPPER ) THEN
TRANS = <span class="string">'N'</span>
ELSE
TRANS = <span class="string">'T'</span>
END IF
<span class="comment">*</span><span class="comment">
</span> CALL DTRSM( <span class="string">'Left'</span>, UPLO, TRANS, <span class="string">'Non-unit'</span>, N, M, ONE, B,
$ LDB, Z, LDZ )
<span class="comment">*</span><span class="comment">
</span> ELSE IF( ITYPE.EQ.3 ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> For B*A*x=(lambda)*x;
</span><span class="comment">*</span><span class="comment"> backtransform eigenvectors: x = L*y or U'*y
</span><span class="comment">*</span><span class="comment">
</span> IF( UPPER ) THEN
TRANS = <span class="string">'T'</span>
ELSE
TRANS = <span class="string">'N'</span>
END IF
<span class="comment">*</span><span class="comment">
</span> CALL DTRMM( <span class="string">'Left'</span>, UPLO, TRANS, <span class="string">'Non-unit'</span>, N, M, ONE, B,
$ LDB, Z, LDZ )
END IF
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Set WORK(1) to optimal workspace size.
</span><span class="comment">*</span><span class="comment">
</span> WORK( 1 ) = LWKOPT
<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="DSYGVX.331"></a><a href="dsygvx.f.html#DSYGVX.1">DSYGVX</a>
</span><span class="comment">*</span><span class="comment">
</span> END
</pre>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?