{S,D}MAX (n, x, incx)
wmax real*4 | real*8 The largest value among the elements of the real vector x. If n<=0, wmax = 0.
n integer*4 On entry, the number of elements in real vector x. On exit, n is unchanged. x real*4 | real*8 On entry, a one-dimensional array X of length at least (1+(n-1)*|incx|), containing the elements of real vector x. On exit, x is unchanged. incx integer*4 On entry, the increment for the array X. If incx > 0, vector x is stored forward in the array, so that x(i) is stored in location X(1+(i-1)*incx). If incx < 0, vector x is stored backward in the array, so that x(i) is stored in location X(1+(n-i)*|incx|). If incx = 0, only the first element is accessed. On exit, incx is unchanged.
SMAX and DMAX are functions that determine the largest value among the real elements of a vector x: MAX{x(j), j = 1,2, ..., n} If incx < 0, the result is identical to using |incx|. If incx = 0, the computation is a time-consuming way of setting wmax = x(1).
INTEGER*4 N, INCX REAL*4 X(40), WMAX INCX = 2 N = 20 WMAX = SMAX(N,X,INCX) This FORTRAN example shows how to compute the largest value of the elements of a vector x.