1 *> \brief \b DLASSQ updates a sum of squares represented in scaled form.
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download DLASSQ + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dlassq.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dlassq.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dlassq.f">
21 * SUBROUTINE DLASSQ( N, X, INCX, SCALE, SUMSQ )
23 * .. Scalar Arguments ..
25 * DOUBLE PRECISION SCALE, SUMSQ
27 * .. Array Arguments ..
28 * DOUBLE PRECISION X( * )
37 *> DLASSQ returns the values scl and smsq such that
39 *> ( scl**2 )*smsq = x( 1 )**2 +...+ x( n )**2 + ( scale**2 )*sumsq,
41 *> where x( i ) = X( 1 + ( i - 1 )*INCX ). The value of sumsq is
42 *> assumed to be non-negative and scl returns the value
44 *> scl = max( scale, abs( x( i ) ) ).
46 *> scale and sumsq must be supplied in SCALE and SUMSQ and
47 *> scl and smsq are overwritten on SCALE and SUMSQ respectively.
49 *> The routine makes only one pass through the vector x.
58 *> The number of elements to be used from the vector X.
63 *> X is DOUBLE PRECISION array, dimension (N)
64 *> The vector for which a scaled sum of squares is computed.
65 *> x( i ) = X( 1 + ( i - 1 )*INCX ), 1 <= i <= n.
71 *> The increment between successive values of the vector X.
75 *> \param[in,out] SCALE
77 *> SCALE is DOUBLE PRECISION
78 *> On entry, the value scale in the equation above.
79 *> On exit, SCALE is overwritten with scl , the scaling factor
80 *> for the sum of squares.
83 *> \param[in,out] SUMSQ
85 *> SUMSQ is DOUBLE PRECISION
86 *> On entry, the value sumsq in the equation above.
87 *> On exit, SUMSQ is overwritten with smsq , the basic sum of
88 *> squares from which scl has been factored out.
94 *> \author Univ. of Tennessee
95 *> \author Univ. of California Berkeley
96 *> \author Univ. of Colorado Denver
99 *> \date September 2012
101 *> \ingroup auxOTHERauxiliary
103 * =====================================================================
104 SUBROUTINE DLASSQ( N, X, INCX, SCALE, SUMSQ )
106 * -- LAPACK auxiliary routine (version 3.4.2) --
107 * -- LAPACK is a software package provided by Univ. of Tennessee, --
108 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
111 * .. Scalar Arguments ..
113 DOUBLE PRECISION SCALE, SUMSQ
115 * .. Array Arguments ..
116 DOUBLE PRECISION X( * )
119 * =====================================================================
122 DOUBLE PRECISION ZERO
123 PARAMETER ( ZERO = 0.0D+0 )
125 * .. Local Scalars ..
127 DOUBLE PRECISION ABSXI
129 * .. External Functions ..
133 * .. Intrinsic Functions ..
136 * .. Executable Statements ..
139 DO 10 IX = 1, 1 + ( N-1 )*INCX, INCX
140 ABSXI = ABS( X( IX ) )
141 IF( ABSXI.GT.ZERO.OR.DISNAN( ABSXI ) ) THEN
142 IF( SCALE.LT.ABSXI ) THEN
143 SUMSQ = 1 + SUMSQ*( SCALE / ABSXI )**2
146 SUMSQ = SUMSQ + ( ABSXI / SCALE )**2