We imposed no restriction that the list of subscripts in an array section expression must include some triplets (or ranges). It is legitimate for all the subscript to be ``scalar''. In this case the resulting ``array'' has rank 0.
There is nothing pathological about rank-0 arrays. They logically maintain a single element, bundled with the distribution group over which this element is replicated. Because they are logically distributed arrays they can be passed as arguments to Adlib functions such as remap. If a and b are distributed arrays, we cannot usually write a statement like
a [10, 10] = b  ;because the elements involved are generally held on different processors. As we have seen, HPJava imposes constraints that forbid this kind of direct assignment between array element references. However, we can usually achieve the same effect by writing
Adlib.remap(a [[10, 10]], b []);The arguments are rank-0 sections holding just the destination and source elements.
There is a trivial syntactic problem with rank-0 arrays: the usual form of type signature for distributed arrays does not generalize down to the zero-dimensional case. The type signature for a one-dimensional distributed array typically has one empty slot enclosed in double brackets; there is no way to write zero empty slots! The symbol # is used as a degnerate form of the double brackets, and the type signature for a rank-0 array with element of type is written #.
The story of subranges and restricted groups repeats itself. The operation of array sectioning drives us to introduce a new kind of object into the language. Once that happens we should have a syntax for creating the new kind of object directly. Rank-0 distributed arrays, which we will also call simply ``scalars'', can be created as follows
float # c = new float # ; float a [[,]] = new float [[x, y]] ; Adlib.remap(c, a [[10, 10]]) ; float d = c  ;This example illustrates one way to broadcast an element of a distributed array: remap it to a scalar replicated over the active process group. The element of the scalar is extracted through a distributed array element reference with an empty subscript list. As for other kinds of distributed array, scalar constructors can have on clauses, specifying a non-default distribution group.