sstevr.f.html

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

HTML
485
字号
            END IF
         END IF
         IF( WANTZ )
     $      Z( 1, 1 ) = ONE
         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>      SAFMIN = <a name="SLAMCH.315"></a><a href="slamch.f.html#SLAMCH.1">SLAMCH</a>( <span class="string">'Safe minimum'</span> )
      EPS = <a name="SLAMCH.316"></a><a href="slamch.f.html#SLAMCH.1">SLAMCH</a>( <span class="string">'Precision'</span> )
      SMLNUM = SAFMIN / EPS
      BIGNUM = ONE / SMLNUM
      RMIN = SQRT( SMLNUM )
      RMAX = MIN( SQRT( BIGNUM ), ONE / SQRT( SQRT( SAFMIN ) ) )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Scale matrix to allowable range, if necessary.
</span><span class="comment">*</span><span class="comment">
</span>      ISCALE = 0
      VLL = VL
      VUU = VU
<span class="comment">*</span><span class="comment">
</span>      TNRM = <a name="SLANST.329"></a><a href="slanst.f.html#SLANST.1">SLANST</a>( <span class="string">'M'</span>, N, D, E )
      IF( TNRM.GT.ZERO .AND. TNRM.LT.RMIN ) THEN
         ISCALE = 1
         SIGMA = RMIN / TNRM
      ELSE IF( TNRM.GT.RMAX ) THEN
         ISCALE = 1
         SIGMA = RMAX / TNRM
      END IF
      IF( ISCALE.EQ.1 ) THEN
         CALL SSCAL( N, SIGMA, D, 1 )
         CALL SSCAL( N-1, SIGMA, E( 1 ), 1 )
         IF( VALEIG ) THEN
            VLL = VL*SIGMA
            VUU = VU*SIGMA
         END IF
      END IF

<span class="comment">*</span><span class="comment">     Initialize indices into workspaces.  Note: These indices are used only
</span><span class="comment">*</span><span class="comment">     if <a name="SSTERF.347"></a><a href="ssterf.f.html#SSTERF.1">SSTERF</a> or <a name="SSTEMR.347"></a><a href="sstemr.f.html#SSTEMR.1">SSTEMR</a> fail.
</span>
<span class="comment">*</span><span class="comment">     IWORK(INDIBL:INDIBL+M-1) corresponds to IBLOCK in <a name="SSTEBZ.349"></a><a href="sstebz.f.html#SSTEBZ.1">SSTEBZ</a> and
</span><span class="comment">*</span><span class="comment">     stores the block indices of each of the M&lt;=N eigenvalues.
</span>      INDIBL = 1
<span class="comment">*</span><span class="comment">     IWORK(INDISP:INDISP+NSPLIT-1) corresponds to ISPLIT in <a name="SSTEBZ.352"></a><a href="sstebz.f.html#SSTEBZ.1">SSTEBZ</a> and
</span><span class="comment">*</span><span class="comment">     stores the starting and finishing indices of each block.
</span>      INDISP = INDIBL + N
<span class="comment">*</span><span class="comment">     IWORK(INDIFL:INDIFL+N-1) stores the indices of eigenvectors
</span><span class="comment">*</span><span class="comment">     that corresponding to eigenvectors that fail to converge in
</span><span class="comment">*</span><span class="comment">     <a name="SSTEIN.357"></a><a href="sstein.f.html#SSTEIN.1">SSTEIN</a>.  This information is discarded; if any fail, the driver
</span><span class="comment">*</span><span class="comment">     returns INFO &gt; 0.
</span>      INDIFL = INDISP + N
<span class="comment">*</span><span class="comment">     INDIWO is the offset of the remaining integer workspace.
</span>      INDIWO = INDISP + N
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     If all eigenvalues are desired, then
</span><span class="comment">*</span><span class="comment">     call <a name="SSTERF.364"></a><a href="ssterf.f.html#SSTERF.1">SSTERF</a> or <a name="SSTEMR.364"></a><a href="sstemr.f.html#SSTEMR.1">SSTEMR</a>.  If this fails for some eigenvalue, then
</span><span class="comment">*</span><span class="comment">     try <a name="SSTEBZ.365"></a><a href="sstebz.f.html#SSTEBZ.1">SSTEBZ</a>.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">
</span>      TEST = .FALSE.
      IF( INDEIG ) THEN
         IF( IL.EQ.1 .AND. IU.EQ.N ) THEN
            TEST = .TRUE.
         END IF
      END IF
      IF( ( ALLEIG .OR. TEST ) .AND. IEEEOK.EQ.1 ) THEN
         CALL SCOPY( N-1, E( 1 ), 1, WORK( 1 ), 1 )
         IF( .NOT.WANTZ ) THEN
            CALL SCOPY( N, D, 1, W, 1 )
            CALL <a name="SSTERF.378"></a><a href="ssterf.f.html#SSTERF.1">SSTERF</a>( N, W, WORK, INFO )
         ELSE
            CALL SCOPY( N, D, 1, WORK( N+1 ), 1 )
            IF (ABSTOL .LE. TWO*N*EPS) THEN
               TRYRAC = .TRUE.
            ELSE
               TRYRAC = .FALSE.
            END IF
            CALL <a name="SSTEMR.386"></a><a href="sstemr.f.html#SSTEMR.1">SSTEMR</a>( JOBZ, <span class="string">'A'</span>, N, WORK( N+1 ), WORK, VL, VU, IL,
     $                   IU, M, W, Z, LDZ, N, ISUPPZ, TRYRAC,
     $                   WORK( 2*N+1 ), LWORK-2*N, IWORK, LIWORK, INFO )
<span class="comment">*</span><span class="comment">
</span>         END IF
         IF( INFO.EQ.0 ) THEN
            M = N
            GO TO 10
         END IF
         INFO = 0
      END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Otherwise, call <a name="SSTEBZ.398"></a><a href="sstebz.f.html#SSTEBZ.1">SSTEBZ</a> and, if eigenvectors are desired, <a name="SSTEIN.398"></a><a href="sstein.f.html#SSTEIN.1">SSTEIN</a>.
</span><span class="comment">*</span><span class="comment">
</span>      IF( WANTZ ) THEN
         ORDER = <span class="string">'B'</span>
      ELSE
         ORDER = <span class="string">'E'</span>
      END IF

      CALL <a name="SSTEBZ.406"></a><a href="sstebz.f.html#SSTEBZ.1">SSTEBZ</a>( RANGE, ORDER, N, VLL, VUU, IL, IU, ABSTOL, D, E, M,
     $             NSPLIT, W, IWORK( INDIBL ), IWORK( INDISP ), WORK,
     $             IWORK( INDIWO ), INFO )
<span class="comment">*</span><span class="comment">
</span>      IF( WANTZ ) THEN
         CALL <a name="SSTEIN.411"></a><a href="sstein.f.html#SSTEIN.1">SSTEIN</a>( N, D, E, M, W, IWORK( INDIBL ), IWORK( INDISP ),
     $                Z, LDZ, WORK, IWORK( INDIWO ), IWORK( INDIFL ),
     $                INFO )
      END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     If matrix was scaled, then rescale eigenvalues appropriately.
</span><span class="comment">*</span><span class="comment">
</span>   10 CONTINUE
      IF( ISCALE.EQ.1 ) THEN
         IF( INFO.EQ.0 ) THEN
            IMAX = M
         ELSE
            IMAX = INFO - 1
         END IF
         CALL SSCAL( IMAX, ONE / SIGMA, W, 1 )
      END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     If eigenvalues are not in order, then sort them, along with
</span><span class="comment">*</span><span class="comment">     eigenvectors.
</span><span class="comment">*</span><span class="comment">
</span>      IF( WANTZ ) THEN
         DO 30 J = 1, M - 1
            I = 0
            TMP1 = W( J )
            DO 20 JJ = J + 1, M
               IF( W( JJ ).LT.TMP1 ) THEN
                  I = JJ
                  TMP1 = W( JJ )
               END IF
   20       CONTINUE
<span class="comment">*</span><span class="comment">
</span>            IF( I.NE.0 ) THEN
               W( I ) = W( J )
               W( J ) = TMP1
               CALL SSWAP( N, Z( 1, I ), 1, Z( 1, J ), 1 )
            END IF
   30    CONTINUE
      END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">      Causes problems with tests 19 &amp; 20:
</span><span class="comment">*</span><span class="comment">      IF (wantz .and. INDEIG ) Z( 1,1) = Z(1,1) / 1.002 + .002
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">
</span>      WORK( 1 ) = LWMIN
      IWORK( 1 ) = LIWMIN
      RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     End of <a name="SSTEVR.458"></a><a href="sstevr.f.html#SSTEVR.1">SSTEVR</a>
</span><span class="comment">*</span><span class="comment">
</span>      END

</pre>

 </body>
</html>

⌨️ 快捷键说明

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