HPJava subranges

<h1>Subranges</h1>

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

<p>

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

<p>

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

<p>

<img src="subrange.gif">

<p>

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 <tt>N-1</tt> where <tt>N</tt> is the extent of
the parent range.  So <tt>x[: 49]</tt> is equivalent to <tt>x[0 : 49]</tt>,
and, if <tt>x</tt> has extent 100, <tt>x[1 : : 2]</tt> is equivalent
to <tt>x[1 : 99 : 2]</tt>.

<p>

Like any other ranges, subranges can be used to parametrize 
<tt>overall</tt> 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.

<p>

<b>Next:</b>
<a href="subarrays.html">Subarrays</a>


