cggev.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 479 行 · 第 1/3 页
HTML
479 行
</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"> (Complex Workspace: need N, prefer N*NB)
</span><span class="comment">*</span><span class="comment">
</span> IROWS = IHI + 1 - ILO
IF( ILV ) THEN
ICOLS = N + 1 - ILO
ELSE
ICOLS = IROWS
END IF
ITAU = 1
IWRK = ITAU + IROWS
CALL <a name="CGEQRF.313"></a><a href="cgeqrf.f.html#CGEQRF.1">CGEQRF</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"> (Complex Workspace: need N, prefer N*NB)
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="CUNMQR.319"></a><a href="cunmqr.f.html#CUNMQR.1">CUNMQR</a>( <span class="string">'L'</span>, <span class="string">'C'</span>, IROWS, ICOLS, IROWS, B( ILO, ILO ), LDB,
$ WORK( ITAU ), A( ILO, ILO ), LDA, WORK( IWRK ),
$ LWORK+1-IWRK, IERR )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Initialize VL
</span><span class="comment">*</span><span class="comment"> (Complex Workspace: need N, prefer N*NB)
</span><span class="comment">*</span><span class="comment">
</span> IF( ILVL ) THEN
CALL <a name="CLASET.327"></a><a href="claset.f.html#CLASET.1">CLASET</a>( <span class="string">'Full'</span>, N, N, CZERO, CONE, VL, LDVL )
IF( IROWS.GT.1 ) THEN
CALL <a name="CLACPY.329"></a><a href="clacpy.f.html#CLACPY.1">CLACPY</a>( <span class="string">'L'</span>, IROWS-1, IROWS-1, B( ILO+1, ILO ), LDB,
$ VL( ILO+1, ILO ), LDVL )
END IF
CALL <a name="CUNGQR.332"></a><a href="cungqr.f.html#CUNGQR.1">CUNGQR</a>( IROWS, IROWS, IROWS, VL( ILO, ILO ), LDVL,
$ WORK( ITAU ), WORK( IWRK ), LWORK+1-IWRK, IERR )
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Initialize VR
</span><span class="comment">*</span><span class="comment">
</span> IF( ILVR )
$ CALL <a name="CLASET.339"></a><a href="claset.f.html#CLASET.1">CLASET</a>( <span class="string">'Full'</span>, N, N, CZERO, CONE, VR, LDVR )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Reduce to generalized Hessenberg form
</span><span class="comment">*</span><span class="comment">
</span> IF( ILV ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Eigenvectors requested -- work on whole matrix.
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="CGGHRD.347"></a><a href="cgghrd.f.html#CGGHRD.1">CGGHRD</a>( JOBVL, JOBVR, N, ILO, IHI, A, LDA, B, LDB, VL,
$ LDVL, VR, LDVR, IERR )
ELSE
CALL <a name="CGGHRD.350"></a><a href="cgghrd.f.html#CGGHRD.1">CGGHRD</a>( <span class="string">'N'</span>, <span class="string">'N'</span>, IROWS, 1, IROWS, A( ILO, ILO ), LDA,
$ B( ILO, ILO ), LDB, VL, LDVL, VR, LDVR, IERR )
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Perform QZ algorithm (Compute eigenvalues, and optionally, the
</span><span class="comment">*</span><span class="comment"> Schur form and Schur vectors)
</span><span class="comment">*</span><span class="comment"> (Complex Workspace: need N)
</span><span class="comment">*</span><span class="comment"> (Real Workspace: need N)
</span><span class="comment">*</span><span class="comment">
</span> IWRK = ITAU
IF( ILV ) THEN
CHTEMP = <span class="string">'S'</span>
ELSE
CHTEMP = <span class="string">'E'</span>
END IF
CALL <a name="CHGEQZ.365"></a><a href="chgeqz.f.html#CHGEQZ.1">CHGEQZ</a>( CHTEMP, JOBVL, JOBVR, N, ILO, IHI, A, LDA, B, LDB,
$ ALPHA, BETA, VL, LDVL, VR, LDVR, WORK( IWRK ),
$ LWORK+1-IWRK, RWORK( IRWRK ), IERR )
IF( IERR.NE.0 ) THEN
IF( IERR.GT.0 .AND. IERR.LE.N ) THEN
INFO = IERR
ELSE IF( IERR.GT.N .AND. IERR.LE.2*N ) THEN
INFO = IERR - N
ELSE
INFO = N + 1
END IF
GO TO 70
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Compute Eigenvectors
</span><span class="comment">*</span><span class="comment"> (Real Workspace: need 2*N)
</span><span class="comment">*</span><span class="comment"> (Complex Workspace: need 2*N)
</span><span class="comment">*</span><span class="comment">
</span> IF( ILV ) THEN
IF( ILVL ) THEN
IF( ILVR ) THEN
CHTEMP = <span class="string">'B'</span>
ELSE
CHTEMP = <span class="string">'L'</span>
END IF
ELSE
CHTEMP = <span class="string">'R'</span>
END IF
<span class="comment">*</span><span class="comment">
</span> CALL <a name="CTGEVC.394"></a><a href="ctgevc.f.html#CTGEVC.1">CTGEVC</a>( CHTEMP, <span class="string">'B'</span>, LDUMMA, N, A, LDA, B, LDB, VL, LDVL,
$ VR, LDVR, N, IN, WORK( IWRK ), RWORK( IRWRK ),
$ IERR )
IF( IERR.NE.0 ) THEN
INFO = N + 2
GO TO 70
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Undo balancing on VL and VR and normalization
</span><span class="comment">*</span><span class="comment"> (Workspace: none needed)
</span><span class="comment">*</span><span class="comment">
</span> IF( ILVL ) THEN
CALL <a name="CGGBAK.406"></a><a href="cggbak.f.html#CGGBAK.1">CGGBAK</a>( <span class="string">'P'</span>, <span class="string">'L'</span>, N, ILO, IHI, RWORK( ILEFT ),
$ RWORK( IRIGHT ), N, VL, LDVL, IERR )
DO 30 JC = 1, N
TEMP = ZERO
DO 10 JR = 1, N
TEMP = MAX( TEMP, ABS1( VL( JR, JC ) ) )
10 CONTINUE
IF( TEMP.LT.SMLNUM )
$ GO TO 30
TEMP = ONE / TEMP
DO 20 JR = 1, N
VL( JR, JC ) = VL( JR, JC )*TEMP
20 CONTINUE
30 CONTINUE
END IF
IF( ILVR ) THEN
CALL <a name="CGGBAK.422"></a><a href="cggbak.f.html#CGGBAK.1">CGGBAK</a>( <span class="string">'P'</span>, <span class="string">'R'</span>, N, ILO, IHI, RWORK( ILEFT ),
$ RWORK( IRIGHT ), N, VR, LDVR, IERR )
DO 60 JC = 1, N
TEMP = ZERO
DO 40 JR = 1, N
TEMP = MAX( TEMP, ABS1( VR( JR, JC ) ) )
40 CONTINUE
IF( TEMP.LT.SMLNUM )
$ GO TO 60
TEMP = ONE / TEMP
DO 50 JR = 1, N
VR( JR, JC ) = VR( JR, JC )*TEMP
50 CONTINUE
60 CONTINUE
END IF
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Undo scaling if necessary
</span><span class="comment">*</span><span class="comment">
</span> IF( ILASCL )
$ CALL <a name="CLASCL.442"></a><a href="clascl.f.html#CLASCL.1">CLASCL</a>( <span class="string">'G'</span>, 0, 0, ANRMTO, ANRM, N, 1, ALPHA, N, IERR )
<span class="comment">*</span><span class="comment">
</span> IF( ILBSCL )
$ CALL <a name="CLASCL.445"></a><a href="clascl.f.html#CLASCL.1">CLASCL</a>( <span class="string">'G'</span>, 0, 0, BNRMTO, BNRM, N, 1, BETA, N, IERR )
<span class="comment">*</span><span class="comment">
</span> 70 CONTINUE
WORK( 1 ) = LWKOPT
<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="CGGEV.452"></a><a href="cggev.f.html#CGGEV.1">CGGEV</a>
</span><span class="comment">*</span><span class="comment">
</span> END
</pre>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?