[ HPF Home | Versions | Compilers | Projects | Publications | Applications | Benchmarks | Events | Contact ]



Next:
NUMBER_OF_PROCESSORS(DIM) Up: Specifications of Intrinsic Previous: MAXLOC(ARRAYDIM, MASK)

MINLOC(ARRAY, DIM, MASK)

Optional Arguments. DIM, MASK
Description. Determine the locations of the first elements of ARRAY along dimension DIM having the minimum value of the elements identified by MASK.
Class. Transformational function.
Arguments.

ARRAY must be of type integer or real. It must not be scalar.

DIM (optional) must be scalar and of type integer with a value in the range , where is the rank of ARRAY. The corresponding actual argument must not be an optional dummy argument.

MASK (optional) must be of type logical and must be conformable with ARRAY.
Result Type, Type Parameter, and Shape. The result is of type default integer. If DIM is absent the result is an array of rank one and size equal to the rank of ARRAY; otherwise, the result is an array of rank and shape , where is the shape of ARRAY.
Result Value.

(i): The result of executing S = MINLOC(ARRAY) + LBOUND(ARRAY) - 1 is a rank-one array S of size equal to the rank of ARRAY. It is such that ARRAY(S(1), ..., S(n)) has the minimum value of all of the elements of ARRAY. If more than one element has the minimum value, the element whose subscripts are returned is the first such element, taken in array element order. If ARRAY has size zero, the result is implementation dependent.

(ii): The result of executing S = MINLOC(ARRAY, MASK) + LBOUND(ARRAY) - 1 is a rank-one array S of size equal to the rank of ARRAY. It is such that ARRAY(S(1), ..., S(n)) corresponds to a true element of MASK, and has the minimum value of all such elements of ARRAY. If more than one element has the minimum value, the element whose subscripts are returned is the first such element, taken in array element order. If there are no such elements (that is, if ARRAY has size zero or every element of MASK has the value false), the result is implementation dependent.

(iii): If ARRAY has rank one, the result of MINLOC(ARRAY, DIM [,MASK]) is a scalar S such that ARRAY(S + LBOUND(ARRAY,1) - 1) corresponds to a true element of MASK (if MASK is present) and has the minimum value of all such elements (all elements if MASK is absent). It is the smallest such subscript. Otherwise, the value of element of MINLOC(ARRAY, DIM [,MASK]) is equal to MINLOC( ARRAY() [,MASK = MASK()]).
Examples.

(i): The value of MINLOC((/ 5, -9, 3 /)) is ,2,, plus 1filll -1;2,; plus 1filll -1:2,: plus 1filll -1.2,. plus 1filll -12, plus 1filll-1.

(ii): MINLOC(C, MASK = C .GT. 0) finds the location of the first element of C that is the minimum of the positive elements.

(iii): The value of MINLOC((/ 5, -9, 3 /), DIM=1) is 2. If B is the array , 1, 3, -9 2, 2, 6 ,, plus 1filll -1; 1, 3, -9 2, 2, 6 ,; plus 1filll -1: 1, 3, -9 2, 2, 6 ,: plus 1filll -1.plus 1filll 1, 3, -9 2, 2, 6 ,.-50 1, 3, -9 2, 2, 6 , plus 1filll-1, MINLOC( B, DIM = 1 ) is , 1, 2, 1 ,, plus 1filll -1; 1, 2, 1 ,; plus 1filll -1: 1, 2, 1 ,: plus 1filll -1. 1, 2, 1 ,. plus 1filll -1 1, 2, 1 , plus 1filll-1 and MINLOC( B, DIM = 2 ) is , 3, 1 ,, plus 1filll -1; 3, 1 ,; plus 1filll -1: 3, 1 ,: plus 1filll -1. 3, 1 ,. plus 1filll -1 3, 1 , plus 1filll-1. Note that this is true even if B has a declared lower bound other than 1.



Next:
NUMBER_OF_PROCESSORS(DIM) Up: Specifications of Intrinsic Previous: MAXLOC(ARRAYDIM, MASK)



©2000-2006 Rice University [ Contact Us | HiPerSoft | Computer Science ]

paula@erc.msstate.edu
Thu Dec 8 16:17:11 CST 1994