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

xi = min( x j : j = 1, 2, …, n)

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

 

 

 

 

 

 

 

Re(x

)+Im(x

)

= minRe(x

j

)+Im(x

j

) : j

= 1, 2, ..., n

i

i

 

 

 

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.

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)

Chapter 2 Basic Vector Operations 43