zunglq.f.html

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

HTML
240
字号
      ELSE IF( K.LT.0 .OR. K.GT.M ) THEN
         INFO = -3
      ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
         INFO = -5
      ELSE IF( LWORK.LT.MAX( 1, M ) .AND. .NOT.LQUERY ) THEN
         INFO = -8
      END IF
      IF( INFO.NE.0 ) THEN
         CALL <a name="XERBLA.110"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="ZUNGLQ.110"></a><a href="zunglq.f.html#ZUNGLQ.1">ZUNGLQ</a>'</span>, -INFO )
         RETURN
      ELSE IF( LQUERY ) THEN
         RETURN
      END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Quick return if possible
</span><span class="comment">*</span><span class="comment">
</span>      IF( M.LE.0 ) THEN
         WORK( 1 ) = 1
         RETURN
      END IF
<span class="comment">*</span><span class="comment">
</span>      NBMIN = 2
      NX = 0
      IWS = M
      IF( NB.GT.1 .AND. NB.LT.K ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Determine when to cross over from blocked to unblocked code.
</span><span class="comment">*</span><span class="comment">
</span>         NX = MAX( 0, <a name="ILAENV.130"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 3, <span class="string">'<a name="ZUNGLQ.130"></a><a href="zunglq.f.html#ZUNGLQ.1">ZUNGLQ</a>'</span>, <span class="string">' '</span>, M, N, K, -1 ) )
         IF( NX.LT.K ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Determine if workspace is large enough for blocked code.
</span><span class="comment">*</span><span class="comment">
</span>            LDWORK = M
            IWS = LDWORK*NB
            IF( LWORK.LT.IWS ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              Not enough workspace to use optimal NB:  reduce NB and
</span><span class="comment">*</span><span class="comment">              determine the minimum value of NB.
</span><span class="comment">*</span><span class="comment">
</span>               NB = LWORK / LDWORK
               NBMIN = MAX( 2, <a name="ILAENV.143"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 2, <span class="string">'<a name="ZUNGLQ.143"></a><a href="zunglq.f.html#ZUNGLQ.1">ZUNGLQ</a>'</span>, <span class="string">' '</span>, M, N, K, -1 ) )
            END IF
         END IF
      END IF
<span class="comment">*</span><span class="comment">
</span>      IF( NB.GE.NBMIN .AND. NB.LT.K .AND. NX.LT.K ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Use blocked code after the last block.
</span><span class="comment">*</span><span class="comment">        The first kk rows are handled by the block method.
</span><span class="comment">*</span><span class="comment">
</span>         KI = ( ( K-NX-1 ) / NB )*NB
         KK = MIN( K, KI+NB )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Set A(kk+1:m,1:kk) to zero.
</span><span class="comment">*</span><span class="comment">
</span>         DO 20 J = 1, KK
            DO 10 I = KK + 1, M
               A( I, J ) = ZERO
   10       CONTINUE
   20    CONTINUE
      ELSE
         KK = 0
      END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Use unblocked code for the last or only block.
</span><span class="comment">*</span><span class="comment">
</span>      IF( KK.LT.M )
     $   CALL <a name="ZUNGL2.170"></a><a href="zungl2.f.html#ZUNGL2.1">ZUNGL2</a>( M-KK, N-KK, K-KK, A( KK+1, KK+1 ), LDA,
     $                TAU( KK+1 ), WORK, IINFO )
<span class="comment">*</span><span class="comment">
</span>      IF( KK.GT.0 ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Use blocked code
</span><span class="comment">*</span><span class="comment">
</span>         DO 50 I = KI + 1, 1, -NB
            IB = MIN( NB, K-I+1 )
            IF( I+IB.LE.M ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              Form the triangular factor of the block reflector
</span><span class="comment">*</span><span class="comment">              H = H(i) H(i+1) . . . H(i+ib-1)
</span><span class="comment">*</span><span class="comment">
</span>               CALL <a name="ZLARFT.184"></a><a href="zlarft.f.html#ZLARFT.1">ZLARFT</a>( <span class="string">'Forward'</span>, <span class="string">'Rowwise'</span>, N-I+1, IB, A( I, I ),
     $                      LDA, TAU( I ), WORK, LDWORK )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              Apply H' to A(i+ib:m,i:n) from the right
</span><span class="comment">*</span><span class="comment">
</span>               CALL <a name="ZLARFB.189"></a><a href="zlarfb.f.html#ZLARFB.1">ZLARFB</a>( <span class="string">'Right'</span>, <span class="string">'Conjugate transpose'</span>, <span class="string">'Forward'</span>,
     $                      <span class="string">'Rowwise'</span>, M-I-IB+1, N-I+1, IB, A( I, I ),
     $                      LDA, WORK, LDWORK, A( I+IB, I ), LDA,
     $                      WORK( IB+1 ), LDWORK )
            END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Apply H' to columns i:n of current block
</span><span class="comment">*</span><span class="comment">
</span>            CALL <a name="ZUNGL2.197"></a><a href="zungl2.f.html#ZUNGL2.1">ZUNGL2</a>( IB, N-I+1, IB, A( I, I ), LDA, TAU( I ), WORK,
     $                   IINFO )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Set columns 1:i-1 of current block to zero
</span><span class="comment">*</span><span class="comment">
</span>            DO 40 J = 1, I - 1
               DO 30 L = I, I + IB - 1
                  A( L, J ) = ZERO
   30          CONTINUE
   40       CONTINUE
   50    CONTINUE
      END IF
<span class="comment">*</span><span class="comment">
</span>      WORK( 1 ) = IWS
      RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     End of <a name="ZUNGLQ.213"></a><a href="zunglq.f.html#ZUNGLQ.1">ZUNGLQ</a>
</span><span class="comment">*</span><span class="comment">
</span>      END

</pre>

 </body>
</html>

⌨️ 快捷键说明

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