# p?lassq

Updates a sum of squares represented in scaled form.

## Syntax

call pslassq(n, x, ix, jx, descx, incx, scale, sumsq)

call pdlassq(n, x, ix, jx, descx, incx, scale, sumsq)

call pclassq(n, x, ix, jx, descx, incx, scale, sumsq)

call pzlassq(n, x, ix, jx, descx, incx, scale, sumsq)

## Description

This routine returns the values scl and smsq such that
`scl2 * smsq = x(1)2 + ... + x(n)2 + scale2*sumsq,`

where `x(i) = sub(X) = X(ix + (jx-1)*descx(m_) + (i - 1)*incx)` for pslassq/pdlassq ,

and `x(i) = sub(X) = abs(X(ix + (jx-1)*descx(m_) + (i - 1)*incx)` for pclassq/pzlassq.

For real routines pslassq/pdlassq the value of sumsq is assumed to be non-negative and scl returns the value
`scl = max(scale, abs(x(i))).`

For complex routines pclassq/pzlassq the value of sumsq is assumed to be at least unity and the value of ssq will then satisfy
`1.0 ≤ ssq ≤ sumsq +2n`

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

For all routines p?lassq values scale and sumsq must be supplied in scale and sumsq respectively, and scale and sumsq are overwritten by scl and ssq respectively.

All routines p?lassq make only one pass through the vector sub(x).

## Input Parameters

n

  (global) INTEGER.

  The length of the distributed vector sub(x ).

x

  REAL for pslassq

  DOUBLE PRECISION for pdlassq

  COMPLEX for pclassq

  COMPLEX*16 for pzlassq.

  The vector for which a scaled sum of squares is computed:

  `x(ix + (jx-1)*m_x + (i - 1)*incx), 1 ≤ i ≤ n`.

ix

  (global) INTEGER.

  The row index in the global array X indicating the first row of sub(X).

jx

  (global) INTEGER.

  The column index in the global array X indicating the first column of sub(X).

descx

  (global and local) INTEGER array of DIMENSION (dlen_).

  The array descriptor for the distributed matrix X.

incx

  (global) INTEGER.

  The global increment for the elements of X. Only two values of incx are supported in this version, namely 1 and m_x. The argument incx must not equal zero.

scale

  (local).

  REAL for pslassq/pclassq

  DOUBLE PRECISION for pdlassq/pzlassq.

  On entry, the value scale in the equation above.

sumsq

  (local)

  REAL for pslassq/pclassq

  DOUBLE PRECISION for pdlassq/pzlassq.

  On entry, the value sumsq in the equation above.

## Output Parameters

scale

  (local).

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

sumsq

  (local).

  On exit, sumsq is overwritten with the value smsq, the basic sum of squares from which scl has been factored out.

Parent topic: Auxiliary Routines