sgebd2.f.html

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

HTML
264
字号
</span><span class="comment">*</span><span class="comment">    (  v1  d   e   u2  u2 )           (  e   d   u2  u2  u2  u2 )
</span><span class="comment">*</span><span class="comment">    (  v1  v2  d   e   u3 )           (  v1  e   d   u3  u3  u3 )
</span><span class="comment">*</span><span class="comment">    (  v1  v2  v3  d   e  )           (  v1  v2  e   d   u4  u4 )
</span><span class="comment">*</span><span class="comment">    (  v1  v2  v3  v4  d  )           (  v1  v2  v3  e   d   u5 )
</span><span class="comment">*</span><span class="comment">    (  v1  v2  v3  v4  v5 )
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  where d and e denote diagonal and off-diagonal elements of B, vi
</span><span class="comment">*</span><span class="comment">  denotes an element of the vector defining H(i), and ui an element of
</span><span class="comment">*</span><span class="comment">  the vector defining G(i).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  =====================================================================
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     .. Parameters ..
</span>      REAL               ZERO, ONE
      PARAMETER          ( ZERO = 0.0E+0, ONE = 1.0E+0 )
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Local Scalars ..
</span>      INTEGER            I
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. External Subroutines ..
</span>      EXTERNAL           <a name="SLARF.134"></a><a href="slarf.f.html#SLARF.1">SLARF</a>, <a name="SLARFG.134"></a><a href="slarfg.f.html#SLARFG.1">SLARFG</a>, <a name="XERBLA.134"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Intrinsic Functions ..
</span>      INTRINSIC          MAX, MIN
<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
      IF( M.LT.0 ) THEN
         INFO = -1
      ELSE IF( N.LT.0 ) THEN
         INFO = -2
      ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
         INFO = -4
      END IF
      IF( INFO.LT.0 ) THEN
         CALL <a name="XERBLA.152"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="SGEBD2.152"></a><a href="sgebd2.f.html#SGEBD2.1">SGEBD2</a>'</span>, -INFO )
         RETURN
      END IF
<span class="comment">*</span><span class="comment">
</span>      IF( M.GE.N ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Reduce to upper bidiagonal form
</span><span class="comment">*</span><span class="comment">
</span>         DO 10 I = 1, N
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Generate elementary reflector H(i) to annihilate A(i+1:m,i)
</span><span class="comment">*</span><span class="comment">
</span>            CALL <a name="SLARFG.164"></a><a href="slarfg.f.html#SLARFG.1">SLARFG</a>( M-I+1, A( I, I ), A( MIN( I+1, M ), I ), 1,
     $                   TAUQ( I ) )
            D( I ) = A( I, I )
            A( I, I ) = ONE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Apply H(i) to A(i:m,i+1:n) from the left
</span><span class="comment">*</span><span class="comment">
</span>            IF( I.LT.N )
     $         CALL <a name="SLARF.172"></a><a href="slarf.f.html#SLARF.1">SLARF</a>( <span class="string">'Left'</span>, M-I+1, N-I, A( I, I ), 1, TAUQ( I ),
     $                     A( I, I+1 ), LDA, WORK )
            A( I, I ) = D( I )
<span class="comment">*</span><span class="comment">
</span>            IF( I.LT.N ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              Generate elementary reflector G(i) to annihilate
</span><span class="comment">*</span><span class="comment">              A(i,i+2:n)
</span><span class="comment">*</span><span class="comment">
</span>               CALL <a name="SLARFG.181"></a><a href="slarfg.f.html#SLARFG.1">SLARFG</a>( N-I, A( I, I+1 ), A( I, MIN( I+2, N ) ),
     $                      LDA, TAUP( I ) )
               E( I ) = A( I, I+1 )
               A( I, I+1 ) = ONE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              Apply G(i) to A(i+1:m,i+1:n) from the right
</span><span class="comment">*</span><span class="comment">
</span>               CALL <a name="SLARF.188"></a><a href="slarf.f.html#SLARF.1">SLARF</a>( <span class="string">'Right'</span>, M-I, N-I, A( I, I+1 ), LDA,
     $                     TAUP( I ), A( I+1, I+1 ), LDA, WORK )
               A( I, I+1 ) = E( I )
            ELSE
               TAUP( I ) = ZERO
            END IF
   10    CONTINUE
      ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Reduce to lower bidiagonal form
</span><span class="comment">*</span><span class="comment">
</span>         DO 20 I = 1, M
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Generate elementary reflector G(i) to annihilate A(i,i+1:n)
</span><span class="comment">*</span><span class="comment">
</span>            CALL <a name="SLARFG.203"></a><a href="slarfg.f.html#SLARFG.1">SLARFG</a>( N-I+1, A( I, I ), A( I, MIN( I+1, N ) ), LDA,
     $                   TAUP( I ) )
            D( I ) = A( I, I )
            A( I, I ) = ONE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Apply G(i) to A(i+1:m,i:n) from the right
</span><span class="comment">*</span><span class="comment">
</span>            IF( I.LT.M )
     $         CALL <a name="SLARF.211"></a><a href="slarf.f.html#SLARF.1">SLARF</a>( <span class="string">'Right'</span>, M-I, N-I+1, A( I, I ), LDA,
     $                     TAUP( I ), A( I+1, I ), LDA, WORK )
            A( I, I ) = D( I )
<span class="comment">*</span><span class="comment">
</span>            IF( I.LT.M ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              Generate elementary reflector H(i) to annihilate
</span><span class="comment">*</span><span class="comment">              A(i+2:m,i)
</span><span class="comment">*</span><span class="comment">
</span>               CALL <a name="SLARFG.220"></a><a href="slarfg.f.html#SLARFG.1">SLARFG</a>( M-I, A( I+1, I ), A( MIN( I+2, M ), I ), 1,
     $                      TAUQ( I ) )
               E( I ) = A( I+1, I )
               A( I+1, I ) = ONE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              Apply H(i) to A(i+1:m,i+1:n) from the left
</span><span class="comment">*</span><span class="comment">
</span>               CALL <a name="SLARF.227"></a><a href="slarf.f.html#SLARF.1">SLARF</a>( <span class="string">'Left'</span>, M-I, N-I, A( I+1, I ), 1, TAUQ( I ),
     $                     A( I+1, I+1 ), LDA, WORK )
               A( I+1, I ) = E( I )
            ELSE
               TAUQ( I ) = ZERO
            END IF
   20    CONTINUE
      END IF
      RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     End of <a name="SGEBD2.237"></a><a href="sgebd2.f.html#SGEBD2.1">SGEBD2</a>
</span><span class="comment">*</span><span class="comment">
</span>      END

</pre>

 </body>
</html>

⌨️ 快捷键说明

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