cgeesx.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 409 行 · 第 1/3 页
HTML
409 行
</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.264"></a><a href="slamch.f.html#SLAMCH.1">SLAMCH</a>( <span class="string">'P'</span> )
SMLNUM = <a name="SLAMCH.265"></a><a href="slamch.f.html#SLAMCH.1">SLAMCH</a>( <span class="string">'S'</span> )
BIGNUM = ONE / SMLNUM
CALL <a name="SLABAD.267"></a><a href="slabad.f.html#SLABAD.1">SLABAD</a>( SMLNUM, BIGNUM )
SMLNUM = SQRT( SMLNUM ) / 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="CLANGE.273"></a><a href="clange.f.html#CLANGE.1">CLANGE</a>( <span class="string">'M'</span>, N, N, A, LDA, DUM )
SCALEA = .FALSE.
IF( ANRM.GT.ZERO .AND. ANRM.LT.SMLNUM ) THEN
SCALEA = .TRUE.
CSCALE = SMLNUM
ELSE IF( ANRM.GT.BIGNUM ) THEN
SCALEA = .TRUE.
CSCALE = BIGNUM
END IF
IF( SCALEA )
$ CALL <a name="CLASCL.283"></a><a href="clascl.f.html#CLASCL.1">CLASCL</a>( <span class="string">'G'</span>, 0, 0, ANRM, CSCALE, N, N, A, LDA, IERR )
<span class="comment">*</span><span class="comment">
</span><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"> (CWorkspace: none)
</span><span class="comment">*</span><span class="comment"> (RWorkspace: need N)
</span><span class="comment">*</span><span class="comment">
</span> IBAL = 1
CALL <a name="CGEBAL.291"></a><a href="cgebal.f.html#CGEBAL.1">CGEBAL</a>( <span class="string">'P'</span>, N, A, LDA, ILO, IHI, RWORK( IBAL ), IERR )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Reduce to upper Hessenberg form
</span><span class="comment">*</span><span class="comment"> (CWorkspace: need 2*N, prefer N+N*NB)
</span><span class="comment">*</span><span class="comment"> (RWorkspace: none)
</span><span class="comment">*</span><span class="comment">
</span> ITAU = 1
IWRK = N + ITAU
CALL <a name="CGEHRD.299"></a><a href="cgehrd.f.html#CGEHRD.1">CGEHRD</a>( N, ILO, IHI, A, LDA, WORK( ITAU ), WORK( IWRK ),
$ LWORK-IWRK+1, IERR )
<span class="comment">*</span><span class="comment">
</span> IF( WANTVS ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Copy Householder vectors to VS
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="CLACPY.306"></a><a href="clacpy.f.html#CLACPY.1">CLACPY</a>( <span class="string">'L'</span>, N, N, A, LDA, VS, LDVS )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Generate unitary matrix in VS
</span><span class="comment">*</span><span class="comment"> (CWorkspace: need 2*N-1, prefer N+(N-1)*NB)
</span><span class="comment">*</span><span class="comment"> (RWorkspace: none)
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="CUNGHR.312"></a><a href="cunghr.f.html#CUNGHR.1">CUNGHR</a>( N, ILO, IHI, VS, LDVS, WORK( ITAU ), WORK( IWRK ),
$ LWORK-IWRK+1, IERR )
END IF
<span class="comment">*</span><span class="comment">
</span> SDIM = 0
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Perform QR iteration, accumulating Schur vectors in VS if desired
</span><span class="comment">*</span><span class="comment"> (CWorkspace: need 1, prefer HSWORK (see comments) )
</span><span class="comment">*</span><span class="comment"> (RWorkspace: none)
</span><span class="comment">*</span><span class="comment">
</span> IWRK = ITAU
CALL <a name="CHSEQR.323"></a><a href="chseqr.f.html#CHSEQR.1">CHSEQR</a>( <span class="string">'S'</span>, JOBVS, N, ILO, IHI, A, LDA, W, VS, LDVS,
$ WORK( IWRK ), LWORK-IWRK+1, IEVAL )
IF( IEVAL.GT.0 )
$ INFO = IEVAL
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Sort eigenvalues if desired
</span><span class="comment">*</span><span class="comment">
</span> IF( WANTST .AND. INFO.EQ.0 ) THEN
IF( SCALEA )
$ CALL <a name="CLASCL.332"></a><a href="clascl.f.html#CLASCL.1">CLASCL</a>( <span class="string">'G'</span>, 0, 0, CSCALE, ANRM, N, 1, W, N, IERR )
DO 10 I = 1, N
BWORK( I ) = SELECT( W( I ) )
10 CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Reorder eigenvalues, transform Schur vectors, and compute
</span><span class="comment">*</span><span class="comment"> reciprocal condition numbers
</span><span class="comment">*</span><span class="comment"> (CWorkspace: if SENSE is not 'N', need 2*SDIM*(N-SDIM)
</span><span class="comment">*</span><span class="comment"> otherwise, need none )
</span><span class="comment">*</span><span class="comment"> (RWorkspace: none)
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="CTRSEN.343"></a><a href="ctrsen.f.html#CTRSEN.1">CTRSEN</a>( SENSE, JOBVS, BWORK, N, A, LDA, VS, LDVS, W, SDIM,
$ RCONDE, RCONDV, WORK( IWRK ), LWORK-IWRK+1,
$ ICOND )
IF( .NOT.WANTSN )
$ MAXWRK = MAX( MAXWRK, 2*SDIM*( N-SDIM ) )
IF( ICOND.EQ.-14 ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Not enough complex workspace
</span><span class="comment">*</span><span class="comment">
</span> INFO = -15
END IF
END IF
<span class="comment">*</span><span class="comment">
</span> IF( WANTVS ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Undo balancing
</span><span class="comment">*</span><span class="comment"> (CWorkspace: none)
</span><span class="comment">*</span><span class="comment"> (RWorkspace: need N)
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="CGEBAK.362"></a><a href="cgebak.f.html#CGEBAK.1">CGEBAK</a>( <span class="string">'P'</span>, <span class="string">'R'</span>, N, ILO, IHI, RWORK( IBAL ), N, VS, LDVS,
$ IERR )
END IF
<span class="comment">*</span><span class="comment">
</span> IF( SCALEA ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Undo scaling for the Schur form of A
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="CLASCL.370"></a><a href="clascl.f.html#CLASCL.1">CLASCL</a>( <span class="string">'U'</span>, 0, 0, CSCALE, ANRM, N, N, A, LDA, IERR )
CALL CCOPY( N, A, LDA+1, W, 1 )
IF( ( WANTSV .OR. WANTSB ) .AND. INFO.EQ.0 ) THEN
DUM( 1 ) = RCONDV
CALL <a name="SLASCL.374"></a><a href="slascl.f.html#SLASCL.1">SLASCL</a>( <span class="string">'G'</span>, 0, 0, CSCALE, ANRM, 1, 1, DUM, 1, IERR )
RCONDV = DUM( 1 )
END IF
END IF
<span class="comment">*</span><span class="comment">
</span> WORK( 1 ) = MAXWRK
RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> End of <a name="CGEESX.382"></a><a href="cgeesx.f.html#CGEESX.1">CGEESX</a>
</span><span class="comment">*</span><span class="comment">
</span> END
</pre>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?