** Next:** Array Reduction Intrinsics
** Up:** Arrays
** Previous:** Vector and Matrix Multiplication
** Contents**

max( a1, a2, a3, ...) min( a1, a2, a3, ...)

`
return the maximum (minimum) value over a list of arguments.
`
`The arguments ``
` can be (conformal) arrays;
the result of `MAX` (`MIN`) is then an array of the same
shape and size as the arguments, containing element
by element maxima (minima).

`
`

`The maximum value among the elements of an array ``A`
can be obtained with

maxval(A)

`
The location of the first element which has this
maximum value is given by
`maxloc(A)

`
If the rank of the matrix ``A` is ,
the returned result is an -dimensional array, containing the values
of the subscripts (i.e. the location) of the maximum value element.
`We can take the maximum values along a specified dimension, using
`

maxval(A, DIM=d)

`
When we use the ``DIM` argument, the result of `MAXVAL`
is a rank `r-1` array, with the maximum values in other dimensions.
`For example, if ``A` is a 2-dimensional matrix, using `d=1`
computes the maxima in each column, and `d=2` computes the maxima in each
row. The results are rank 1 arrays (vectors).

`Finally, we can use the masked form of ``MAXVAL`, for example

maxval(A, MASK=A<4)

`
The survey is only performed on elements of ``A` which correspond
to `.TRUE.` elements of the mask; here the maximum is taken over
the elements of `A` which are less than 4.
`Note that ``DIM` and `MASK` arguments can be used simultaneously.

`The functions
`

`
return the position of the minimal element in an array,
and the minimal value respectively; their use is similar to the use of
``MAXLOC`, `MAXVAL`.
`
`

** Next:** Array Reduction Intrinsics
** Up:** Arrays
** Previous:** Vector and Matrix Multiplication
** Contents**
Adrian Sandu
2001-08-26