Determines the location of the element in the array with the maximum value, or, if the
dim argument is supplied, determines the locations of the maximum element along each row of the array in the
dim direction. If
mask is present, only the elements for which
.true. are considered. If more than one element in the array has the maximum value, the location returned is that of the first such element in array element order if the
back is not present, or if it is false; otherwise, the location returned is that of the first such element. If the array has zero size, or all of the elements of
.false., then the result is an array of zeroes. Similarly, if
dim is supplied and all of the elements of
mask along a given row are zero, the result value for that row is zero.
result = maxloc(array, dim [, mask] [, kind] [, back])
result = maxloc(array [, mask] [, kind] [, back])
array- Shall be an array of type
dim- (Optional) Shall be a scalar of type
integer, with a value between one and the rank of
array, inclusive. It may not be an optional dummy argument.
mask- Shall be an array of type
logical, and conformable with
kind- (Optional) An
integerinitialization expression indicating the kind parameter of the result.
back- (Optional) A scalar of type
dim is absent, the result is a rank-one array with a length equal to the rank of
dim is present, the result is an array with a rank one less than the rank of
array, and a size corresponding to the size of
array with the
dim dimension removed. If
dim is present and
array has a rank of one, the result is a scalar. If the optional argument
kind is present, the result is an integer of kind
kind, otherwise it is of default kind.