LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
subroutine zlassq ( integer  N,
complex*16, dimension( * )  X,
integer  INCX,
double precision  SCALE,
double precision  SUMSQ 
)

ZLASSQ updates a sum of squares represented in scaled form.

Download ZLASSQ + dependencies [TGZ] [ZIP] [TXT]

Purpose:
 ZLASSQ returns the values scl and ssq such that

    ( scl**2 )*ssq = x( 1 )**2 +...+ x( n )**2 + ( scale**2 )*sumsq,

 where x( i ) = abs( X( 1 + ( i - 1 )*INCX ) ). The value of sumsq is
 assumed to be at least unity and the value of ssq will then satisfy

    1.0 .le. ssq .le. ( sumsq + 2*n ).

 scale is assumed to be non-negative and scl returns the value

    scl = max( scale, abs( real( x( i ) ) ), abs( aimag( x( i ) ) ) ),
           i

 scale and sumsq must be supplied in SCALE and SUMSQ respectively.
 SCALE and SUMSQ are overwritten by scl and ssq respectively.

 The routine makes only one pass through the vector X.
Parameters
[in]N
          N is INTEGER
          The number of elements to be used from the vector X.
[in]X
          X is COMPLEX*16 array, dimension (N)
          The vector x as described above.
             x( i )  = X( 1 + ( i - 1 )*INCX ), 1 <= i <= n.
[in]INCX
          INCX is INTEGER
          The increment between successive values of the vector X.
          INCX > 0.
[in,out]SCALE
          SCALE is DOUBLE PRECISION
          On entry, the value  scale  in the equation above.
          On exit, SCALE is overwritten with the value  scl .
[in,out]SUMSQ
          SUMSQ is DOUBLE PRECISION
          On entry, the value  sumsq  in the equation above.
          On exit, SUMSQ is overwritten with the value  ssq .
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
September 2012

Definition at line 108 of file zlassq.f.

108 *
109 * -- LAPACK auxiliary routine (version 3.4.2) --
110 * -- LAPACK is a software package provided by Univ. of Tennessee, --
111 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
112 * September 2012
113 *
114 * .. Scalar Arguments ..
115  INTEGER incx, n
116  DOUBLE PRECISION scale, sumsq
117 * ..
118 * .. Array Arguments ..
119  COMPLEX*16 x( * )
120 * ..
121 *
122 * =====================================================================
123 *
124 * .. Parameters ..
125  DOUBLE PRECISION zero
126  parameter ( zero = 0.0d+0 )
127 * ..
128 * .. Local Scalars ..
129  INTEGER ix
130  DOUBLE PRECISION temp1
131 * ..
132 * .. External Functions ..
133  LOGICAL disnan
134  EXTERNAL disnan
135 * ..
136 * .. Intrinsic Functions ..
137  INTRINSIC abs, dble, dimag
138 * ..
139 * .. Executable Statements ..
140 *
141  IF( n.GT.0 ) THEN
142  DO 10 ix = 1, 1 + ( n-1 )*incx, incx
143  temp1 = abs( dble( x( ix ) ) )
144  IF( temp1.GT.zero.OR.disnan( temp1 ) ) THEN
145  IF( scale.LT.temp1 ) THEN
146  sumsq = 1 + sumsq*( scale / temp1 )**2
147  scale = temp1
148  ELSE
149  sumsq = sumsq + ( temp1 / scale )**2
150  END IF
151  END IF
152  temp1 = abs( dimag( x( ix ) ) )
153  IF( temp1.GT.zero.OR.disnan( temp1 ) ) THEN
154  IF( scale.LT.temp1 ) THEN
155  sumsq = 1 + sumsq*( scale / temp1 )**2
156  scale = temp1
157  ELSE
158  sumsq = sumsq + ( temp1 / scale )**2
159  END IF
160  END IF
161  10 CONTINUE
162  END IF
163 *
164  RETURN
165 *
166 * End of ZLASSQ
167 *
logical function disnan(DIN)
DISNAN tests input for NaN.
Definition: disnan.f:61

Here is the caller graph for this function: