zhpgvx.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 318 行 · 第 1/2 页
HTML
318 行
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> IWORK (workspace) INTEGER array, dimension (5*N)
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> IFAIL (output) INTEGER array, dimension (N)
</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="ZPPTRF.153"></a><a href="zpptrf.f.html#ZPPTRF.1">ZPPTRF</a> or <a name="ZHPEVX.153"></a><a href="zhpevx.f.html#ZHPEVX.1">ZHPEVX</a> returned an error code:
</span><span class="comment">*</span><span class="comment"> <= N: if INFO = i, <a name="ZHPEVX.154"></a><a href="zhpevx.f.html#ZHPEVX.1">ZHPEVX</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"> .. Local Scalars ..
</span> LOGICAL ALLEIG, INDEIG, UPPER, VALEIG, WANTZ
CHARACTER TRANS
INTEGER J
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Functions ..
</span> LOGICAL <a name="LSAME.176"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
EXTERNAL <a name="LSAME.177"></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 <a name="XERBLA.180"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>, <a name="ZHPEVX.180"></a><a href="zhpevx.f.html#ZHPEVX.1">ZHPEVX</a>, <a name="ZHPGST.180"></a><a href="zhpgst.f.html#ZHPGST.1">ZHPGST</a>, <a name="ZPPTRF.180"></a><a href="zpptrf.f.html#ZPPTRF.1">ZPPTRF</a>, ZTPMV, ZTPSV
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Intrinsic Functions ..
</span> INTRINSIC 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> WANTZ = <a name="LSAME.189"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( JOBZ, <span class="string">'V'</span> )
UPPER = <a name="LSAME.190"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( UPLO, <span class="string">'U'</span> )
ALLEIG = <a name="LSAME.191"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( RANGE, <span class="string">'A'</span> )
VALEIG = <a name="LSAME.192"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( RANGE, <span class="string">'V'</span> )
INDEIG = <a name="LSAME.193"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( RANGE, <span class="string">'I'</span> )
<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.198"></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.202"></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( VALEIG ) THEN
IF( N.GT.0 .AND. VU.LE.VL ) THEN
INFO = -9
END IF
ELSE IF( INDEIG ) THEN
IF( IL.LT.1 ) THEN
INFO = -10
ELSE IF( IU.LT.MIN( N, IL ) .OR. IU.GT.N ) THEN
INFO = -11
END IF
END IF
END IF
IF( INFO.EQ.0 ) THEN
IF( LDZ.LT.1 .OR. ( WANTZ .AND. LDZ.LT.N ) ) THEN
INFO = -16
END IF
END IF
<span class="comment">*</span><span class="comment">
</span> IF( INFO.NE.0 ) THEN
CALL <a name="XERBLA.226"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="ZHPGVX.226"></a><a href="zhpgvx.f.html#ZHPGVX.1">ZHPGVX</a>'</span>, -INFO )
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 Cholesky factorization of B.
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="ZPPTRF.237"></a><a href="zpptrf.f.html#ZPPTRF.1">ZPPTRF</a>( UPLO, N, BP, 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="ZHPGST.245"></a><a href="zhpgst.f.html#ZHPGST.1">ZHPGST</a>( ITYPE, UPLO, N, AP, BP, INFO )
CALL <a name="ZHPEVX.246"></a><a href="zhpevx.f.html#ZHPEVX.1">ZHPEVX</a>( JOBZ, RANGE, UPLO, N, AP, VL, VU, IL, IU, ABSTOL, M,
$ W, Z, LDZ, WORK, RWORK, 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">'C'</span>
END IF
<span class="comment">*</span><span class="comment">
</span> DO 10 J = 1, M
CALL ZTPSV( UPLO, TRANS, <span class="string">'Non-unit'</span>, N, BP, Z( 1, J ),
$ 1 )
10 CONTINUE
<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">'C'</span>
ELSE
TRANS = <span class="string">'N'</span>
END IF
<span class="comment">*</span><span class="comment">
</span> DO 20 J = 1, M
CALL ZTPMV( UPLO, TRANS, <span class="string">'Non-unit'</span>, N, BP, Z( 1, J ),
$ 1 )
20 CONTINUE
END IF
END IF
<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="ZHPGVX.291"></a><a href="zhpgvx.f.html#ZHPGVX.1">ZHPGVX</a>
</span><span class="comment">*</span><span class="comment">
</span> END
</pre>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?