zlassq.f.html

来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 124 行

HTML
124
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
 <head>
  <title>zlassq.f</title>
 <meta name="generator" content="emacs 21.3.1; htmlfontify 0.20">
<style type="text/css"><!-- 
body { background: rgb(255, 255, 255);  color: rgb(0, 0, 0);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.default   { background: rgb(255, 255, 255);  color: rgb(0, 0, 0);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.default a { background: rgb(255, 255, 255);  color: rgb(0, 0, 0);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: underline; }
span.comment   { color: rgb(178, 34, 34);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.comment a { color: rgb(178, 34, 34);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: underline; }
 --></style>

 </head>
  <body>

<pre>
      SUBROUTINE <a name="ZLASSQ.1"></a><a href="zlassq.f.html#ZLASSQ.1">ZLASSQ</a>( N, X, INCX, SCALE, SUMSQ )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  -- LAPACK auxiliary routine (version 3.1) --
</span><span class="comment">*</span><span class="comment">     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
</span><span class="comment">*</span><span class="comment">     November 2006
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     .. Scalar Arguments ..
</span>      INTEGER            INCX, N
      DOUBLE PRECISION   SCALE, SUMSQ
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Array Arguments ..
</span>      COMPLEX*16         X( * )
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Purpose
</span><span class="comment">*</span><span class="comment">  =======
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  <a name="ZLASSQ.18"></a><a href="zlassq.f.html#ZLASSQ.1">ZLASSQ</a> returns the values scl and ssq such that
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     ( scl**2 )*ssq = x( 1 )**2 +...+ x( n )**2 + ( scale**2 )*sumsq,
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  where x( i ) = abs( X( 1 + ( i - 1 )*INCX ) ). The value of sumsq is
</span><span class="comment">*</span><span class="comment">  assumed to be at least unity and the value of ssq will then satisfy
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     1.0 .le. ssq .le. ( sumsq + 2*n ).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  scale is assumed to be non-negative and scl returns the value
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     scl = max( scale, abs( real( x( i ) ) ), abs( aimag( x( i ) ) ) ),
</span><span class="comment">*</span><span class="comment">            i
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  scale and sumsq must be supplied in SCALE and SUMSQ respectively.
</span><span class="comment">*</span><span class="comment">  SCALE and SUMSQ are overwritten by scl and ssq respectively.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  The routine makes only one pass through the vector X.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Arguments
</span><span class="comment">*</span><span class="comment">  =========
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  N       (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The number of elements to be used from the vector X.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  X       (input) COMPLEX*16 array, dimension (N)
</span><span class="comment">*</span><span class="comment">          The vector x as described above.
</span><span class="comment">*</span><span class="comment">             x( i )  = X( 1 + ( i - 1 )*INCX ), 1 &lt;= i &lt;= n.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  INCX    (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The increment between successive values of the vector X.
</span><span class="comment">*</span><span class="comment">          INCX &gt; 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  SCALE   (input/output) DOUBLE PRECISION
</span><span class="comment">*</span><span class="comment">          On entry, the value  scale  in the equation above.
</span><span class="comment">*</span><span class="comment">          On exit, SCALE is overwritten with the value  scl .
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  SUMSQ   (input/output) DOUBLE PRECISION
</span><span class="comment">*</span><span class="comment">          On entry, the value  sumsq  in the equation above.
</span><span class="comment">*</span><span class="comment">          On exit, SUMSQ is overwritten with the value  ssq .
</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">     .. Parameters ..
</span>      DOUBLE PRECISION   ZERO
      PARAMETER          ( ZERO = 0.0D+0 )
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Local Scalars ..
</span>      INTEGER            IX
      DOUBLE PRECISION   TEMP1
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Intrinsic Functions ..
</span>      INTRINSIC          ABS, DBLE, DIMAG
<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>      IF( N.GT.0 ) THEN
         DO 10 IX = 1, 1 + ( N-1 )*INCX, INCX
            IF( DBLE( X( IX ) ).NE.ZERO ) THEN
               TEMP1 = ABS( DBLE( X( IX ) ) )
               IF( SCALE.LT.TEMP1 ) THEN
                  SUMSQ = 1 + SUMSQ*( SCALE / TEMP1 )**2
                  SCALE = TEMP1
               ELSE
                  SUMSQ = SUMSQ + ( TEMP1 / SCALE )**2
               END IF
            END IF
            IF( DIMAG( X( IX ) ).NE.ZERO ) THEN
               TEMP1 = ABS( DIMAG( X( IX ) ) )
               IF( SCALE.LT.TEMP1 ) THEN
                  SUMSQ = 1 + SUMSQ*( SCALE / TEMP1 )**2
                  SCALE = TEMP1
               ELSE
                  SUMSQ = SUMSQ + ( TEMP1 / SCALE )**2
               END IF
            END IF
   10    CONTINUE
      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="ZLASSQ.99"></a><a href="zlassq.f.html#ZLASSQ.1">ZLASSQ</a>
</span><span class="comment">*</span><span class="comment">
</span>      END

</pre>

 </body>
</html>

⌨️ 快捷键说明

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