Next: , Previous: , Up: Internal Routines   [Contents][Index]

15.5.365 max

max(array [, arg] [, /keepdims])

Returns one or more maximum values from the numerical array. For real data types, the maximum is the value closest to infinity. For complex data types, the maximum is the value with the greatest magnitude. Generally, arg indicates which dimensions are included in searching for a maximum. There must not be any duplicates in the elements of arg. For example, max(x, 0) returns the maximum value over all values of the first dimension, and max(x, [0,1]) returns the maximum over all values of the first two dimensions.

By default, the result has a number of dimensions equal to the number of dimensions in array minus the number of elements of arg. If /keepdims is specified, then the dimensions indicated by arg are not omitted but set to 1.

If arg is a numerical array with the same number of elements as array, then its elements indicate the class each corresponding element of array belongs to and the maximum value in each class is returned, with the maximum of class 0 or the most negative class in the first element of the result.

The last found maximum value is stored in !lastmax and its index in !lastmaxloc, and the corresponding numbers for the minima in !lastmin and !lastminloc. For complex arrays, the values stored in !lastmax and !lastmin are the magnitudes of the corresponding extreme values.

e.g. if x = [[[1,7]],[[3,5]]] then max(x) = 7 max(x,0) = [7,5] max(x,1) = [3,7].

See also: maxloc, min, minloc, !lastmax, !lastmaxloc, !lastmin, !lastminloc, local_max, local_maxloc, local_min, local_minloc, find_maxloc

Next: , Previous: , Up: Internal Routines   [Contents][Index]