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 lnorm of x, that is, the maximum of the magnitudes of the elements of the vector

s= x= max( xi : i = 1, 2, …, n).

Given a complex vector x of length n, SCAMAX or DZAMAX computes

s= max( Re( xi) + Im( xi) : i = 1, 2, …, n).

where Re(xi) and Im(xi) are the real and imaginary parts of xi, respectively. The usual definition of the maximum of magnitudes of a complex vector is

 

 

 

 

 

 

 

 

 

 

 

2

 

2

}

1 2

 

t =

 

 

 

x

 

 

 

=

max

{ Re( xi)

 

+ Im( xi)

 

 

: i

= 1, 2, …, n .

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

s is computed instead of t because, with its lack of square roots, it is faster to compute. Because t s 2t , 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)

56HP MLIB User’s Guide