HP MLIB User's Guide Vol. 1 7th Ed.

Chapter 2 Basic Vector Operations 197
Sum of squares F_SSUMSQ/F_DSUMSQ/F_CSUMSQ/F_ZSUMSQ
Name F_SSUMSQ/F_DSUMSQ/F_CSUMSQ/F_ZSUMSQ
Sum of squares
Purpose F_xSUMSQ returns the values scl and ssq such that
The value of sumsq should be at least unity and the value of ssq then satisfies
when x is a real vector, and
when x is a complex vector.
scale should be non negative and scl returns the value
Specify scale and sumsq on entry in scl and ssq respectively. scl and ssq are
overwritten by scl and ssq respectively. The arguments scl and ssq are
therefore always real scalars. If n is less than or equal to zero, the routine
returns immediately with scl and ssq unchanged.
Usage VECLIB:
INTEGER*4 INCX, N
REAL*4 SCL, SSQ, X( * )
SUBROUTINE F_SSUMSQ (N, X, INCX, SSQ, SCL)
INTEGER*4 INCX, N
REAL*8 SCL, SSQ, X( * )
SUBROUTINE F_DSUMSQ (N, X, INCX, SSQ, SCL)
INTEGER INCX, N
REAL*4 SCL, SSQ
COMPLEX*8 X( * )
SUBROUTINE F_CSUMSQ (N, X, INCX, SSQ, SCL)
INTEGER INCX, N
REAL*8 SCL, SSQ
COMPLEX*16 X( * )
SUBROUTINE F_ZSUMSQ (N, X, INCX, SSQ, SCL)
VECLIB8:
scl
2
ssq× scale
2
sumsq× Re x
i
()
2
Im x
i
()
2
+()
i 0=
n 1
+=
1.0 ssq sumsq n+()≤≤
1.0 ssq sumsq 2n+()
˙
≤≤
scl max
0 in<
scale abs Re x
i
()()abs Im x(
i
(),(),()=