MINLOC (array [,dim] [,mask] [,kind]) Class: Transformational function - Generic Returns the location of the minimum value of all elements in an array, a set of elements in an array, or elements in a specified dimension of an array. The "array" can be of type integer or real. The "dim" must be a scalar integer with a value in the range 1 to n, where "n" is the rank of "array". The "mask" must be a logical array conformable with "array". The "kind" must be a scalar integer initialization expression. The result is of type integer. If "kind" is present, the kind parameter of the result is that specified by "kind"; otherwise, the kind parameter of the result is that of default integer. If the processor cannot represent the result value in the kind of the result, the result is undefined. If "dim" is absent, the result is an array with rank that is one less than "array", and shape (d1, d2,..., d"dim"-1, d"dim"+1,..., dn), where (d1, d2,..., dn) is the shape of "array". If "kind" is present, the kind parameter of the result is that specified by "kind"; otherwise, the kind parameter of the result is that of default integer. If the processor cannot represent the result value in the kind of the result, the result is undefined. The result of MINLOC (array) is a rank-one array whose elements form the subscript of the location of the element with the minimum value in "array". The result of MINLOC (array, mask=mask) is a rank-one array whose elements form the subscript of the location of the element with the minimum value corresponding to the condition specified by "mask". If more than one element has minimum value, the element whose subscripts are returned is the first such element, taken in array element order. If "array" has size zero, or every element of "mask" has the value .FALSE., the value of the result is undefined. Examples: The value of MINLOC ((/3, 1, 4, 1/)) is 2. Consider that A is the array | 4 0 -3 2| | 3 1 -2 6| |-1 -4 5 -5| MINLOC (A, MASK=A .GT. -5) has the value (3, 2). This is true even if A has a declared bound other than 1. MAXLOC (A, DIM=1) has the value (3, 3, 1, 3). MAXLOC (A, DIM=2) has the value (3, 3, 4).