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

Chapter 2 Basic Vector Operations 43
Index of minimum of magnitudes ISAMIN/IDAMIN/IIAMIN/ICAMIN/IZAMIN
Name ISAMIN/IDAMIN/IIAMIN/ICAMIN/IZAMIN
Index of minimum of magnitudes
Purpose Given a real or integer vector x of length n, ISAMIN, IDAMIN, or IIAMIN
determines the index of element of the vector of minimum magnitude.
Specifically, the subprograms determine the smallest index i such that
Given a complex vector x of length n, ICAMIN or IZAMIN determines the
smallest index i:
where Re(x
i
) and Im(x
i
) are the real and imaginary parts of x
i
, respectively.
The usual definition of complex magnitude is
This definition is not used because of computational speed.
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, ISAMIN, n, incx
REAL*4 x(lenx)
i = ISAMIN(n, x, incx)
INTEGER*4 i, IDAMIN, n, incx
REAL*8 x(lenx)
i = IDAMIN(n, x, incx)
INTEGER*4 i, IIAMIN, n, incx, x(lenx)
i = IIAMIN(n, x, incx)
INTEGER*4 i, ICAMIN, n, incx
COMPLEX*8 x(lenx)
i = ICAMIN(n, x, incx)
INTEGER*4 i, IZAMIN, n, incx
COMPLEX*16 x(lenx)
i = IZAMIN(n, x, incx)
x
i
min x
j
: j 12 n,, ,=()=
|Re(x
i
)|+|Im(x
i
)| min
|Re(x
j
)|+|Im(x
j
)| : j 1, 2, ..., n=



=
Re x
i
()
2
Im x
i
()
2
+



12