cgegv.f.html

来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 627 行 · 第 1/3 页

HTML
627
字号
<span class="comment">*</span><span class="comment">
</span>      IF( ILVL ) THEN
         CALL <a name="CLASET.402"></a><a href="claset.f.html#CLASET.1">CLASET</a>( <span class="string">'Full'</span>, N, N, CZERO, CONE, VL, LDVL )
         CALL <a name="CLACPY.403"></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 )
         CALL <a name="CUNGQR.405"></a><a href="cungqr.f.html#CUNGQR.1">CUNGQR</a>( IROWS, IROWS, IROWS, VL( ILO, ILO ), LDVL,
     $                WORK( ITAU ), WORK( IWORK ), LWORK+1-IWORK,
     $                IINFO )
         IF( IINFO.GE.0 )
     $      LWKOPT = MAX( LWKOPT, INT( WORK( IWORK ) )+IWORK-1 )
         IF( IINFO.NE.0 ) THEN
            INFO = N + 4
            GO TO 80
         END IF
      END IF
<span class="comment">*</span><span class="comment">
</span>      IF( ILVR )
     $   CALL <a name="CLASET.417"></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.425"></a><a href="cgghrd.f.html#CGGHRD.1">CGGHRD</a>( JOBVL, JOBVR, N, ILO, IHI, A, LDA, B, LDB, VL,
     $                LDVL, VR, LDVR, IINFO )
      ELSE
         CALL <a name="CGGHRD.428"></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, IINFO )
      END IF
      IF( IINFO.NE.0 ) THEN
         INFO = N + 5
         GO TO 80
      END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Perform QZ algorithm
</span><span class="comment">*</span><span class="comment">
</span>      IWORK = ITAU
      IF( ILV ) THEN
         CHTEMP = <span class="string">'S'</span>
      ELSE
         CHTEMP = <span class="string">'E'</span>
      END IF
      CALL <a name="CHGEQZ.444"></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( IWORK ),
     $             LWORK+1-IWORK, RWORK( IRWORK ), IINFO )
      IF( IINFO.GE.0 )
     $   LWKOPT = MAX( LWKOPT, INT( WORK( IWORK ) )+IWORK-1 )
      IF( IINFO.NE.0 ) THEN
         IF( IINFO.GT.0 .AND. IINFO.LE.N ) THEN
            INFO = IINFO
         ELSE IF( IINFO.GT.N .AND. IINFO.LE.2*N ) THEN
            INFO = IINFO - N
         ELSE
            INFO = N + 6
         END IF
         GO TO 80
      END IF
<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">        Compute Eigenvectors
</span><span class="comment">*</span><span class="comment">
</span>         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.474"></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( IWORK ), RWORK( IRWORK ),
     $                IINFO )
         IF( IINFO.NE.0 ) THEN
            INFO = N + 7
            GO TO 80
         END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Undo balancing on VL and VR, rescale
</span><span class="comment">*</span><span class="comment">
</span>         IF( ILVL ) THEN
            CALL <a name="CGGBAK.485"></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, IINFO )
            IF( IINFO.NE.0 ) THEN
               INFO = N + 8
               GO TO 80
            END IF
            DO 30 JC = 1, N
               TEMP = ZERO
               DO 10 JR = 1, N
                  TEMP = MAX( TEMP, ABS1( VL( JR, JC ) ) )
   10          CONTINUE
               IF( TEMP.LT.SAFMIN )
     $            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.505"></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, IINFO )
            IF( IINFO.NE.0 ) THEN
               INFO = N + 9
               GO TO 80
            END IF
            DO 60 JC = 1, N
               TEMP = ZERO
               DO 40 JR = 1, N
                  TEMP = MAX( TEMP, ABS1( VR( JR, JC ) ) )
   40          CONTINUE
               IF( TEMP.LT.SAFMIN )
     $            GO TO 60
               TEMP = ONE / TEMP
               DO 50 JR = 1, N
                  VR( JR, JC ) = VR( JR, JC )*TEMP
   50          CONTINUE
   60       CONTINUE
         END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        End of eigenvector calculation
</span><span class="comment">*</span><span class="comment">
</span>      END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Undo scaling in alpha, beta
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Note: this does not give the alpha and beta for the unscaled
</span><span class="comment">*</span><span class="comment">     problem.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Un-scaling is limited to avoid underflow in alpha and beta
</span><span class="comment">*</span><span class="comment">     if they are significant.
</span><span class="comment">*</span><span class="comment">
</span>      DO 70 JC = 1, N
         ABSAR = ABS( REAL( ALPHA( JC ) ) )
         ABSAI = ABS( AIMAG( ALPHA( JC ) ) )
         ABSB = ABS( REAL( BETA( JC ) ) )
         SALFAR = ANRM*REAL( ALPHA( JC ) )
         SALFAI = ANRM*AIMAG( ALPHA( JC ) )
         SBETA = BNRM*REAL( BETA( JC ) )
         ILIMIT = .FALSE.
         SCALE = ONE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Check for significant underflow in imaginary part of ALPHA
</span><span class="comment">*</span><span class="comment">
</span>         IF( ABS( SALFAI ).LT.SAFMIN .AND. ABSAI.GE.
     $       MAX( SAFMIN, EPS*ABSAR, EPS*ABSB ) ) THEN
            ILIMIT = .TRUE.
            SCALE = ( SAFMIN / ANRM1 ) / MAX( SAFMIN, ANRM2*ABSAI )
         END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Check for significant underflow in real part of ALPHA
</span><span class="comment">*</span><span class="comment">
</span>         IF( ABS( SALFAR ).LT.SAFMIN .AND. ABSAR.GE.
     $       MAX( SAFMIN, EPS*ABSAI, EPS*ABSB ) ) THEN
            ILIMIT = .TRUE.
            SCALE = MAX( SCALE, ( SAFMIN / ANRM1 ) /
     $              MAX( SAFMIN, ANRM2*ABSAR ) )
         END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Check for significant underflow in BETA
</span><span class="comment">*</span><span class="comment">
</span>         IF( ABS( SBETA ).LT.SAFMIN .AND. ABSB.GE.
     $       MAX( SAFMIN, EPS*ABSAR, EPS*ABSAI ) ) THEN
            ILIMIT = .TRUE.
            SCALE = MAX( SCALE, ( SAFMIN / BNRM1 ) /
     $              MAX( SAFMIN, BNRM2*ABSB ) )
         END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Check for possible overflow when limiting scaling
</span><span class="comment">*</span><span class="comment">
</span>         IF( ILIMIT ) THEN
            TEMP = ( SCALE*SAFMIN )*MAX( ABS( SALFAR ), ABS( SALFAI ),
     $             ABS( SBETA ) )
            IF( TEMP.GT.ONE )
     $         SCALE = SCALE / TEMP
            IF( SCALE.LT.ONE )
     $         ILIMIT = .FALSE.
         END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Recompute un-scaled ALPHA, BETA if necessary.
</span><span class="comment">*</span><span class="comment">
</span>         IF( ILIMIT ) THEN
            SALFAR = ( SCALE*REAL( ALPHA( JC ) ) )*ANRM
            SALFAI = ( SCALE*AIMAG( ALPHA( JC ) ) )*ANRM
            SBETA = ( SCALE*BETA( JC ) )*BNRM
         END IF
         ALPHA( JC ) = CMPLX( SALFAR, SALFAI )
         BETA( JC ) = SBETA
   70 CONTINUE
<span class="comment">*</span><span class="comment">
</span>   80 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="CGEGV.600"></a><a href="cgegv.f.html#CGEGV.1">CGEGV</a>
</span><span class="comment">*</span><span class="comment">
</span>      END

</pre>

 </body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?