The HPJava Project


HPJava Home Page
HPspmd lectures
mpiJava
HPJava language

PCRC Home Page

NPAC Home Page



Java Grande Home

Subranges

A subrange is a section of a range, selected by some regularly spaced interval of integer global subscripts.

A Fortran-inspired, ``triplet'' subscripting syntax is used to represent subranges. If x is a range, then x[0 : 49] is a contiguous subrange and x[1 : 98 : 2] is a strided subrange.

Subranges are themselves members of the class Range. The integer global subscripts associated with a subrange are in the range 0,...,N-1 where N is the extent of the subrange. Locations in a subrange are identified with the locations of the parent range, so subranges retain an alignment relation to their parent range. In the illustration, the slots represent the M locations of a parent range, and the N locations of a subrange.

Following Fortran conventions, the upper or lower bound of a triplet can be omitted. The lower bound defaults to zero and the upper bound defaults to N-1 where N is the extent of the parent range. So x[: 49] is equivalent to x[0 : 49], and, if x has extent 100, x[1 : : 2] is equivalent to x[1 : 99 : 2].

Like any other ranges, subranges can be used to parametrize overall distributed loops, allowing the loops to iterate over subsections of distributed arrays. They can also appear in array constructors, implementing non-trivial array-alignment options equivalent to those available in HPF.

Next: Subarrays


Bryan Carpenter, (dbc@npac.syr.edu). Last updated January 2000.