{S,D}AMAX (n, x, incx) SCAMAX (n, x, incx) DZAMAX (n, x, incx)
amax real*4 | real*8 The element of the vector with the largest absolute value. If n<=0, amax returns the value 0.0.
n integer*4 On entry, the number of elements in the vector x. On exit, n is unchanged. x real*4 | real*8 | complex*8 | complex*16 On entry, a one-dimensional array X of length at least (1+(n-1)*|incx|), containing the elements of the 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.
These functions determine the largest absolute value of the elements of a vector: MAX{|x(j)|, j = 1,2, ...,n} For complex vectors, each element is a complex number. In this subprogram, the absolute value of a complex number is defined as the absolute value of the real part of the complex number plus the absolute value of the imaginary part of the complex number: |x(j)| = |a(j)| + |b(j)| = |(real)| + |(imaginary)| If incx < 0, the result is identical to using |incx|. If incx = 0, the computation is a time-consuming way of setting amax = |x(1)|.
INTEGER*4 N, INCX COMPLEX*8 X(40), AMAX INCX = 2 N = 20 AMAX = SCAMAX(N,X,INCX) This FORTRAN example shows how to compute the element with the largest absolute value.