zhbgvx.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 415 行 · 第 1/3 页
HTML
415 行
</span><span class="comment">*</span><span class="comment"> by reducing AP to tridiagonal form.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Eigenvalues will be computed most accurately when ABSTOL is
</span><span class="comment">*</span><span class="comment"> set to twice the underflow threshold 2*<a name="DLAMCH.124"></a><a href="dlamch.f.html#DLAMCH.1">DLAMCH</a>('S'), not zero.
</span><span class="comment">*</span><span class="comment"> If this routine returns with INFO>0, indicating that some
</span><span class="comment">*</span><span class="comment"> eigenvectors did not converge, try setting ABSTOL to
</span><span class="comment">*</span><span class="comment"> 2*<a name="DLAMCH.127"></a><a href="dlamch.f.html#DLAMCH.1">DLAMCH</a>('S').
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> M (output) INTEGER
</span><span class="comment">*</span><span class="comment"> The total number of eigenvalues found. 0 <= M <= N.
</span><span class="comment">*</span><span class="comment"> If RANGE = 'A', M = N, and if RANGE = 'I', M = IU-IL+1.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> W (output) DOUBLE PRECISION array, dimension (N)
</span><span class="comment">*</span><span class="comment"> If INFO = 0, the eigenvalues in ascending order.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Z (output) COMPLEX*16 array, dimension (LDZ, N)
</span><span class="comment">*</span><span class="comment"> If JOBZ = 'V', then if INFO = 0, Z contains the matrix Z of
</span><span class="comment">*</span><span class="comment"> eigenvectors, with the i-th column of Z holding the
</span><span class="comment">*</span><span class="comment"> eigenvector associated with W(i). The eigenvectors are
</span><span class="comment">*</span><span class="comment"> normalized so that Z**H*B*Z = I.
</span><span class="comment">*</span><span class="comment"> If JOBZ = 'N', then Z is not referenced.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> LDZ (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The leading dimension of the array Z. LDZ >= 1, and if
</span><span class="comment">*</span><span class="comment"> JOBZ = 'V', LDZ >= N.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> WORK (workspace) COMPLEX*16 array, dimension (N)
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> RWORK (workspace) DOUBLE PRECISION array, dimension (7*N)
</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: if INFO = i, and i is:
</span><span class="comment">*</span><span class="comment"> <= N: then i eigenvectors failed to converge. Their
</span><span class="comment">*</span><span class="comment"> indices are stored in array IFAIL.
</span><span class="comment">*</span><span class="comment"> > N: if INFO = N + i, for 1 <= i <= N, then <a name="ZPBSTF.165"></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> DOUBLE PRECISION ZERO
PARAMETER ( ZERO = 0.0D+0 )
COMPLEX*16 CZERO, CONE
PARAMETER ( CZERO = ( 0.0D+0, 0.0D+0 ),
$ CONE = ( 1.0D+0, 0.0D+0 ) )
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Local Scalars ..
</span> LOGICAL ALLEIG, INDEIG, TEST, UPPER, VALEIG, WANTZ
CHARACTER ORDER, VECT
INTEGER I, IINFO, INDD, INDE, INDEE, INDIBL, INDISP,
$ INDIWK, INDRWK, INDWRK, ITMP1, J, JJ, NSPLIT
DOUBLE PRECISION TMP1
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Functions ..
</span> LOGICAL <a name="LSAME.193"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
EXTERNAL <a name="LSAME.194"></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 DCOPY, <a name="DSTEBZ.197"></a><a href="dstebz.f.html#DSTEBZ.1">DSTEBZ</a>, <a name="DSTERF.197"></a><a href="dsterf.f.html#DSTERF.1">DSTERF</a>, <a name="XERBLA.197"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>, ZCOPY, ZGEMV,
$ <a name="ZHBGST.198"></a><a href="zhbgst.f.html#ZHBGST.1">ZHBGST</a>, <a name="ZHBTRD.198"></a><a href="zhbtrd.f.html#ZHBTRD.1">ZHBTRD</a>, <a name="ZLACPY.198"></a><a href="zlacpy.f.html#ZLACPY.1">ZLACPY</a>, <a name="ZPBSTF.198"></a><a href="zpbstf.f.html#ZPBSTF.1">ZPBSTF</a>, <a name="ZSTEIN.198"></a><a href="zstein.f.html#ZSTEIN.1">ZSTEIN</a>, <a name="ZSTEQR.198"></a><a href="zsteqr.f.html#ZSTEQR.1">ZSTEQR</a>,
$ ZSWAP
<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.208"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( JOBZ, <span class="string">'V'</span> )
UPPER = <a name="LSAME.209"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( UPLO, <span class="string">'U'</span> )
ALLEIG = <a name="LSAME.210"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( RANGE, <span class="string">'A'</span> )
VALEIG = <a name="LSAME.211"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( RANGE, <span class="string">'V'</span> )
INDEIG = <a name="LSAME.212"></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( .NOT.( WANTZ .OR. <a name="LSAME.215"></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.( UPPER .OR. <a name="LSAME.219"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( UPLO, <span class="string">'L'</span> ) ) ) THEN
INFO = -3
ELSE IF( N.LT.0 ) THEN
INFO = -4
ELSE IF( KA.LT.0 ) THEN
INFO = -5
ELSE IF( KB.LT.0 .OR. KB.GT.KA ) THEN
INFO = -6
ELSE IF( LDAB.LT.KA+1 ) THEN
INFO = -8
ELSE IF( LDBB.LT.KB+1 ) THEN
INFO = -10
ELSE IF( LDQ.LT.1 .OR. ( WANTZ .AND. LDQ.LT.N ) ) THEN
INFO = -12
ELSE
IF( VALEIG ) THEN
IF( N.GT.0 .AND. VU.LE.VL )
$ INFO = -14
ELSE IF( INDEIG ) THEN
IF( IL.LT.1 .OR. IL.GT.MAX( 1, N ) ) THEN
INFO = -15
ELSE IF ( IU.LT.MIN( N, IL ) .OR. IU.GT.N ) THEN
INFO = -16
END IF
END IF
END IF
IF( INFO.EQ.0) THEN
IF( LDZ.LT.1 .OR. ( WANTZ .AND. LDZ.LT.N ) ) THEN
INFO = -21
END IF
END IF
<span class="comment">*</span><span class="comment">
</span> IF( INFO.NE.0 ) THEN
CALL <a name="XERBLA.252"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="ZHBGVX.252"></a><a href="zhbgvx.f.html#ZHBGVX.1">ZHBGVX</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> M = 0
IF( N.EQ.0 )
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?