claein.f.html

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

HTML
288
字号
   10    CONTINUE
         B( J, J ) = H( J, J ) - W
   20 CONTINUE
<span class="comment">*</span><span class="comment">
</span>      IF( NOINIT ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Initialize V.
</span><span class="comment">*</span><span class="comment">
</span>         DO 30 I = 1, N
            V( I ) = EPS3
   30    CONTINUE
      ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Scale supplied initial vector.
</span><span class="comment">*</span><span class="comment">
</span>         VNORM = SCNRM2( N, V, 1 )
         CALL CSSCAL( N, ( EPS3*ROOTN ) / MAX( VNORM, NRMSML ), V, 1 )
      END IF
<span class="comment">*</span><span class="comment">
</span>      IF( RIGHTV ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        LU decomposition with partial pivoting of B, replacing zero
</span><span class="comment">*</span><span class="comment">        pivots by EPS3.
</span><span class="comment">*</span><span class="comment">
</span>         DO 60 I = 1, N - 1
            EI = H( I+1, I )
            IF( CABS1( B( I, I ) ).LT.CABS1( EI ) ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              Interchange rows and eliminate.
</span><span class="comment">*</span><span class="comment">
</span>               X = <a name="CLADIV.156"></a><a href="cladiv.f.html#CLADIV.1">CLADIV</a>( B( I, I ), EI )
               B( I, I ) = EI
               DO 40 J = I + 1, N
                  TEMP = B( I+1, J )
                  B( I+1, J ) = B( I, J ) - X*TEMP
                  B( I, J ) = TEMP
   40          CONTINUE
            ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              Eliminate without interchange.
</span><span class="comment">*</span><span class="comment">
</span>               IF( B( I, I ).EQ.ZERO )
     $            B( I, I ) = EPS3
               X = <a name="CLADIV.169"></a><a href="cladiv.f.html#CLADIV.1">CLADIV</a>( EI, B( I, I ) )
               IF( X.NE.ZERO ) THEN
                  DO 50 J = I + 1, N
                     B( I+1, J ) = B( I+1, J ) - X*B( I, J )
   50             CONTINUE
               END IF
            END IF
   60    CONTINUE
         IF( B( N, N ).EQ.ZERO )
     $      B( N, N ) = EPS3
<span class="comment">*</span><span class="comment">
</span>         TRANS = <span class="string">'N'</span>
<span class="comment">*</span><span class="comment">
</span>      ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        UL decomposition with partial pivoting of B, replacing zero
</span><span class="comment">*</span><span class="comment">        pivots by EPS3.
</span><span class="comment">*</span><span class="comment">
</span>         DO 90 J = N, 2, -1
            EJ = H( J, J-1 )
            IF( CABS1( B( J, J ) ).LT.CABS1( EJ ) ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              Interchange columns and eliminate.
</span><span class="comment">*</span><span class="comment">
</span>               X = <a name="CLADIV.193"></a><a href="cladiv.f.html#CLADIV.1">CLADIV</a>( B( J, J ), EJ )
               B( J, J ) = EJ
               DO 70 I = 1, J - 1
                  TEMP = B( I, J-1 )
                  B( I, J-1 ) = B( I, J ) - X*TEMP
                  B( I, J ) = TEMP
   70          CONTINUE
            ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              Eliminate without interchange.
</span><span class="comment">*</span><span class="comment">
</span>               IF( B( J, J ).EQ.ZERO )
     $            B( J, J ) = EPS3
               X = <a name="CLADIV.206"></a><a href="cladiv.f.html#CLADIV.1">CLADIV</a>( EJ, B( J, J ) )
               IF( X.NE.ZERO ) THEN
                  DO 80 I = 1, J - 1
                     B( I, J-1 ) = B( I, J-1 ) - X*B( I, J )
   80             CONTINUE
               END IF
            END IF
   90    CONTINUE
         IF( B( 1, 1 ).EQ.ZERO )
     $      B( 1, 1 ) = EPS3
<span class="comment">*</span><span class="comment">
</span>         TRANS = <span class="string">'C'</span>
<span class="comment">*</span><span class="comment">
</span>      END IF
<span class="comment">*</span><span class="comment">
</span>      NORMIN = <span class="string">'N'</span>
      DO 110 ITS = 1, N
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Solve U*x = scale*v for a right eigenvector
</span><span class="comment">*</span><span class="comment">          or U'*x = scale*v for a left eigenvector,
</span><span class="comment">*</span><span class="comment">        overwriting x on v.
</span><span class="comment">*</span><span class="comment">
</span>         CALL <a name="CLATRS.228"></a><a href="clatrs.f.html#CLATRS.1">CLATRS</a>( <span class="string">'Upper'</span>, TRANS, <span class="string">'Nonunit'</span>, NORMIN, N, B, LDB, V,
     $                SCALE, RWORK, IERR )
         NORMIN = <span class="string">'Y'</span>
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Test for sufficient growth in the norm of v.
</span><span class="comment">*</span><span class="comment">
</span>         VNORM = SCASUM( N, V, 1 )
         IF( VNORM.GE.GROWTO*SCALE )
     $      GO TO 120
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Choose new orthogonal starting vector and try again.
</span><span class="comment">*</span><span class="comment">
</span>         RTEMP = EPS3 / ( ROOTN+ONE )
         V( 1 ) = EPS3
         DO 100 I = 2, N
            V( I ) = RTEMP
  100    CONTINUE
         V( N-ITS+1 ) = V( N-ITS+1 ) - EPS3*ROOTN
  110 CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Failure to find eigenvector in N iterations.
</span><span class="comment">*</span><span class="comment">
</span>      INFO = 1
<span class="comment">*</span><span class="comment">
</span>  120 CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Normalize eigenvector.
</span><span class="comment">*</span><span class="comment">
</span>      I = ICAMAX( N, V, 1 )
      CALL CSSCAL( N, ONE / CABS1( V( I ) ), V, 1 )
<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="CLAEIN.261"></a><a href="claein.f.html#CLAEIN.1">CLAEIN</a>
</span><span class="comment">*</span><span class="comment">
</span>      END

</pre>

 </body>
</html>

⌨️ 快捷键说明

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