clatbs.f.html

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

HTML
933
字号
</span><span class="comment">*</span><span class="comment">                 was not used to scale the dotproduct.
</span><span class="comment">*</span><span class="comment">
</span>                  X( J ) = X( J ) - CSUMJ
                  XJ = CABS1( X( J ) )
                  IF( NOUNIT ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                    Compute x(j) = x(j) / A(j,j), scaling if necessary.
</span><span class="comment">*</span><span class="comment">
</span>                     TJJS = AB( MAIND, J )*TSCAL
                  ELSE
                     TJJS = TSCAL
                     IF( TSCAL.EQ.ONE )
     $                  GO TO 145
                  END IF
                     TJJ = CABS1( TJJS )
                     IF( TJJ.GT.SMLNUM ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                       abs(A(j,j)) &gt; SMLNUM:
</span><span class="comment">*</span><span class="comment">
</span>                        IF( TJJ.LT.ONE ) THEN
                           IF( XJ.GT.TJJ*BIGNUM ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                             Scale X by 1/abs(x(j)).
</span><span class="comment">*</span><span class="comment">
</span>                              REC = ONE / XJ
                              CALL CSSCAL( N, REC, X, 1 )
                              SCALE = SCALE*REC
                              XMAX = XMAX*REC
                           END IF
                        END IF
                        X( J ) = <a name="CLADIV.714"></a><a href="cladiv.f.html#CLADIV.1">CLADIV</a>( X( J ), TJJS )
                     ELSE IF( TJJ.GT.ZERO ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                       0 &lt; abs(A(j,j)) &lt;= SMLNUM:
</span><span class="comment">*</span><span class="comment">
</span>                        IF( XJ.GT.TJJ*BIGNUM ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                          Scale x by (1/abs(x(j)))*abs(A(j,j))*BIGNUM.
</span><span class="comment">*</span><span class="comment">
</span>                           REC = ( TJJ*BIGNUM ) / XJ
                           CALL CSSCAL( N, REC, X, 1 )
                           SCALE = SCALE*REC
                           XMAX = XMAX*REC
                        END IF
                        X( J ) = <a name="CLADIV.728"></a><a href="cladiv.f.html#CLADIV.1">CLADIV</a>( X( J ), TJJS )
                     ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                       A(j,j) = 0:  Set x(1:n) = 0, x(j) = 1, and
</span><span class="comment">*</span><span class="comment">                       scale = 0 and compute a solution to A**T *x = 0.
</span><span class="comment">*</span><span class="comment">
</span>                        DO 140 I = 1, N
                           X( I ) = ZERO
  140                   CONTINUE
                        X( J ) = ONE
                        SCALE = ZERO
                        XMAX = ZERO
                     END IF
  145             CONTINUE
               ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                 Compute x(j) := x(j) / A(j,j) - CSUMJ if the dot
</span><span class="comment">*</span><span class="comment">                 product has already been divided by 1/A(j,j).
</span><span class="comment">*</span><span class="comment">
</span>                  X( J ) = <a name="CLADIV.747"></a><a href="cladiv.f.html#CLADIV.1">CLADIV</a>( X( J ), TJJS ) - CSUMJ
               END IF
               XMAX = MAX( XMAX, CABS1( X( J ) ) )
  150       CONTINUE
<span class="comment">*</span><span class="comment">
</span>         ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Solve A**H * x = b
</span><span class="comment">*</span><span class="comment">
</span>            DO 190 J = JFIRST, JLAST, JINC
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              Compute x(j) = b(j) - sum A(k,j)*x(k).
</span><span class="comment">*</span><span class="comment">                                    k&lt;&gt;j
</span><span class="comment">*</span><span class="comment">
</span>               XJ = CABS1( X( J ) )
               USCAL = TSCAL
               REC = ONE / MAX( XMAX, ONE )
               IF( CNORM( J ).GT.( BIGNUM-XJ )*REC ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                 If x(j) could overflow, scale x by 1/(2*XMAX).
</span><span class="comment">*</span><span class="comment">
</span>                  REC = REC*HALF
                  IF( NOUNIT ) THEN
                     TJJS = CONJG( AB( MAIND, J ) )*TSCAL
                  ELSE
                     TJJS = TSCAL
                  END IF
                     TJJ = CABS1( TJJS )
                     IF( TJJ.GT.ONE ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                       Divide by A(j,j) when scaling x if A(j,j) &gt; 1.
</span><span class="comment">*</span><span class="comment">
</span>                        REC = MIN( ONE, REC*TJJ )
                        USCAL = <a name="CLADIV.780"></a><a href="cladiv.f.html#CLADIV.1">CLADIV</a>( USCAL, TJJS )
                     END IF
                  IF( REC.LT.ONE ) THEN
                     CALL CSSCAL( N, REC, X, 1 )
                     SCALE = SCALE*REC
                     XMAX = XMAX*REC
                  END IF
               END IF
<span class="comment">*</span><span class="comment">
</span>               CSUMJ = ZERO
               IF( USCAL.EQ.CMPLX( ONE ) ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                 If the scaling needed for A in the dot product is 1,
</span><span class="comment">*</span><span class="comment">                 call CDOTC to perform the dot product.
</span><span class="comment">*</span><span class="comment">
</span>                  IF( UPPER ) THEN
                     JLEN = MIN( KD, J-1 )
                     CSUMJ = CDOTC( JLEN, AB( KD+1-JLEN, J ), 1,
     $                       X( J-JLEN ), 1 )
                  ELSE
                     JLEN = MIN( KD, N-J )
                     IF( JLEN.GT.1 )
     $                  CSUMJ = CDOTC( JLEN, AB( 2, J ), 1, X( J+1 ),
     $                          1 )
                  END IF
               ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                 Otherwise, use in-line code for the dot product.
</span><span class="comment">*</span><span class="comment">
</span>                  IF( UPPER ) THEN
                     JLEN = MIN( KD, J-1 )
                     DO 160 I = 1, JLEN
                        CSUMJ = CSUMJ + ( CONJG( AB( KD+I-JLEN, J ) )*
     $                          USCAL )*X( J-JLEN-1+I )
  160                CONTINUE
                  ELSE
                     JLEN = MIN( KD, N-J )
                     DO 170 I = 1, JLEN
                        CSUMJ = CSUMJ + ( CONJG( AB( I+1, J ) )*USCAL )*
     $                          X( J+I )
  170                CONTINUE
                  END IF
               END IF
<span class="comment">*</span><span class="comment">
</span>               IF( USCAL.EQ.CMPLX( TSCAL ) ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                 Compute x(j) := ( x(j) - CSUMJ ) / A(j,j) if 1/A(j,j)
</span><span class="comment">*</span><span class="comment">                 was not used to scale the dotproduct.
</span><span class="comment">*</span><span class="comment">
</span>                  X( J ) = X( J ) - CSUMJ
                  XJ = CABS1( X( J ) )
                  IF( NOUNIT ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                    Compute x(j) = x(j) / A(j,j), scaling if necessary.
</span><span class="comment">*</span><span class="comment">
</span>                     TJJS = CONJG( AB( MAIND, J ) )*TSCAL
                  ELSE
                     TJJS = TSCAL
                     IF( TSCAL.EQ.ONE )
     $                  GO TO 185
                  END IF
                     TJJ = CABS1( TJJS )
                     IF( TJJ.GT.SMLNUM ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                       abs(A(j,j)) &gt; SMLNUM:
</span><span class="comment">*</span><span class="comment">
</span>                        IF( TJJ.LT.ONE ) THEN
                           IF( XJ.GT.TJJ*BIGNUM ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                             Scale X by 1/abs(x(j)).
</span><span class="comment">*</span><span class="comment">
</span>                              REC = ONE / XJ
                              CALL CSSCAL( N, REC, X, 1 )
                              SCALE = SCALE*REC
                              XMAX = XMAX*REC
                           END IF
                        END IF
                        X( J ) = <a name="CLADIV.857"></a><a href="cladiv.f.html#CLADIV.1">CLADIV</a>( X( J ), TJJS )
                     ELSE IF( TJJ.GT.ZERO ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                       0 &lt; abs(A(j,j)) &lt;= SMLNUM:
</span><span class="comment">*</span><span class="comment">
</span>                        IF( XJ.GT.TJJ*BIGNUM ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                          Scale x by (1/abs(x(j)))*abs(A(j,j))*BIGNUM.
</span><span class="comment">*</span><span class="comment">
</span>                           REC = ( TJJ*BIGNUM ) / XJ
                           CALL CSSCAL( N, REC, X, 1 )
                           SCALE = SCALE*REC
                           XMAX = XMAX*REC
                        END IF
                        X( J ) = <a name="CLADIV.871"></a><a href="cladiv.f.html#CLADIV.1">CLADIV</a>( X( J ), TJJS )
                     ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                       A(j,j) = 0:  Set x(1:n) = 0, x(j) = 1, and
</span><span class="comment">*</span><span class="comment">                       scale = 0 and compute a solution to A**H *x = 0.
</span><span class="comment">*</span><span class="comment">
</span>                        DO 180 I = 1, N
                           X( I ) = ZERO
  180                   CONTINUE
                        X( J ) = ONE
                        SCALE = ZERO
                        XMAX = ZERO
                     END IF
  185             CONTINUE
               ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                 Compute x(j) := x(j) / A(j,j) - CSUMJ if the dot
</span><span class="comment">*</span><span class="comment">                 product has already been divided by 1/A(j,j).
</span><span class="comment">*</span><span class="comment">
</span>                  X( J ) = <a name="CLADIV.890"></a><a href="cladiv.f.html#CLADIV.1">CLADIV</a>( X( J ), TJJS ) - CSUMJ
               END IF
               XMAX = MAX( XMAX, CABS1( X( J ) ) )
  190       CONTINUE
         END IF
         SCALE = SCALE / TSCAL
      END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Scale the column norms by 1/TSCAL for return.
</span><span class="comment">*</span><span class="comment">
</span>      IF( TSCAL.NE.ONE ) THEN
         CALL SSCAL( N, ONE / TSCAL, CNORM, 1 )
      END IF
<span class="comment">*</span><span class="comment">
</span>      RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     End of <a name="CLATBS.906"></a><a href="clatbs.f.html#CLATBS.1">CLATBS</a>
</span><span class="comment">*</span><span class="comment">
</span>      END

</pre>

 </body>
</html>

⌨️ 快捷键说明

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