sgges.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 583 行 · 第 1/3 页
HTML
583 行
</span><span class="comment">*</span><span class="comment"> > N: =N+1: other than QZ iteration failed in <a name="SHGEQZ.177"></a><a href="shgeqz.f.html#SHGEQZ.1">SHGEQZ</a>.
</span><span class="comment">*</span><span class="comment"> =N+2: after reordering, roundoff changed values of
</span><span class="comment">*</span><span class="comment"> some complex eigenvalues so that leading
</span><span class="comment">*</span><span class="comment"> eigenvalues in the Generalized Schur form no
</span><span class="comment">*</span><span class="comment"> longer satisfy SELCTG=.TRUE. This could also
</span><span class="comment">*</span><span class="comment"> be caused due to scaling.
</span><span class="comment">*</span><span class="comment"> =N+3: reordering failed in <a name="STGSEN.183"></a><a href="stgsen.f.html#STGSEN.1">STGSEN</a>.
</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 ZERO, ONE
PARAMETER ( ZERO = 0.0E+0, ONE = 1.0E+0 )
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Local Scalars ..
</span> LOGICAL CURSL, ILASCL, ILBSCL, ILVSL, ILVSR, LASTSL,
$ LQUERY, LST2SL, WANTST
INTEGER I, ICOLS, IERR, IHI, IJOBVL, IJOBVR, ILEFT,
$ ILO, IP, IRIGHT, IROWS, ITAU, IWRK, MAXWRK,
$ MINWRK
REAL ANRM, ANRMTO, BIGNUM, BNRM, BNRMTO, EPS, PVSL,
$ PVSR, SAFMAX, SAFMIN, SMLNUM
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Local Arrays ..
</span> INTEGER IDUM( 1 )
REAL DIF( 2 )
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Subroutines ..
</span> EXTERNAL <a name="SGEQRF.205"></a><a href="sgeqrf.f.html#SGEQRF.1">SGEQRF</a>, <a name="SGGBAK.205"></a><a href="sggbak.f.html#SGGBAK.1">SGGBAK</a>, <a name="SGGBAL.205"></a><a href="sggbal.f.html#SGGBAL.1">SGGBAL</a>, <a name="SGGHRD.205"></a><a href="sgghrd.f.html#SGGHRD.1">SGGHRD</a>, <a name="SHGEQZ.205"></a><a href="shgeqz.f.html#SHGEQZ.1">SHGEQZ</a>, <a name="SLABAD.205"></a><a href="slabad.f.html#SLABAD.1">SLABAD</a>,
$ <a name="SLACPY.206"></a><a href="slacpy.f.html#SLACPY.1">SLACPY</a>, <a name="SLASCL.206"></a><a href="slascl.f.html#SLASCL.1">SLASCL</a>, <a name="SLASET.206"></a><a href="slaset.f.html#SLASET.1">SLASET</a>, <a name="SORGQR.206"></a><a href="sorgqr.f.html#SORGQR.1">SORGQR</a>, <a name="SORMQR.206"></a><a href="sormqr.f.html#SORMQR.1">SORMQR</a>, <a name="STGSEN.206"></a><a href="stgsen.f.html#STGSEN.1">STGSEN</a>,
$ <a name="XERBLA.207"></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"> .. External Functions ..
</span> LOGICAL <a name="LSAME.210"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
INTEGER <a name="ILAENV.211"></a><a href="hfy-index.html#ILAENV">ILAENV</a>
REAL <a name="SLAMCH.212"></a><a href="slamch.f.html#SLAMCH.1">SLAMCH</a>, <a name="SLANGE.212"></a><a href="slange.f.html#SLANGE.1">SLANGE</a>
EXTERNAL <a name="LSAME.213"></a><a href="lsame.f.html#LSAME.1">LSAME</a>, <a name="ILAENV.213"></a><a href="hfy-index.html#ILAENV">ILAENV</a>, <a name="SLAMCH.213"></a><a href="slamch.f.html#SLAMCH.1">SLAMCH</a>, <a name="SLANGE.213"></a><a href="slange.f.html#SLANGE.1">SLANGE</a>
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Intrinsic Functions ..
</span> INTRINSIC ABS, MAX, SQRT
<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"> Decode the input arguments
</span><span class="comment">*</span><span class="comment">
</span> IF( <a name="LSAME.222"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( JOBVSL, <span class="string">'N'</span> ) ) THEN
IJOBVL = 1
ILVSL = .FALSE.
ELSE IF( <a name="LSAME.225"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( JOBVSL, <span class="string">'V'</span> ) ) THEN
IJOBVL = 2
ILVSL = .TRUE.
ELSE
IJOBVL = -1
ILVSL = .FALSE.
END IF
<span class="comment">*</span><span class="comment">
</span> IF( <a name="LSAME.233"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( JOBVSR, <span class="string">'N'</span> ) ) THEN
IJOBVR = 1
ILVSR = .FALSE.
ELSE IF( <a name="LSAME.236"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( JOBVSR, <span class="string">'V'</span> ) ) THEN
IJOBVR = 2
ILVSR = .TRUE.
ELSE
IJOBVR = -1
ILVSR = .FALSE.
END IF
<span class="comment">*</span><span class="comment">
</span> WANTST = <a name="LSAME.244"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( SORT, <span class="string">'S'</span> )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Test the input arguments
</span><span class="comment">*</span><span class="comment">
</span> INFO = 0
LQUERY = ( LWORK.EQ.-1 )
IF( IJOBVL.LE.0 ) THEN
INFO = -1
ELSE IF( IJOBVR.LE.0 ) THEN
INFO = -2
ELSE IF( ( .NOT.WANTST ) .AND. ( .NOT.<a name="LSAME.254"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( SORT, <span class="string">'N'</span> ) ) ) THEN
INFO = -3
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( LDVSL.LT.1 .OR. ( ILVSL .AND. LDVSL.LT.N ) ) THEN
INFO = -15
ELSE IF( LDVSR.LT.1 .OR. ( ILVSR .AND. LDVSR.LT.N ) ) THEN
INFO = -17
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Compute workspace
</span><span class="comment">*</span><span class="comment"> (Note: Comments in the code beginning "Workspace:" describe the
</span><span class="comment">*</span><span class="comment"> minimal amount of workspace needed at that point in the code,
</span><span class="comment">*</span><span class="comment"> as well as the preferred amount for good performance.
</span><span class="comment">*</span><span class="comment"> NB refers to the optimal block size for the immediately
</span><span class="comment">*</span><span class="comment"> following subroutine, as returned by <a name="ILAENV.273"></a><a href="hfy-index.html#ILAENV">ILAENV</a>.)
</span><span class="comment">*</span><span class="comment">
</span> IF( INFO.EQ.0 ) THEN
IF( N.GT.0 )THEN
MINWRK = MAX( 8*N, 6*N + 16 )
MAXWRK = MINWRK - N +
$ N*<a name="ILAENV.279"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="SGEQRF.279"></a><a href="sgeqrf.f.html#SGEQRF.1">SGEQRF</a>'</span>, <span class="string">' '</span>, N, 1, N, 0 )
MAXWRK = MAX( MAXWRK, MINWRK - N +
$ N*<a name="ILAENV.281"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="SORMQR.281"></a><a href="sormqr.f.html#SORMQR.1">SORMQR</a>'</span>, <span class="string">' '</span>, N, 1, N, -1 ) )
IF( ILVSL ) THEN
MAXWRK = MAX( MAXWRK, MINWRK - N +
$ N*<a name="ILAENV.284"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="SORGQR.284"></a><a href="sorgqr.f.html#SORGQR.1">SORGQR</a>'</span>, <span class="string">' '</span>, N, 1, N, -1 ) )
END IF
ELSE
MINWRK = 1
MAXWRK = 1
END IF
WORK( 1 ) = MAXWRK
<span class="comment">*</span><span class="comment">
</span> IF( LWORK.LT.MINWRK .AND. .NOT.LQUERY )
$ INFO = -19
END IF
<span class="comment">*</span><span class="comment">
</span> IF( INFO.NE.0 ) THEN
CALL <a name="XERBLA.297"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="SGGES.297"></a><a href="sgges.f.html#SGGES.1">SGGES</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 ) THEN
SDIM = 0
RETURN
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Get machine constants
</span><span class="comment">*</span><span class="comment">
</span> EPS = <a name="SLAMCH.312"></a><a href="slamch.f.html#SLAMCH.1">SLAMCH</a>( <span class="string">'P'</span> )
SAFMIN = <a name="SLAMCH.313"></a><a href="slamch.f.html#SLAMCH.1">SLAMCH</a>( <span class="string">'S'</span> )
SAFMAX = ONE / SAFMIN
CALL <a name="SLABAD.315"></a><a href="slabad.f.html#SLABAD.1">SLABAD</a>( SAFMIN, SAFMAX )
SMLNUM = SQRT( SAFMIN ) / EPS
BIGNUM = ONE / SMLNUM
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Scale A if max element outside range [SMLNUM,BIGNUM]
</span><span class="comment">*</span><span class="comment">
</span> ANRM = <a name="SLANGE.321"></a><a href="slange.f.html#SLANGE.1">SLANGE</a>( <span class="string">'M'</span>, N, N, A, LDA, WORK )
ILASCL = .FALSE.
IF( ANRM.GT.ZERO .AND. ANRM.LT.SMLNUM ) THEN
ANRMTO = SMLNUM
ILASCL = .TRUE.
ELSE IF( ANRM.GT.BIGNUM ) THEN
ANRMTO = BIGNUM
ILASCL = .TRUE.
END IF
IF( ILASCL )
$ CALL <a name="SLASCL.331"></a><a href="slascl.f.html#SLASCL.1">SLASCL</a>( <span class="string">'G'</span>, 0, 0, ANRM, ANRMTO, N, N, A, LDA, IERR )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Scale B if max element outside range [SMLNUM,BIGNUM]
</span><span class="comment">*</span><span class="comment">
</span> BNRM = <a name="SLANGE.335"></a><a href="slange.f.html#SLANGE.1">SLANGE</a>( <span class="string">'M'</span>, N, N, B, LDB, WORK )
ILBSCL = .FALSE.
IF( BNRM.GT.ZERO .AND. BNRM.LT.SMLNUM ) THEN
BNRMTO = SMLNUM
ILBSCL = .TRUE.
ELSE IF( BNRM.GT.BIGNUM ) THEN
BNRMTO = BIGNUM
ILBSCL = .TRUE.
END IF
IF( ILBSCL )
$ CALL <a name="SLASCL.345"></a><a href="slascl.f.html#SLASCL.1">SLASCL</a>( <span class="string">'G'</span>, 0, 0, BNRM, BNRMTO, N, N, B, LDB, IERR )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Permute the matrix to make it more nearly triangular
</span><span class="comment">*</span><span class="comment"> (Workspace: need 6*N + 2*N space for storing balancing factors)
</span><span class="comment">*</span><span class="comment">
</span> ILEFT = 1
IRIGHT = N + 1
IWRK = IRIGHT + N
CALL <a name="SGGBAL.353"></a><a href="sggbal.f.html#SGGBAL.1">SGGBAL</a>( <span class="string">'P'</span>, N, A, LDA, B, LDB, ILO, IHI, WORK( ILEFT ),
$ WORK( IRIGHT ), WORK( IWRK ), IERR )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Reduce B to triangular form (QR decomposition of B)
</span><span class="comment">*</span><span class="comment"> (Workspace: need N, prefer N*NB)
</span><span class="comment">*</span><span class="comment">
</span> IROWS = IHI + 1 - ILO
ICOLS = N + 1 - ILO
ITAU = IWRK
IWRK = ITAU + IROWS
CALL <a name="SGEQRF.363"></a><a href="sgeqrf.f.html#SGEQRF.1">SGEQRF</a>( IROWS, ICOLS, B( ILO, ILO ), LDB, WORK( ITAU ),
$ WORK( IWRK ), LWORK+1-IWRK, IERR )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Apply the orthogonal transformation to matrix A
</span><span class="comment">*</span><span class="comment"> (Workspace: need N, prefer N*NB)
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="SORMQR.369"></a><a href="sormqr.f.html#SORMQR.1">SORMQR</a>( <span class="string">'L'</span>, <span class="string">'T'</span>, IROWS, ICOLS, IROWS, B( ILO, ILO ), LDB,
$ WORK( ITAU ), A( ILO, ILO ), LDA, WORK( IWRK ),
$ LWORK+1-IWRK, IERR )
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?