Consider again the example of the array section in figure 4.2. We can capture this object in a named variable as follows
float [[,]] a = new float [[x, y]] ; float [[,]] c = a [[0 : N / 2 - 1, : : 2]] ;Now, what are the ranges of c--the objects returned by the rng() inquiry?
In fact they are a different sort of range from any considered so far--they are subranges. For completeness the HPJava language provides a special syntax for constructing subranges directly. Ranges equivalent to those of c can be created by
Range u = x [0 : N / 2 - 1] ; Range v = y [: : 2] ;This syntax should look quite natural. It is similar the subscripting syntax for locations, but the subscript is a triplet.
[Global subscripts in subranges.]
What about the distribution groups of sections? In this case triplet subscripts don't cause problems--the distribution group of c above can be defined to be the same as the distribution group of the parent array a. On the other hand the example of figure 4.1 is now problematic. This was constructed using a scalar subscript, effectively as follows:
float [[,]] a = new float [[x, y]] on p ; float [] b = a [[0, :]]The single range of b is clearly y, but identifying the distribution group of b with that of a doesn't seem to be right. If a one dimensional array is newly constructed with range y and distribution group p, as follows,
float [] bnew = new float [[y]] on p ;it is replicated over the first dimension of p. The section b clearly isn't replicated in this way. Where does the information that b is localized to the top row of processes go?
Triplet section subscripts motivated us to define subranges as a new kind of range. Likewise, scalar section subscripts will drive us to define a new kind of group. A restricted group is defined as the subset of processes in some parent group to which a particular location is mapped. In the current example, the distribution group of b is defined to be the subset of processes in p to which the location x  is mapped. Instead of further extending subscripting notations to describe these subgroups, the division operator is overloaded. The distribution group of b is equivalent to q, defined by
Group q = p / x  ;The expression in the initializer is called a group restriction operation4.2.
In a sense the definition of a restricted group is tacit in the definition of an abstract location. Without formally defining the idea, we used it implicitly in section 2.4. In Figure 2.6 of that section the set of processes with coordinates , and , to which location x is mapped, can now be written as
p / x and the set with coordinates and , to which y is mapped, can be written as
p / y The intersection of these two--the group containing the single process with coordinates --can be written as
p / x  / y or as
p / y  / x 
At first sight the definition of HPJava restricted groups may appear slightly arbitrary. One good way to argue that a language construct is ``natural'' is to demonstrate that it has a simple and efficient implementation. The subgroups introduced here have an attractively simple concrete representation. A restricted group is uniquely specified by its set of effective process dimensions and the identity of the lead process in the group--the process with coordinate zero relative to the dimensions effective in the group. The dimension set can be specified as a subset of the dimensions of the parent grid using a simple bitmask. The identity of the lead process can be specified through a single integer ranking the processes of the parent grid. So a general HPJava group can be parametrized by a reference to the parent Procs object, with the addition of just two int fields. It turns out that this representation is not only compact, but also lends itself to efficient computation of the most commonly used operations on groups.
Now we can give a formal definition of the mapping (distribution group and ranges) of a general array section. As a matter of definition an integer subscript in dimension of array is equivalent to a location-valued subscript .rng(). By definition, a triplet subscript :: in the same dimension is equivalent to range-valued subscript4.3.rng()[::].
Suppose all integer and triplet subscripts are replaced by their equivalent location or range subscripts as just described. If the location subscripts are the distribution group of the section is
p / i / j / ...where is the distribution group of the parent array. The th range of the section is equal to the th range-valued subscript.
Note that for a shifted location, as a matter of definition,
This makes sense--a shifted location is supposed to find an array element in the same process as the original location, albeit that the element could be in a ghost region.
p / (i
) = p / i
It shouldn't come as a surprise that subranges and restricted groups can be used in array constructors, on the same footing as the ranges and groups described in earlier sections. This means, for example, that temporary arrays can be constructed with identical mapping to any given section. This facility is useful when writing generic library functions, such as the matmul of Figure 3.15, which must accept full arrays or array sections indiscriminately4.4.
Unusually, this subsection introduced a couple of new pieces of syntax but did not give any full example programs that use them. The reason is that restricted groups and subranges largely exist ``below the surface'' in HPJava. The new notations are mainly needed to add a kind of semantic completeness to the language. It is not especially common to see subgroups or subranges constructed explicitly in HPJava programs.