slaed0.f.html

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

HTML
374
字号
         TLVLS = TLVLS + 1
         SUBPBS = 2*SUBPBS
         GO TO 10
      END IF
      DO 30 J = 2, SUBPBS
         IWORK( J ) = IWORK( J ) + IWORK( J-1 )
   30 CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Divide the matrix into SUBPBS submatrices of size at most SMLSIZ+1
</span><span class="comment">*</span><span class="comment">     using rank-1 modifications (cuts).
</span><span class="comment">*</span><span class="comment">
</span>      SPM1 = SUBPBS - 1
      DO 40 I = 1, SPM1
         SUBMAT = IWORK( I ) + 1
         SMM1 = SUBMAT - 1
         D( SMM1 ) = D( SMM1 ) - ABS( E( SMM1 ) )
         D( SUBMAT ) = D( SUBMAT ) - ABS( E( SMM1 ) )
   40 CONTINUE
<span class="comment">*</span><span class="comment">
</span>      INDXQ = 4*N + 3
      IF( ICOMPQ.NE.2 ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Set up workspaces for eigenvalues only/accumulate new vectors
</span><span class="comment">*</span><span class="comment">        routine
</span><span class="comment">*</span><span class="comment">
</span>         TEMP = LOG( REAL( N ) ) / LOG( TWO )
         LGN = INT( TEMP )
         IF( 2**LGN.LT.N )
     $      LGN = LGN + 1
         IF( 2**LGN.LT.N )
     $      LGN = LGN + 1
         IPRMPT = INDXQ + N + 1
         IPERM = IPRMPT + N*LGN
         IQPTR = IPERM + N*LGN
         IGIVPT = IQPTR + N + 2
         IGIVCL = IGIVPT + N*LGN
<span class="comment">*</span><span class="comment">
</span>         IGIVNM = 1
         IQ = IGIVNM + 2*N*LGN
         IWREM = IQ + N**2 + 1
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Initialize pointers
</span><span class="comment">*</span><span class="comment">
</span>         DO 50 I = 0, SUBPBS
            IWORK( IPRMPT+I ) = 1
            IWORK( IGIVPT+I ) = 1
   50    CONTINUE
         IWORK( IQPTR ) = 1
      END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Solve each submatrix eigenproblem at the bottom of the divide and
</span><span class="comment">*</span><span class="comment">     conquer tree.
</span><span class="comment">*</span><span class="comment">
</span>      CURR = 0
      DO 70 I = 0, SPM1
         IF( I.EQ.0 ) THEN
            SUBMAT = 1
            MATSIZ = IWORK( 1 )
         ELSE
            SUBMAT = IWORK( I ) + 1
            MATSIZ = IWORK( I+1 ) - IWORK( I )
         END IF
         IF( ICOMPQ.EQ.2 ) THEN
            CALL <a name="SSTEQR.232"></a><a href="ssteqr.f.html#SSTEQR.1">SSTEQR</a>( <span class="string">'I'</span>, MATSIZ, D( SUBMAT ), E( SUBMAT ),
     $                   Q( SUBMAT, SUBMAT ), LDQ, WORK, INFO )
            IF( INFO.NE.0 )
     $         GO TO 130
         ELSE
            CALL <a name="SSTEQR.237"></a><a href="ssteqr.f.html#SSTEQR.1">SSTEQR</a>( <span class="string">'I'</span>, MATSIZ, D( SUBMAT ), E( SUBMAT ),
     $                   WORK( IQ-1+IWORK( IQPTR+CURR ) ), MATSIZ, WORK,
     $                   INFO )
            IF( INFO.NE.0 )
     $         GO TO 130
            IF( ICOMPQ.EQ.1 ) THEN
               CALL SGEMM( <span class="string">'N'</span>, <span class="string">'N'</span>, QSIZ, MATSIZ, MATSIZ, ONE,
     $                     Q( 1, SUBMAT ), LDQ, WORK( IQ-1+IWORK( IQPTR+
     $                     CURR ) ), MATSIZ, ZERO, QSTORE( 1, SUBMAT ),
     $                     LDQS )
            END IF
            IWORK( IQPTR+CURR+1 ) = IWORK( IQPTR+CURR ) + MATSIZ**2
            CURR = CURR + 1
         END IF
         K = 1
         DO 60 J = SUBMAT, IWORK( I+1 )
            IWORK( INDXQ+J ) = K
            K = K + 1
   60    CONTINUE
   70 CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Successively merge eigensystems of adjacent submatrices
</span><span class="comment">*</span><span class="comment">     into eigensystem for the corresponding larger matrix.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     while ( SUBPBS &gt; 1 )
</span><span class="comment">*</span><span class="comment">
</span>      CURLVL = 1
   80 CONTINUE
      IF( SUBPBS.GT.1 ) THEN
         SPM2 = SUBPBS - 2
         DO 90 I = 0, SPM2, 2
            IF( I.EQ.0 ) THEN
               SUBMAT = 1
               MATSIZ = IWORK( 2 )
               MSD2 = IWORK( 1 )
               CURPRB = 0
            ELSE
               SUBMAT = IWORK( I ) + 1
               MATSIZ = IWORK( I+2 ) - IWORK( I )
               MSD2 = MATSIZ / 2
               CURPRB = CURPRB + 1
            END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Merge lower order eigensystems (of size MSD2 and MATSIZ - MSD2)
</span><span class="comment">*</span><span class="comment">     into an eigensystem of size MATSIZ.
</span><span class="comment">*</span><span class="comment">     <a name="SLAED1.282"></a><a href="slaed1.f.html#SLAED1.1">SLAED1</a> is used only for the full eigensystem of a tridiagonal
</span><span class="comment">*</span><span class="comment">     matrix.
</span><span class="comment">*</span><span class="comment">     <a name="SLAED7.284"></a><a href="slaed7.f.html#SLAED7.1">SLAED7</a> handles the cases in which eigenvalues only or eigenvalues
</span><span class="comment">*</span><span class="comment">     and eigenvectors of a full symmetric matrix (which was reduced to
</span><span class="comment">*</span><span class="comment">     tridiagonal form) are desired.
</span><span class="comment">*</span><span class="comment">
</span>            IF( ICOMPQ.EQ.2 ) THEN
               CALL <a name="SLAED1.289"></a><a href="slaed1.f.html#SLAED1.1">SLAED1</a>( MATSIZ, D( SUBMAT ), Q( SUBMAT, SUBMAT ),
     $                      LDQ, IWORK( INDXQ+SUBMAT ),
     $                      E( SUBMAT+MSD2-1 ), MSD2, WORK,
     $                      IWORK( SUBPBS+1 ), INFO )
            ELSE
               CALL <a name="SLAED7.294"></a><a href="slaed7.f.html#SLAED7.1">SLAED7</a>( ICOMPQ, MATSIZ, QSIZ, TLVLS, CURLVL, CURPRB,
     $                      D( SUBMAT ), QSTORE( 1, SUBMAT ), LDQS,
     $                      IWORK( INDXQ+SUBMAT ), E( SUBMAT+MSD2-1 ),
     $                      MSD2, WORK( IQ ), IWORK( IQPTR ),
     $                      IWORK( IPRMPT ), IWORK( IPERM ),
     $                      IWORK( IGIVPT ), IWORK( IGIVCL ),
     $                      WORK( IGIVNM ), WORK( IWREM ),
     $                      IWORK( SUBPBS+1 ), INFO )
            END IF
            IF( INFO.NE.0 )
     $         GO TO 130
            IWORK( I / 2+1 ) = IWORK( I+2 )
   90    CONTINUE
         SUBPBS = SUBPBS / 2
         CURLVL = CURLVL + 1
         GO TO 80
      END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     end while
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Re-merge the eigenvalues/vectors which were deflated at the final
</span><span class="comment">*</span><span class="comment">     merge step.
</span><span class="comment">*</span><span class="comment">
</span>      IF( ICOMPQ.EQ.1 ) THEN
         DO 100 I = 1, N
            J = IWORK( INDXQ+I )
            WORK( I ) = D( J )
            CALL SCOPY( QSIZ, QSTORE( 1, J ), 1, Q( 1, I ), 1 )
  100    CONTINUE
         CALL SCOPY( N, WORK, 1, D, 1 )
      ELSE IF( ICOMPQ.EQ.2 ) THEN
         DO 110 I = 1, N
            J = IWORK( INDXQ+I )
            WORK( I ) = D( J )
            CALL SCOPY( N, Q( 1, J ), 1, WORK( N*I+1 ), 1 )
  110    CONTINUE
         CALL SCOPY( N, WORK, 1, D, 1 )
         CALL <a name="SLACPY.331"></a><a href="slacpy.f.html#SLACPY.1">SLACPY</a>( <span class="string">'A'</span>, N, N, WORK( N+1 ), N, Q, LDQ )
      ELSE
         DO 120 I = 1, N
            J = IWORK( INDXQ+I )
            WORK( I ) = D( J )
  120    CONTINUE
         CALL SCOPY( N, WORK, 1, D, 1 )
      END IF
      GO TO 140
<span class="comment">*</span><span class="comment">
</span>  130 CONTINUE
      INFO = SUBMAT*( N+1 ) + SUBMAT + MATSIZ - 1
<span class="comment">*</span><span class="comment">
</span>  140 CONTINUE
      RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     End of <a name="SLAED0.347"></a><a href="slaed0.f.html#SLAED0.1">SLAED0</a>
</span><span class="comment">*</span><span class="comment">
</span>      END

</pre>

 </body>
</html>

⌨️ 快捷键说明

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