dspgv.f.html

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

HTML
220
字号
</span><span class="comment">*</span><span class="comment">                    The factorization of B could not be completed and
</span><span class="comment">*</span><span class="comment">                    no eigenvalues or eigenvectors were computed.
</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">     .. Local Scalars ..
</span>      LOGICAL            UPPER, WANTZ
      CHARACTER          TRANS
      INTEGER            J, NEIG
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. External Functions ..
</span>      LOGICAL            <a name="LSAME.103"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
      EXTERNAL           <a name="LSAME.104"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. External Subroutines ..
</span>      EXTERNAL           <a name="DPPTRF.107"></a><a href="dpptrf.f.html#DPPTRF.1">DPPTRF</a>, <a name="DSPEV.107"></a><a href="dspev.f.html#DSPEV.1">DSPEV</a>, <a name="DSPGST.107"></a><a href="dspgst.f.html#DSPGST.1">DSPGST</a>, DTPMV, DTPSV, <a name="XERBLA.107"></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">     .. 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>      WANTZ = <a name="LSAME.113"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( JOBZ, <span class="string">'V'</span> )
      UPPER = <a name="LSAME.114"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( UPLO, <span class="string">'U'</span> )
<span class="comment">*</span><span class="comment">
</span>      INFO = 0
      IF( ITYPE.LT.1 .OR. ITYPE.GT.3 ) THEN
         INFO = -1
      ELSE IF( .NOT.( WANTZ .OR. <a name="LSAME.119"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( JOBZ, <span class="string">'N'</span> ) ) ) THEN
         INFO = -2
      ELSE IF( .NOT.( UPPER .OR. <a name="LSAME.121"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( UPLO, <span class="string">'L'</span> ) ) ) THEN
         INFO = -3
      ELSE IF( N.LT.0 ) THEN
         INFO = -4
      ELSE IF( LDZ.LT.1 .OR. ( WANTZ .AND. LDZ.LT.N ) ) THEN
         INFO = -9
      END IF
      IF( INFO.NE.0 ) THEN
         CALL <a name="XERBLA.129"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="DSPGV.129"></a><a href="dspgv.f.html#DSPGV.1">DSPGV</a> '</span>, -INFO )
         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( N.EQ.0 )
     $   RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Form a Cholesky factorization of B.
</span><span class="comment">*</span><span class="comment">
</span>      CALL <a name="DPPTRF.140"></a><a href="dpptrf.f.html#DPPTRF.1">DPPTRF</a>( UPLO, N, BP, INFO )
      IF( INFO.NE.0 ) THEN
         INFO = N + INFO
         RETURN
      END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Transform problem to standard eigenvalue problem and solve.
</span><span class="comment">*</span><span class="comment">
</span>      CALL <a name="DSPGST.148"></a><a href="dspgst.f.html#DSPGST.1">DSPGST</a>( ITYPE, UPLO, N, AP, BP, INFO )
      CALL <a name="DSPEV.149"></a><a href="dspev.f.html#DSPEV.1">DSPEV</a>( JOBZ, UPLO, N, AP, W, Z, LDZ, WORK, INFO )
<span class="comment">*</span><span class="comment">
</span>      IF( WANTZ ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Backtransform eigenvectors to the original problem.
</span><span class="comment">*</span><span class="comment">
</span>         NEIG = N
         IF( INFO.GT.0 )
     $      NEIG = INFO - 1
         IF( ITYPE.EQ.1 .OR. ITYPE.EQ.2 ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           For A*x=(lambda)*B*x and A*B*x=(lambda)*x;
</span><span class="comment">*</span><span class="comment">           backtransform eigenvectors: x = inv(L)'*y or inv(U)*y
</span><span class="comment">*</span><span class="comment">
</span>            IF( UPPER ) THEN
               TRANS = <span class="string">'N'</span>
            ELSE
               TRANS = <span class="string">'T'</span>
            END IF
<span class="comment">*</span><span class="comment">
</span>            DO 10 J = 1, NEIG
               CALL DTPSV( UPLO, TRANS, <span class="string">'Non-unit'</span>, N, BP, Z( 1, J ),
     $                     1 )
   10       CONTINUE
<span class="comment">*</span><span class="comment">
</span>         ELSE IF( ITYPE.EQ.3 ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           For B*A*x=(lambda)*x;
</span><span class="comment">*</span><span class="comment">           backtransform eigenvectors: x = L*y or U'*y
</span><span class="comment">*</span><span class="comment">
</span>            IF( UPPER ) THEN
               TRANS = <span class="string">'T'</span>
            ELSE
               TRANS = <span class="string">'N'</span>
            END IF
<span class="comment">*</span><span class="comment">
</span>            DO 20 J = 1, NEIG
               CALL DTPMV( UPLO, TRANS, <span class="string">'Non-unit'</span>, N, BP, Z( 1, J ),
     $                     1 )
   20       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="DSPGV.193"></a><a href="dspgv.f.html#DSPGV.1">DSPGV</a>
</span><span class="comment">*</span><span class="comment">
</span>      END

</pre>

 </body>
</html>

⌨️ 快捷键说明

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