LAPACK  3.9.1 LAPACK: Linear Algebra PACKage

## ◆ zlassq()

 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.

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 <= ssq <= ( 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 (1+(N-1)*INCX) 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 .```

Definition at line 105 of file zlassq.f.

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