chpgst.f.html

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

HTML
240
字号
      IF( INFO.NE.0 ) THEN
         CALL <a name="XERBLA.103"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="CHPGST.103"></a><a href="chpgst.f.html#CHPGST.1">CHPGST</a>'</span>, -INFO )
         RETURN
      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>               AP( JJ ) = REAL( AP( JJ ) )
               BJJ = BP( JJ )
               CALL CTPSV( UPLO, <span class="string">'Conjugate transpose'</span>, <span class="string">'Non-unit'</span>, J,
     $                     BP, AP( J1 ), 1 )
               CALL CHPMV( UPLO, J-1, -CONE, AP, BP( J1 ), 1, CONE,
     $                     AP( J1 ), 1 )
               CALL CSSCAL( J-1, ONE / BJJ, AP( J1 ), 1 )
               AP( JJ ) = ( AP( JJ )-CDOTC( 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 CSSCAL( N-K, ONE / BKK, AP( KK+1 ), 1 )
                  CT = -HALF*AKK
                  CALL CAXPY( N-K, CT, BP( KK+1 ), 1, AP( KK+1 ), 1 )
                  CALL CHPR2( UPLO, N-K, -CONE, AP( KK+1 ), 1,
     $                        BP( KK+1 ), 1, AP( K1K1 ) )
                  CALL CAXPY( N-K, CT, BP( KK+1 ), 1, AP( KK+1 ), 1 )
                  CALL CTPSV( 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 CTPMV( UPLO, <span class="string">'No transpose'</span>, <span class="string">'Non-unit'</span>, K-1, BP,
     $                     AP( K1 ), 1 )
               CT = HALF*AKK
               CALL CAXPY( K-1, CT, BP( K1 ), 1, AP( K1 ), 1 )
               CALL CHPR2( UPLO, K-1, CONE, AP( K1 ), 1, BP( K1 ), 1,
     $                     AP )
               CALL CAXPY( K-1, CT, BP( K1 ), 1, AP( K1 ), 1 )
               CALL CSSCAL( 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 + CDOTC( N-J, AP( JJ+1 ), 1,
     $                    BP( JJ+1 ), 1 )
               CALL CSSCAL( N-J, BJJ, AP( JJ+1 ), 1 )
               CALL CHPMV( UPLO, N-J, CONE, AP( J1J1 ), BP( JJ+1 ), 1,
     $                     CONE, AP( JJ+1 ), 1 )
               CALL CTPMV( UPLO, <span class="string">'Conjugate 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="CHPGST.213"></a><a href="chpgst.f.html#CHPGST.1">CHPGST</a>
</span><span class="comment">*</span><span class="comment">
</span>      END

</pre>

 </body>
</html>

⌨️ 快捷键说明

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