sspgst.f.html

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

HTML
233
字号
      END IF
<span class="comment">*</span><span class="comment">
</span>      IF( ITYPE.EQ.1 ) THEN
         IF( UPPER ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Compute inv(U')*A*inv(U)
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           J1 and JJ are the indices of A(1,j) and A(j,j)
</span><span class="comment">*</span><span class="comment">
</span>            JJ = 0
            DO 10 J = 1, N
               J1 = JJ + 1
               JJ = JJ + J
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              Compute the j-th column of the upper triangle of A
</span><span class="comment">*</span><span class="comment">
</span>               BJJ = BP( JJ )
               CALL STPSV( UPLO, <span class="string">'Transpose'</span>, <span class="string">'Nonunit'</span>, J, BP,
     $                     AP( J1 ), 1 )
               CALL SSPMV( UPLO, J-1, -ONE, AP, BP( J1 ), 1, ONE,
     $                     AP( J1 ), 1 )
               CALL SSCAL( J-1, ONE / BJJ, AP( J1 ), 1 )
               AP( JJ ) = ( AP( JJ )-SDOT( J-1, AP( J1 ), 1, BP( J1 ),
     $                    1 ) ) / BJJ
   10       CONTINUE
         ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Compute inv(L)*A*inv(L')
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           KK and K1K1 are the indices of A(k,k) and A(k+1,k+1)
</span><span class="comment">*</span><span class="comment">
</span>            KK = 1
            DO 20 K = 1, N
               K1K1 = KK + N - K + 1
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              Update the lower triangle of A(k:n,k:n)
</span><span class="comment">*</span><span class="comment">
</span>               AKK = AP( KK )
               BKK = BP( KK )
               AKK = AKK / BKK**2
               AP( KK ) = AKK
               IF( K.LT.N ) THEN
                  CALL SSCAL( N-K, ONE / BKK, AP( KK+1 ), 1 )
                  CT = -HALF*AKK
                  CALL SAXPY( N-K, CT, BP( KK+1 ), 1, AP( KK+1 ), 1 )
                  CALL SSPR2( UPLO, N-K, -ONE, AP( KK+1 ), 1,
     $                        BP( KK+1 ), 1, AP( K1K1 ) )
                  CALL SAXPY( N-K, CT, BP( KK+1 ), 1, AP( KK+1 ), 1 )
                  CALL STPSV( UPLO, <span class="string">'No transpose'</span>, <span class="string">'Non-unit'</span>, N-K,
     $                        BP( K1K1 ), AP( KK+1 ), 1 )
               END IF
               KK = K1K1
   20       CONTINUE
         END IF
      ELSE
         IF( UPPER ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Compute U*A*U'
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           K1 and KK are the indices of A(1,k) and A(k,k)
</span><span class="comment">*</span><span class="comment">
</span>            KK = 0
            DO 30 K = 1, N
               K1 = KK + 1
               KK = KK + K
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              Update the upper triangle of A(1:k,1:k)
</span><span class="comment">*</span><span class="comment">
</span>               AKK = AP( KK )
               BKK = BP( KK )
               CALL STPMV( UPLO, <span class="string">'No transpose'</span>, <span class="string">'Non-unit'</span>, K-1, BP,
     $                     AP( K1 ), 1 )
               CT = HALF*AKK
               CALL SAXPY( K-1, CT, BP( K1 ), 1, AP( K1 ), 1 )
               CALL SSPR2( UPLO, K-1, ONE, AP( K1 ), 1, BP( K1 ), 1,
     $                     AP )
               CALL SAXPY( K-1, CT, BP( K1 ), 1, AP( K1 ), 1 )
               CALL SSCAL( K-1, BKK, AP( K1 ), 1 )
               AP( KK ) = AKK*BKK**2
   30       CONTINUE
         ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Compute L'*A*L
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           JJ and J1J1 are the indices of A(j,j) and A(j+1,j+1)
</span><span class="comment">*</span><span class="comment">
</span>            JJ = 1
            DO 40 J = 1, N
               J1J1 = JJ + N - J + 1
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              Compute the j-th column of the lower triangle of A
</span><span class="comment">*</span><span class="comment">
</span>               AJJ = AP( JJ )
               BJJ = BP( JJ )
               AP( JJ ) = AJJ*BJJ + SDOT( N-J, AP( JJ+1 ), 1,
     $                    BP( JJ+1 ), 1 )
               CALL SSCAL( N-J, BJJ, AP( JJ+1 ), 1 )
               CALL SSPMV( UPLO, N-J, ONE, AP( J1J1 ), BP( JJ+1 ), 1,
     $                     ONE, AP( JJ+1 ), 1 )
               CALL STPMV( UPLO, <span class="string">'Transpose'</span>, <span class="string">'Non-unit'</span>, N-J+1,
     $                     BP( JJ ), AP( JJ ), 1 )
               JJ = J1J1
   40       CONTINUE
         END IF
      END IF
      RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     End of <a name="SSPGST.206"></a><a href="sspgst.f.html#SSPGST.1">SSPGST</a>
</span><span class="comment">*</span><span class="comment">
</span>      END

</pre>

 </body>
</html>

⌨️ 快捷键说明

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