zhbgvd.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 322 行 · 第 1/2 页
HTML
322 行
</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: if INFO = i, and i is:
</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="ZPBSTF.151"></a><a href="zpbstf.f.html#ZPBSTF.1">ZPBSTF</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> COMPLEX*16 CONE, CZERO
PARAMETER ( CONE = ( 1.0D+0, 0.0D+0 ),
$ CZERO = ( 0.0D+0, 0.0D+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, LLRWK,
$ LLWK2, LRWMIN, LWMIN
<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="DSTERF.180"></a><a href="dsterf.f.html#DSTERF.1">DSTERF</a>, <a name="XERBLA.180"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>, ZGEMM, <a name="ZHBGST.180"></a><a href="zhbgst.f.html#ZHBGST.1">ZHBGST</a>, <a name="ZHBTRD.180"></a><a href="zhbtrd.f.html#ZHBTRD.1">ZHBTRD</a>, <a name="ZLACPY.180"></a><a href="zlacpy.f.html#ZLACPY.1">ZLACPY</a>,
$ <a name="ZPBSTF.181"></a><a href="zpbstf.f.html#ZPBSTF.1">ZPBSTF</a>, <a name="ZSTEDC.181"></a><a href="zstedc.f.html#ZSTEDC.1">ZSTEDC</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.187"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( JOBZ, <span class="string">'V'</span> )
UPPER = <a name="LSAME.188"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( UPLO, <span class="string">'U'</span> )
LQUERY = ( LWORK.EQ.-1 .OR. LRWORK.EQ.-1 .OR. LIWORK.EQ.-1 )
<span class="comment">*</span><span class="comment">
</span> INFO = 0
IF( N.LE.1 ) THEN
LWMIN = 1
LRWMIN = 1
LIWMIN = 1
ELSE IF( WANTZ ) THEN
LWMIN = 2*N**2
LRWMIN = 1 + 5*N + 2*N**2
LIWMIN = 3 + 5*N
ELSE
LWMIN = N
LRWMIN = N
LIWMIN = 1
END IF
IF( .NOT.( WANTZ .OR. <a name="LSAME.205"></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.207"></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
RWORK( 1 ) = LRWMIN
IWORK( 1 ) = LIWMIN
<span class="comment">*</span><span class="comment">
</span> IF( LWORK.LT.LWMIN .AND. .NOT.LQUERY ) THEN
INFO = -14
ELSE IF( LRWORK.LT.LRWMIN .AND. .NOT.LQUERY ) THEN
INFO = -16
ELSE IF( LIWORK.LT.LIWMIN .AND. .NOT.LQUERY ) THEN
INFO = -18
END IF
END IF
<span class="comment">*</span><span class="comment">
</span> IF( INFO.NE.0 ) THEN
CALL <a name="XERBLA.238"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="ZHBGVD.238"></a><a href="zhbgvd.f.html#ZHBGVD.1">ZHBGVD</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="ZPBSTF.251"></a><a href="zpbstf.f.html#ZPBSTF.1">ZPBSTF</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 = 1 + N*N
LLWK2 = LWORK - INDWK2 + 2
LLRWK = LRWORK - INDWRK + 2
CALL <a name="ZHBGST.264"></a><a href="zhbgst.f.html#ZHBGST.1">ZHBGST</a>( JOBZ, UPLO, N, KA, KB, AB, LDAB, BB, LDBB, Z, LDZ,
$ WORK, RWORK( INDWRK ), IINFO )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Reduce Hermitian band matrix 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="ZHBTRD.274"></a><a href="zhbtrd.f.html#ZHBTRD.1">ZHBTRD</a>( VECT, UPLO, N, KA, AB, LDAB, W, RWORK( INDE ), Z,
$ LDZ, WORK, IINFO )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> For eigenvalues only, call <a name="DSTERF.277"></a><a href="dsterf.f.html#DSTERF.1">DSTERF</a>. For eigenvectors, call <a name="ZSTEDC.277"></a><a href="zstedc.f.html#ZSTEDC.1">ZSTEDC</a>.
</span><span class="comment">*</span><span class="comment">
</span> IF( .NOT.WANTZ ) THEN
CALL <a name="DSTERF.280"></a><a href="dsterf.f.html#DSTERF.1">DSTERF</a>( N, W, RWORK( INDE ), INFO )
ELSE
CALL <a name="ZSTEDC.282"></a><a href="zstedc.f.html#ZSTEDC.1">ZSTEDC</a>( <span class="string">'I'</span>, N, W, RWORK( INDE ), WORK, N, WORK( INDWK2 ),
$ LLWK2, RWORK( INDWRK ), LLRWK, IWORK, LIWORK,
$ INFO )
CALL ZGEMM( <span class="string">'N'</span>, <span class="string">'N'</span>, N, N, N, CONE, Z, LDZ, WORK, N, CZERO,
$ WORK( INDWK2 ), N )
CALL <a name="ZLACPY.287"></a><a href="zlacpy.f.html#ZLACPY.1">ZLACPY</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
RWORK( 1 ) = LRWMIN
IWORK( 1 ) = LIWMIN
RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> End of <a name="ZHBGVD.295"></a><a href="zhbgvd.f.html#ZHBGVD.1">ZHBGVD</a>
</span><span class="comment">*</span><span class="comment">
</span> END
</pre>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?