chgeqz.f.html

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

HTML
783
字号
         ESHIFT = CZERO
         IF( .NOT.ILSCHR ) THEN
            ILASTM = ILAST
            IF( IFRSTM.GT.ILAST )
     $         IFRSTM = ILO
         END IF
         GO TO 160
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        QZ step
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        This iteration only involves rows/columns IFIRST:ILAST.  We
</span><span class="comment">*</span><span class="comment">        assume IFIRST &lt; ILAST, and that the diagonal of B is non-zero.
</span><span class="comment">*</span><span class="comment">
</span>   70    CONTINUE
         IITER = IITER + 1
         IF( .NOT.ILSCHR ) THEN
            IFRSTM = IFIRST
         END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Compute the Shift.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        At this point, IFIRST &lt; ILAST, and the diagonal elements of
</span><span class="comment">*</span><span class="comment">        T(IFIRST:ILAST,IFIRST,ILAST) are larger than BTOL (in
</span><span class="comment">*</span><span class="comment">        magnitude)
</span><span class="comment">*</span><span class="comment">
</span>         IF( ( IITER / 10 )*10.NE.IITER ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           The Wilkinson shift (AEP p.512), i.e., the eigenvalue of
</span><span class="comment">*</span><span class="comment">           the bottom-right 2x2 block of A inv(B) which is nearest to
</span><span class="comment">*</span><span class="comment">           the bottom-right element.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           We factor B as U*D, where U has unit diagonals, and
</span><span class="comment">*</span><span class="comment">           compute (A*inv(D))*inv(U).
</span><span class="comment">*</span><span class="comment">
</span>            U12 = ( BSCALE*T( ILAST-1, ILAST ) ) /
     $            ( BSCALE*T( ILAST, ILAST ) )
            AD11 = ( ASCALE*H( ILAST-1, ILAST-1 ) ) /
     $             ( BSCALE*T( ILAST-1, ILAST-1 ) )
            AD21 = ( ASCALE*H( ILAST, ILAST-1 ) ) /
     $             ( BSCALE*T( ILAST-1, ILAST-1 ) )
            AD12 = ( ASCALE*H( ILAST-1, ILAST ) ) /
     $             ( BSCALE*T( ILAST, ILAST ) )
            AD22 = ( ASCALE*H( ILAST, ILAST ) ) /
     $             ( BSCALE*T( ILAST, ILAST ) )
            ABI22 = AD22 - U12*AD21
<span class="comment">*</span><span class="comment">
</span>            T1 = HALF*( AD11+ABI22 )
            RTDISC = SQRT( T1**2+AD12*AD21-AD11*AD22 )
            TEMP = REAL( T1-ABI22 )*REAL( RTDISC ) +
     $             AIMAG( T1-ABI22 )*AIMAG( RTDISC )
            IF( TEMP.LE.ZERO ) THEN
               SHIFT = T1 + RTDISC
            ELSE
               SHIFT = T1 - RTDISC
            END IF
         ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Exceptional shift.  Chosen for no particularly good reason.
</span><span class="comment">*</span><span class="comment">
</span>            ESHIFT = ESHIFT + CONJG( ( ASCALE*H( ILAST-1, ILAST ) ) /
     $               ( BSCALE*T( ILAST-1, ILAST-1 ) ) )
            SHIFT = ESHIFT
         END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Now check for two consecutive small subdiagonals.
</span><span class="comment">*</span><span class="comment">
</span>         DO 80 J = ILAST - 1, IFIRST + 1, -1
            ISTART = J
            CTEMP = ASCALE*H( J, J ) - SHIFT*( BSCALE*T( J, J ) )
            TEMP = ABS1( CTEMP )
            TEMP2 = ASCALE*ABS1( H( J+1, J ) )
            TEMPR = MAX( TEMP, TEMP2 )
            IF( TEMPR.LT.ONE .AND. TEMPR.NE.ZERO ) THEN
               TEMP = TEMP / TEMPR
               TEMP2 = TEMP2 / TEMPR
            END IF
            IF( ABS1( H( J, J-1 ) )*TEMP2.LE.TEMP*ATOL )
     $         GO TO 90
   80    CONTINUE
<span class="comment">*</span><span class="comment">
</span>         ISTART = IFIRST
         CTEMP = ASCALE*H( IFIRST, IFIRST ) -
     $           SHIFT*( BSCALE*T( IFIRST, IFIRST ) )
   90    CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Do an implicit-shift QZ sweep.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Initial Q
</span><span class="comment">*</span><span class="comment">
</span>         CTEMP2 = ASCALE*H( ISTART+1, ISTART )
         CALL <a name="CLARTG.660"></a><a href="clartg.f.html#CLARTG.1">CLARTG</a>( CTEMP, CTEMP2, C, S, CTEMP3 )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Sweep
</span><span class="comment">*</span><span class="comment">
</span>         DO 150 J = ISTART, ILAST - 1
            IF( J.GT.ISTART ) THEN
               CTEMP = H( J, J-1 )
               CALL <a name="CLARTG.667"></a><a href="clartg.f.html#CLARTG.1">CLARTG</a>( CTEMP, H( J+1, J-1 ), C, S, H( J, J-1 ) )
               H( J+1, J-1 ) = CZERO
            END IF
<span class="comment">*</span><span class="comment">
</span>            DO 100 JC = J, ILASTM
               CTEMP = C*H( J, JC ) + S*H( J+1, JC )
               H( J+1, JC ) = -CONJG( S )*H( J, JC ) + C*H( J+1, JC )
               H( J, JC ) = CTEMP
               CTEMP2 = C*T( J, JC ) + S*T( J+1, JC )
               T( J+1, JC ) = -CONJG( S )*T( J, JC ) + C*T( J+1, JC )
               T( J, JC ) = CTEMP2
  100       CONTINUE
            IF( ILQ ) THEN
               DO 110 JR = 1, N
                  CTEMP = C*Q( JR, J ) + CONJG( S )*Q( JR, J+1 )
                  Q( JR, J+1 ) = -S*Q( JR, J ) + C*Q( JR, J+1 )
                  Q( JR, J ) = CTEMP
  110          CONTINUE
            END IF
<span class="comment">*</span><span class="comment">
</span>            CTEMP = T( J+1, J+1 )
            CALL <a name="CLARTG.688"></a><a href="clartg.f.html#CLARTG.1">CLARTG</a>( CTEMP, T( J+1, J ), C, S, T( J+1, J+1 ) )
            T( J+1, J ) = CZERO
<span class="comment">*</span><span class="comment">
</span>            DO 120 JR = IFRSTM, MIN( J+2, ILAST )
               CTEMP = C*H( JR, J+1 ) + S*H( JR, J )
               H( JR, J ) = -CONJG( S )*H( JR, J+1 ) + C*H( JR, J )
               H( JR, J+1 ) = CTEMP
  120       CONTINUE
            DO 130 JR = IFRSTM, J
               CTEMP = C*T( JR, J+1 ) + S*T( JR, J )
               T( JR, J ) = -CONJG( S )*T( JR, J+1 ) + C*T( JR, J )
               T( JR, J+1 ) = CTEMP
  130       CONTINUE
            IF( ILZ ) THEN
               DO 140 JR = 1, N
                  CTEMP = C*Z( JR, J+1 ) + S*Z( JR, J )
                  Z( JR, J ) = -CONJG( S )*Z( JR, J+1 ) + C*Z( JR, J )
                  Z( JR, J+1 ) = CTEMP
  140          CONTINUE
            END IF
  150    CONTINUE
<span class="comment">*</span><span class="comment">
</span>  160    CONTINUE
<span class="comment">*</span><span class="comment">
</span>  170 CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Drop-through = non-convergence
</span><span class="comment">*</span><span class="comment">
</span>  180 CONTINUE
      INFO = ILAST
      GO TO 210
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Successful completion of all QZ steps
</span><span class="comment">*</span><span class="comment">
</span>  190 CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Set Eigenvalues 1:ILO-1
</span><span class="comment">*</span><span class="comment">
</span>      DO 200 J = 1, ILO - 1
         ABSB = ABS( T( J, J ) )
         IF( ABSB.GT.SAFMIN ) THEN
            SIGNBC = CONJG( T( J, J ) / ABSB )
            T( J, J ) = ABSB
            IF( ILSCHR ) THEN
               CALL CSCAL( J-1, SIGNBC, T( 1, J ), 1 )
               CALL CSCAL( J, SIGNBC, H( 1, J ), 1 )
            ELSE
               H( J, J ) = H( J, J )*SIGNBC
            END IF
            IF( ILZ )
     $         CALL CSCAL( N, SIGNBC, Z( 1, J ), 1 )
         ELSE
            T( J, J ) = CZERO
         END IF
         ALPHA( J ) = H( J, J )
         BETA( J ) = T( J, J )
  200 CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Normal Termination
</span><span class="comment">*</span><span class="comment">
</span>      INFO = 0
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Exit (other than argument error) -- return optimal workspace size
</span><span class="comment">*</span><span class="comment">
</span>  210 CONTINUE
      WORK( 1 ) = CMPLX( N )
      RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     End of <a name="CHGEQZ.756"></a><a href="chgeqz.f.html#CHGEQZ.1">CHGEQZ</a>
</span><span class="comment">*</span><span class="comment">
</span>      END

</pre>

 </body>
</html>

⌨️ 快捷键说明

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