SMIN/DMIN/IMIN

 

Minimum of vector

 

 

Indexing Conventions” in the introduction to this

 

 

chapter.

Output

s

If n ≤ 0, then s = ∞, the largest representable machine

 

 

number. Otherwise, s is the minimum of the elements

 

 

of x.

Fortran Equivalent

REAL*4 FUNCTION SMIN (N,X,INCX) REAL*4 X(*)

SMIN =

INCXA = ABS ( INCX ) IX = 1

DO 10 I = 1, N

SMIN = MIN ( SMIN , X(IX) )

IX = IX + INCXA

10CONTINUE RETURN END

Example Compute the minimum of the elements of REAL*8 vector x, where x is a vector 10 elements long stored in a one-dimensional array X of dimension 20.

INTEGER*4

N,INCX

REAL*8

S,DMIN,X(20)

N =

10

 

INCX = 1

 

S =

DMIN (N,X,INCX)

106HP MLIB User’s Guide