Description: | Returns the lower bounds for all dimensions of an array, or the lower bound for a specified dimension. | ||
Class: | Inquiry function; Generic | ||
Arguments: | ARRAY | Must be an array (of any data type). It must not be an allocatable array that is not allocated, or a disassociated pointer. | |
DIM (opt) | Must be a scalar integer with a value in the range 1 to n, where n is the rank of ARRAY. | ||
Results: | The result type is default integer. If DIM
is present, the result is a scalar. Otherwise, the result is a rank-
one array with one element for each dimension of ARRAY. Each element
in the result corresponds to a dimension of ARRAY.
If ARRAY is an array section or an array expression that is not a whole array or array structure component, each element of the result has the value 1. If ARRAY is a whole array or array structure component, LBOUND (ARRAY, DIM) has a value equal to the lower bound for subscript DIM of ARRAY (if ARRAY(DIM) is nonzero). If ARRAY(DIM) has size zero, the corresponding element of the result has the value 1. |
Examples
Consider the following:
REAL ARRAY_A (1:3, 5:8) REAL ARRAY_B (2:8, -3:20)
LBOUND (ARRAY_A) is (1, 5). LBOUND (ARRAY_A, DIM=2) is 5.
LBOUND (ARRAY_B) is (2, -3). LBOUND (ARRAY_B (5:8, :)) is (1,1) because the arguments are array sections.