LAPACK  3.6.1 LAPACK: Linear Algebra PACKage
 subroutine classq ( integer N, complex, dimension( * ) X, integer INCX, real SCALE, real SUMSQ )

CLASSQ updates a sum of squares represented in scaled form.

Purpose:
``` CLASSQ 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 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 REAL On entry, the value scale in the equation above. On exit, SCALE is overwritten with the value scl .``` [in,out] SUMSQ ``` SUMSQ is REAL On entry, the value sumsq in the equation above. On exit, SUMSQ is overwritten with the value ssq .```
Date
September 2012

Definition at line 108 of file classq.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  REAL scale, sumsq
117 * ..
118 * .. Array Arguments ..
119  COMPLEX x( * )
120 * ..
121 *
122 * =====================================================================
123 *
124 * .. Parameters ..
125  REAL zero
126  parameter ( zero = 0.0e+0 )
127 * ..
128 * .. Local Scalars ..
129  INTEGER ix
130  REAL temp1
131 * ..
132 * .. External Functions ..
133  LOGICAL sisnan
134  EXTERNAL sisnan
135 * ..
136 * .. Intrinsic Functions ..
137  INTRINSIC abs, aimag, real
138 * ..
139 * .. Executable Statements ..
140 *
141  IF( n.GT.0 ) THEN
142  DO 10 ix = 1, 1 + ( n-1 )*incx, incx
143  temp1 = abs( REAL( X( IX ) ) )
144  IF( temp1.GT.zero.OR.sisnan( 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( aimag( x( ix ) ) )
153  IF( temp1.GT.zero.OR.sisnan( temp1 ) ) THEN
154  IF( scale.LT.temp1 .OR. sisnan( 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 CLASSQ
167 *
logical function sisnan(SIN)
SISNAN tests input for NaN.
Definition: sisnan.f:61

Here is the caller graph for this function: