ctbcon.f.html

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

HTML
234
字号
      EXTERNAL           <a name="LSAME.99"></a><a href="lsame.f.html#LSAME.1">LSAME</a>, ICAMAX, <a name="CLANTB.99"></a><a href="clantb.f.html#CLANTB.1">CLANTB</a>, <a name="SLAMCH.99"></a><a href="slamch.f.html#SLAMCH.1">SLAMCH</a>
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. External Subroutines ..
</span>      EXTERNAL           <a name="CLACN2.102"></a><a href="clacn2.f.html#CLACN2.1">CLACN2</a>, <a name="CLATBS.102"></a><a href="clatbs.f.html#CLATBS.1">CLATBS</a>, <a name="CSRSCL.102"></a><a href="csrscl.f.html#CSRSCL.1">CSRSCL</a>, <a name="XERBLA.102"></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          ABS, AIMAG, MAX, REAL
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Statement Functions ..
</span>      REAL               CABS1
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Statement Function definitions ..
</span>      CABS1( ZDUM ) = ABS( REAL( ZDUM ) ) + ABS( AIMAG( ZDUM ) )
<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
      UPPER = <a name="LSAME.118"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( UPLO, <span class="string">'U'</span> )
      ONENRM = NORM.EQ.<span class="string">'1'</span> .OR. <a name="LSAME.119"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( NORM, <span class="string">'O'</span> )
      NOUNIT = <a name="LSAME.120"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( DIAG, <span class="string">'N'</span> )
<span class="comment">*</span><span class="comment">
</span>      IF( .NOT.ONENRM .AND. .NOT.<a name="LSAME.122"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( NORM, <span class="string">'I'</span> ) ) THEN
         INFO = -1
      ELSE IF( .NOT.UPPER .AND. .NOT.<a name="LSAME.124"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( UPLO, <span class="string">'L'</span> ) ) THEN
         INFO = -2
      ELSE IF( .NOT.NOUNIT .AND. .NOT.<a name="LSAME.126"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( DIAG, <span class="string">'U'</span> ) ) THEN
         INFO = -3
      ELSE IF( N.LT.0 ) THEN
         INFO = -4
      ELSE IF( KD.LT.0 ) THEN
         INFO = -5
      ELSE IF( LDAB.LT.KD+1 ) THEN
         INFO = -7
      END IF
      IF( INFO.NE.0 ) THEN
         CALL <a name="XERBLA.136"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="CTBCON.136"></a><a href="ctbcon.f.html#CTBCON.1">CTBCON</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 ) THEN
         RCOND = ONE
         RETURN
      END IF
<span class="comment">*</span><span class="comment">
</span>      RCOND = ZERO
      SMLNUM = <a name="SLAMCH.148"></a><a href="slamch.f.html#SLAMCH.1">SLAMCH</a>( <span class="string">'Safe minimum'</span> )*REAL( MAX( N, 1 ) )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Compute the 1-norm of the triangular matrix A or A'.
</span><span class="comment">*</span><span class="comment">
</span>      ANORM = <a name="CLANTB.152"></a><a href="clantb.f.html#CLANTB.1">CLANTB</a>( NORM, UPLO, DIAG, N, KD, AB, LDAB, RWORK )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Continue only if ANORM &gt; 0.
</span><span class="comment">*</span><span class="comment">
</span>      IF( ANORM.GT.ZERO ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Estimate the 1-norm of the inverse of A.
</span><span class="comment">*</span><span class="comment">
</span>         AINVNM = ZERO
         NORMIN = <span class="string">'N'</span>
         IF( ONENRM ) THEN
            KASE1 = 1
         ELSE
            KASE1 = 2
         END IF
         KASE = 0
   10    CONTINUE
         CALL <a name="CLACN2.169"></a><a href="clacn2.f.html#CLACN2.1">CLACN2</a>( N, WORK( N+1 ), WORK, AINVNM, KASE, ISAVE )
         IF( KASE.NE.0 ) THEN
            IF( KASE.EQ.KASE1 ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              Multiply by inv(A).
</span><span class="comment">*</span><span class="comment">
</span>               CALL <a name="CLATBS.175"></a><a href="clatbs.f.html#CLATBS.1">CLATBS</a>( UPLO, <span class="string">'No transpose'</span>, DIAG, NORMIN, N, KD,
     $                      AB, LDAB, WORK, SCALE, RWORK, INFO )
            ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              Multiply by inv(A').
</span><span class="comment">*</span><span class="comment">
</span>               CALL <a name="CLATBS.181"></a><a href="clatbs.f.html#CLATBS.1">CLATBS</a>( UPLO, <span class="string">'Conjugate transpose'</span>, DIAG, NORMIN,
     $                      N, KD, AB, LDAB, WORK, SCALE, RWORK, INFO )
            END IF
            NORMIN = <span class="string">'Y'</span>
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Multiply by 1/SCALE if doing so will not cause overflow.
</span><span class="comment">*</span><span class="comment">
</span>            IF( SCALE.NE.ONE ) THEN
               IX = ICAMAX( N, WORK, 1 )
               XNORM = CABS1( WORK( IX ) )
               IF( SCALE.LT.XNORM*SMLNUM .OR. SCALE.EQ.ZERO )
     $            GO TO 20
               CALL <a name="CSRSCL.193"></a><a href="csrscl.f.html#CSRSCL.1">CSRSCL</a>( N, SCALE, WORK, 1 )
            END IF
            GO TO 10
         END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Compute the estimate of the reciprocal condition number.
</span><span class="comment">*</span><span class="comment">
</span>         IF( AINVNM.NE.ZERO )
     $      RCOND = ( ONE / ANORM ) / AINVNM
      END IF
<span class="comment">*</span><span class="comment">
</span>   20 CONTINUE
      RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     End of <a name="CTBCON.207"></a><a href="ctbcon.f.html#CTBCON.1">CTBCON</a>
</span><span class="comment">*</span><span class="comment">
</span>      END

</pre>

 </body>
</html>

⌨️ 快捷键说明

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