MINLOC(3I) Last changed: 2598
MINLOC  Returns the location of a minimum value in an array
MINLOC ([ARRAY=]array [,[DIM=]dim] [,[MASK=]mask])
MINLOC ([ARRAY=]array [,[MASK=]mask])
UNICOS, UNICOS/mk, and IRIX systems
Fortran 90
The MINLOC intrinsic function can be used for array location. It
returns the location of the first element of array that has the
minimum value of the elements identified by mask. It accepts the
following arguments:
array Must be of type integer or real. It must not be scalar.
dim Must be a scalar integer value in the range 1 <= dim <= n,
where n is the rank of array. The corresponding actual
argument must not be an optional dummy argument. This
function does a check on dim when present.
mask Must be of type logical and must be conformable with array.
MINLOC is a transformational function. The name of this intrinsic
cannot be passed as an argument.
On UNICOS systems, both execution speed and the number of bits used in
mathematical operations are affected when compiling with
f90 O fastint, which is the default setting. For more information,
see CF90 Commands and Directives Reference Manual, publication
SR3901.
The result is an integer array of type default integer, of rank one,
with size equal to the rank of array.
The result of MINLOC(array) is a rankone array whose element values
are the values of the subscripts of an element of array whose value
equals the minimum value of all of the elements of array. The ith
subscript returned lies in the range 1 to e ,
i
where e
i
is the extent of the ith dimension 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 value of the result is undefined.
The result of MINLOC(array,MASK=mask) is a rankone array whose
element values are the values of the subscripts of an element of
array, corresponding to a true element of mask whose value equals the
minimum value of all such elements of array. The ith subscript
returned lies in the range 1 to e ,
i
where e
i
is the extent of the ith dimension of array. If more than one such
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 value of the result is
undefined.
If array has rank one, the result of
MINLOC(array, DIM=dim [, MASK=mask]) is a scalar with a value that is
the same as that of the first element of MINLOC(array [, MASK=mask]).
Otherwise, the value of element (s , s , ..., s , s , ..., s )
1 2 dim1 dim+1 n
of the result is equal to
MINLOC(array(s , s , ..., s , : , s , ..., s ), DIM=1
1 2 dim1 dim+1 n
[, MASK=mask(s , s , ..., s , : , s , ..., s )]).
1 2 dim1 dim+1 n
An element of the result is undefined if the value cannot be
represented as an integer.
Example 1: The value of MINLOC( (/ 4, 3, 6, 3 /) ) is [2]. If array
B is declared INTEGER, DIMENSION(4:7) :: B = (/8, 6, 3, 1 /), the
value of MINLOC(B) is [4].
Example 2: Assume that A is the following array:
 0 5 8 3 
 3 4 1 2 
 1 5 6 4 
The following are true:
MINLOC(A) is [1, 2]
MINLOC(A, MASK=A .GT. 4) is [1, 4]
Using array section references, the following are true:
MINLOC(A(2:3,2:4)) is [ 2, 3 ]
MINLOC(A(2:3,2:4),MASK=A(2:3,2:4).GT.4) is [ 1, 2 ]
Example 3: Assume that B is the following array:
[ 100, 2, 5, 7, 1, 90, 0, 20, 1, 80 ]
The following are true:
MINLOC(B(10:1:1)) is 2
MINLOC(B(10:1:2)) is 5
Example 4: The value of MINLOC((/5,9,3/),DIM=1) is 2.
Example 5: Assume that C is the following array:
 1 3 9 
 2 2 6 
The following are true of this array:
MINLOC(C,DIM=1) is [ 1, 2, 1 ]
MINLOC(C,DIM=2) is [ 3, 1 ]
MINLOC(C) is [ 3, 1 ]
Intrinsic Procedures Reference Manual, publication SR2138, for the
printed version of this man page.
MINLOC(3I) Last changed: 2598
MINLOC  Returns the location of a minimum value in an array
MINLOC ([ARRAY=]array [,[DIM=]dim] [,[MASK=]mask])
MINLOC ([ARRAY=]array [,[MASK=]mask])
UNICOS, UNICOS/mk, and IRIX systems
Fortran 90
The MINLOC intrinsic function can be used for array location. It
returns the location of the first element of array that has the
minimum value of the elements identified by mask. It accepts the
following arguments:
array Must be of type integer or real. It must not be scalar.
dim Must be a scalar integer value in the range 1 <= dim <= n,
where n is the rank of array. The corresponding actual
argument must not be an optional dummy argument. This
function does a check on dim when present.
mask Must be of type logical and must be conformable with array.
MINLOC is a transformational function. The name of this intrinsic
cannot be passed as an argument.
On UNICOS systems, both execution speed and the number of bits used in
mathematical operations are affected when compiling with
f90 O fastint, which is the default setting. For more information,
see CF90 Commands and Directives Reference Manual, publication
SR3901.
The result is an integer array of type default integer, of rank one,
with size equal to the rank of array.
The result of MINLOC(array) is a rankone array whose element values
are the values of the subscripts of an element of array whose value
equals the minimum value of all of the elements of array. The ith
subscript returned lies in the range 1 to e ,
i
where e
i
is the extent of the ith dimension 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 value of the result is undefined.
The result of MINLOC(array,MASK=mask) is a rankone array whose
element values are the values of the subscripts of an element of
array, corresponding to a true element of mask whose value equals the
minimum value of all such elements of array. The ith subscript
returned lies in the range 1 to e ,
i
where e
i
is the extent of the ith dimension of array. If more than one such
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 value of the result is
undefined.
If array has rank one, the result of
MINLOC(array, DIM=dim [, MASK=mask]) is a scalar with a value that is
the same as that of the first element of MINLOC(array [, MASK=mask]).
Otherwise, the value of element (s , s , ..., s , s , ..., s )
1 2 dim1 dim+1 n
of the result is equal to
MINLOC(array(s , s , ..., s , : , s , ..., s ), DIM=1
1 2 dim1 dim+1 n
[, MASK=mask(s , s , ..., s , : , s , ..., s )]).
1 2 dim1 dim+1 n
An element of the result is undefined if the value cannot be
represented as an integer.
Example 1: The value of MINLOC( (/ 4, 3, 6, 3 /) ) is [2]. If array
B is declared INTEGER, DIMENSION(4:7) :: B = (/8, 6, 3, 1 /), the
value of MINLOC(B) is [4].
Example 2: Assume that A is the following array:
 0 5 8 3 
 3 4 1 2 
 1 5 6 4 
The following are true:
MINLOC(A) is [1, 2]
MINLOC(A, MASK=A .GT. 4) is [1, 4]
Using array section references, the following are true:
MINLOC(A(2:3,2:4)) is [ 2, 3 ]
MINLOC(A(2:3,2:4),MASK=A(2:3,2:4).GT.4) is [ 1, 2 ]
Example 3: Assume that B is the following array:
[ 100, 2, 5, 7, 1, 90, 0, 20, 1, 80 ]
The following are true:
MINLOC(B(10:1:1)) is 2
MINLOC(B(10:1:2)) is 5
Example 4: The value of MINLOC((/5,9,3/),DIM=1) is 2.
Example 5: Assume that C is the following array:
 1 3 9 
 2 2 6 
The following are true of this array:
MINLOC(C,DIM=1) is [ 1, 2, 1 ]
MINLOC(C,DIM=2) is [ 3, 1 ]
MINLOC(C) is [ 3, 1 ]
Intrinsic Procedures Reference Manual, publication SR2138, for the
printed version of this man page.
[ Back ]
