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

62 HP MLIB User’s Guide
SASUM/DASUM/IASUM/SCASUM/DZASUM Sum of magnitudes
Name SASUM/DASUM/IASUM/SCASUM/DZASUM
Sum of magnitudes
Purpose Given a real or integer vector x of length n, SASUM, DASUM, or IASUM
computes the l
1
norm of x, that is, the sum of magnitudes of the elements of the
vector
Given a complex vector x of length n, SCASUM or DZASUM computes
where Re(x
i
) and Im(x
i
) are the real and imaginary parts of x
i
, respectively.
The usual definition of sum of magnitudes of a complex vector is
s is computed instead of t because, with its lack of square roots, it is faster to
compute. Because , s is often an acceptable substitute for t.
The vector can be stored in a one-dimensional array or in either a row or a
column of a two-dimensional array.
Usage VECLIB:
INTEGER*4 n, incx
REAL*4 s, SASUM, x(lenx)
s = SASUM(n, x, incx)
INTEGER*4 n, incx
REAL*8 s, DASUM, x(lenx)
s = DASUM(n, x, incx)
INTEGER*4 n, incx, s, IASUM, x(lenx)
s = IASUM(n, x, incx)
sx
1
x
i
i 1=
n
==
s
Re x
i
()
Im x
i
()
+
i 1=
n
=
tX
2
Re x
i
()
2
Im x
i
()
2
+



12
i 1=
n
==
t s 2t