HP MLIB User's Guide Vol. 1 7th Ed.
56 HP MLIB User’s Guide
SAMAX/DAMAX/IAMAX/SCAMAX/DZAMAX Maximum of magnitudes
Name SAMAX/DAMAX/IAMAX/SCAMAX/DZAMAX
Maximum of magnitudes
Purpose Given a real or integer vector x of length n, SAMAX, DAMAX, or IAMAX
computes the l
∞
norm of x, that is, the maximum of the magnitudes of the
elements of the vector
Given a complex vector x of length n, SCAMAX or DZAMAX computes
where Re(x
i
) and Im(x
i
) are the real and imaginary parts of x
i
, respectively.
The usual definition of the maximum 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, SAMAX, x(lenx)
s = SAMAX(n, x, incx)
INTEGER*4 n, incx
REAL*8 s, DAMAX, x(lenx)
s = DAMAX(n, x, incx)
INTEGER*4 n, incx, s, IAMAX, x(lenx)
s = IAMAX(n, x, incx)
INTEGER*4 n, incx
REAL*4 s, SCAMAX
COMPLEX*8 x(lenx)
s = SCAMAX(n, x, incx)
sx
∞
max x
i
: i 12… n,, ,=().==
s max Re x
i
() Im x
i
()+:i 12… n,, ,=().=
tx
∞
max Re x
i
()
2
Im x
i
()
2
+{}
12⁄
: i 12… n,, ,=
.==
t ≤ s ≤ 2t