zsytrf.f.html

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

HTML
311
字号
</span>      INTRINSIC          MAX
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Executable Statements ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Test the input parameters.
</span><span class="comment">*</span><span class="comment">
</span>      INFO = 0
      UPPER = <a name="LSAME.145"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( UPLO, <span class="string">'U'</span> )
      LQUERY = ( LWORK.EQ.-1 )
      IF( .NOT.UPPER .AND. .NOT.<a name="LSAME.147"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( UPLO, <span class="string">'L'</span> ) ) THEN
         INFO = -1
      ELSE IF( N.LT.0 ) THEN
         INFO = -2
      ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
         INFO = -4
      ELSE IF( LWORK.LT.1 .AND. .NOT.LQUERY ) THEN
         INFO = -7
      END IF
<span class="comment">*</span><span class="comment">
</span>      IF( INFO.EQ.0 ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Determine the block size
</span><span class="comment">*</span><span class="comment">
</span>         NB = <a name="ILAENV.161"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="ZSYTRF.161"></a><a href="zsytrf.f.html#ZSYTRF.1">ZSYTRF</a>'</span>, UPLO, N, -1, -1, -1 )
         LWKOPT = N*NB
         WORK( 1 ) = LWKOPT
      END IF
<span class="comment">*</span><span class="comment">
</span>      IF( INFO.NE.0 ) THEN
         CALL <a name="XERBLA.167"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="ZSYTRF.167"></a><a href="zsytrf.f.html#ZSYTRF.1">ZSYTRF</a>'</span>, -INFO )
         RETURN
      ELSE IF( LQUERY ) THEN
         RETURN
      END IF
<span class="comment">*</span><span class="comment">
</span>      NBMIN = 2
      LDWORK = N
      IF( NB.GT.1 .AND. NB.LT.N ) THEN
         IWS = LDWORK*NB
         IF( LWORK.LT.IWS ) THEN
            NB = MAX( LWORK / LDWORK, 1 )
            NBMIN = MAX( 2, <a name="ILAENV.179"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 2, <span class="string">'<a name="ZSYTRF.179"></a><a href="zsytrf.f.html#ZSYTRF.1">ZSYTRF</a>'</span>, UPLO, N, -1, -1, -1 ) )
         END IF
      ELSE
         IWS = 1
      END IF
      IF( NB.LT.NBMIN )
     $   NB = N
<span class="comment">*</span><span class="comment">
</span>      IF( UPPER ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Factorize A as U*D*U' using the upper triangle of A
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        K is the main loop index, decreasing from N to 1 in steps of
</span><span class="comment">*</span><span class="comment">        KB, where KB is the number of columns factorized by <a name="ZLASYF.192"></a><a href="zlasyf.f.html#ZLASYF.1">ZLASYF</a>;
</span><span class="comment">*</span><span class="comment">        KB is either NB or NB-1, or K for the last block
</span><span class="comment">*</span><span class="comment">
</span>         K = N
   10    CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        If K &lt; 1, exit from loop
</span><span class="comment">*</span><span class="comment">
</span>         IF( K.LT.1 )
     $      GO TO 40
<span class="comment">*</span><span class="comment">
</span>         IF( K.GT.NB ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Factorize columns k-kb+1:k of A and use blocked code to
</span><span class="comment">*</span><span class="comment">           update columns 1:k-kb
</span><span class="comment">*</span><span class="comment">
</span>            CALL <a name="ZLASYF.208"></a><a href="zlasyf.f.html#ZLASYF.1">ZLASYF</a>( UPLO, K, NB, KB, A, LDA, IPIV, WORK, N, IINFO )
         ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Use unblocked code to factorize columns 1:k of A
</span><span class="comment">*</span><span class="comment">
</span>            CALL <a name="ZSYTF2.213"></a><a href="zsytf2.f.html#ZSYTF2.1">ZSYTF2</a>( UPLO, K, A, LDA, IPIV, IINFO )
            KB = K
         END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Set INFO on the first occurrence of a zero pivot
</span><span class="comment">*</span><span class="comment">
</span>         IF( INFO.EQ.0 .AND. IINFO.GT.0 )
     $      INFO = IINFO
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Decrease K and return to the start of the main loop
</span><span class="comment">*</span><span class="comment">
</span>         K = K - KB
         GO TO 10
<span class="comment">*</span><span class="comment">
</span>      ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Factorize A as L*D*L' using the lower triangle of A
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        K is the main loop index, increasing from 1 to N in steps of
</span><span class="comment">*</span><span class="comment">        KB, where KB is the number of columns factorized by <a name="ZLASYF.232"></a><a href="zlasyf.f.html#ZLASYF.1">ZLASYF</a>;
</span><span class="comment">*</span><span class="comment">        KB is either NB or NB-1, or N-K+1 for the last block
</span><span class="comment">*</span><span class="comment">
</span>         K = 1
   20    CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        If K &gt; N, exit from loop
</span><span class="comment">*</span><span class="comment">
</span>         IF( K.GT.N )
     $      GO TO 40
<span class="comment">*</span><span class="comment">
</span>         IF( K.LE.N-NB ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Factorize columns k:k+kb-1 of A and use blocked code to
</span><span class="comment">*</span><span class="comment">           update columns k+kb:n
</span><span class="comment">*</span><span class="comment">
</span>            CALL <a name="ZLASYF.248"></a><a href="zlasyf.f.html#ZLASYF.1">ZLASYF</a>( UPLO, N-K+1, NB, KB, A( K, K ), LDA, IPIV( K ),
     $                   WORK, N, IINFO )
         ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Use unblocked code to factorize columns k:n of A
</span><span class="comment">*</span><span class="comment">
</span>            CALL <a name="ZSYTF2.254"></a><a href="zsytf2.f.html#ZSYTF2.1">ZSYTF2</a>( UPLO, N-K+1, A( K, K ), LDA, IPIV( K ), IINFO )
            KB = N - K + 1
         END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Set INFO on the first occurrence of a zero pivot
</span><span class="comment">*</span><span class="comment">
</span>         IF( INFO.EQ.0 .AND. IINFO.GT.0 )
     $      INFO = IINFO + K - 1
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Adjust IPIV
</span><span class="comment">*</span><span class="comment">
</span>         DO 30 J = K, K + KB - 1
            IF( IPIV( J ).GT.0 ) THEN
               IPIV( J ) = IPIV( J ) + K - 1
            ELSE
               IPIV( J ) = IPIV( J ) - K + 1
            END IF
   30    CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Increase K and return to the start of the main loop
</span><span class="comment">*</span><span class="comment">
</span>         K = K + KB
         GO TO 20
<span class="comment">*</span><span class="comment">
</span>      END IF
<span class="comment">*</span><span class="comment">
</span>   40 CONTINUE
      WORK( 1 ) = LWKOPT
      RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     End of <a name="ZSYTRF.284"></a><a href="zsytrf.f.html#ZSYTRF.1">ZSYTRF</a>
</span><span class="comment">*</span><span class="comment">
</span>      END

</pre>

 </body>
</html>

⌨️ 快捷键说明

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