Index of maximum of magnitudes

ISAMAX/IDAMAX/IIAMAX/ICAMAX/IZAMAX

 

INTEGER*4

i, ICAMAX, n, incx

 

COMPLEX*8

x(lenx)

 

i = ICAMAX(n, x, incx)

 

INTEGER*4

i, IZAMAX, n, incx

 

COMPLEX*16

x(lenx)

 

i = IZAMAX(n, x, incx)

 

VECLIB8:

 

 

INTEGER*8

i, ISAMAX, n, incx

 

REAL*4

x(lenx)

 

i = ISAMAX(n, x, incx)

 

INTEGER*8

i, IDAMAX, n, incx

 

REAL*8

x(lenx)

 

i = IDAMAX(n, x, incx)

 

INTEGER*8

i, IIAMAX, n, incx, x(lenx)

 

i = IIAMAX(n, x, incx)

 

INTEGER*8

i, ICAMAX, n, incx

 

COMPLEX*8

x(lenx)

 

i = ICAMAX(n, x, incx)

 

INTEGER*8

i, IZAMAX, n, incx

 

COMPLEX*16

x(lenx)

 

i = IZAMAX(n, x, incx)

Input

n

Number of elements of vector x to be used. If n ≤ 0, the

 

 

subprograms do not reference x.

 

x

Array of length lenx = (n−1)⋅incx+1 containing the

 

 

n-vector x.

 

incx

Increment for the array x. x is stored forward in array x

 

 

with increment incx; that is, xi is stored in

 

 

x((i−1) ⋅incx+1).

 

 

Use incx = 1 if the vector x is stored contiguously in

 

 

array x; that is, if xi is stored in x(i). Refer to “BLAS

 

 

Indexing Conventions” in the introduction to this

 

 

chapter.

Output

i

If n ≤ 0, then i = 0. Otherwise, i is the index of the

 

 

element of x of maximum magnitude.

Chapter 2 Basic Vector Operations 41