# ?lassq

Updates a sum of squares represented in scaled form.

## Syntax

call slassq( n, x, incx, scale, sumsq )

call dlassq( n, x, incx, scale, sumsq )

call classq( n, x, incx, scale, sumsq )

call zlassq( n, x, incx, scale, sumsq )

## Description

The real routines slassq/dlassq return the values scl and smsq such that

`scl2 * smsq = x(1)2 +...+ x(n)2 + scale2 *sumsq`,

where `x( i ) = x(1 + ( i - 1) incx)`.

The value of sumsq is assumed to be non-negative and scl returns the value

`scl = max( scale, abs(x(i)))`.

Values scale and sumsq must be supplied in scale and sumsq, and scl and smsq are overwritten on scale and sumsq, respectively.

The complex routines classq/zlassq return the values scl and ssq such that

`scl2 * ssq = x(1)2 +...+ x(n)2 + scale2 *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 + 2n`

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

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

Values scale and sumsq must be supplied in scale and sumsq, and scl and ssq are overwritten on scale and sumsq, respectively.

All routines ?lassq make only one pass through the vector x.

## Input Parameters

n

  INTEGER. The number of elements to be used from the vector x.

x

  REAL for slassq

  DOUBLE PRECISION for dlassq

  COMPLEX for classq

  COMPLEX*16 for zlassq.

  The vector for which a scaled sum of squares is computed: `x(i) = x(1+(i-1)*incx)`, `1 ≤ i ≤ n`.

incx

  INTEGER. The increment between successive values of the vector x. `incx > 0`.

scale

  REAL for slassq/classq

  DOUBLE PRECISION for dlassq/zlassq.

  On entry, the value scale in the equation above.

sumsq

  REAL for slassq/classq

  DOUBLE PRECISION for dlassq/zlassq.

  On entry, the value sumsq in the equation above.

## Output Parameters

scale

  On exit, scale is overwritten with scl, the scaling factor for the sum of squares.

sumsq

  For real flavors:

  On exit, sumsq is overwritten with the value smsq in the equation above.

  For complex flavors:

  On exit, sumsq is overwritten with the value ssq in the equation above.

Parent topic: Auxiliary Routines