ISAMAX/IDAMAX/IIAMAX/ICAMAX/IZAMAX

Index of maximum of magnitudes

Legacy BLAS routines

Name ISAMAX/IDAMAX/IIAMAX/ICAMAX/IZAMAX

Index of maximum of magnitudes

Purpose Given a real or integer vector x of length n, ISAMAX, IDAMAX, or IIAMAX determines the index of the element of the vector of maximum magnitude. Specifically, the subprograms determine the smallest index i such that

 

 

 

 

 

 

 

 

 

xi

 

= max

 

x j

 

: j = 1, 2, …, n

 

 

 

Given a complex vector x of length n, ICAMAX or IZAMAX determines the smallest index i:

Re( xi) + Im( xi) = max( Re( x j) + Im( x j) : j = 1, 2, …, n)

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

+ Im( xi)2

1 2

Re( xi)2

 

This definition is not used because of computational speed. If the index i is used for pivot selection in matrix factorization, no significant difference in numerical stability should result.

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

i, ISAMAX, n, incx

 

REAL*4

x(lenx)

 

i = ISAMAX(n, x, incx)

 

INTEGER*4

i, IDAMAX, n, incx

 

REAL*8

x(lenx)

 

i = IDAMAX(n, x, incx)

 

INTEGER*4

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

i = IIAMAX(n, x, incx)

40HP MLIB User’s Guide