HPJava provides array section of global arrays. The syntax of section subscripting is similar to array definition, a double bracket is used. The subscripts can be locations or ranges.
Suppose we still have
Range x = new BlockRange(100, p.dim(0)) ; Range y = new CyclicRange(100, p.dim(1)) ; float [[#]] b = new float [[x]]; float [[#,#]] c = new float [[x, y]];
then, c, c[[i, y|1::2]], c[[i, z]] and b[[i]] are all array sections. Here i is a location in the first range of b and c, and z is a subrange of the second range of c.
Expression c[[i, y|1::2]] and c[[i, z]] represent a one-dimensional distributed array, providing an alias for a subset of elements of c. Expression b[[i]] contains a single element of b, yet the result is a global scalar reference, not a simple variable.
When section is made in a collapsed dimension, a triplet expression instead of a range reference is used directly. For example, if we have,
float [[ ]] a = new float [];
then a[[:98:2]] is a strided array section.
In HPJava, array section expression will be used as arguments in member function calls. As in any programming language, only the dummy argument and actual argument have the same type signature, the function call can be completed. Table 1 shows the type relations of global data with different dimensions.
In the table, both i and j are location references.
When used in method calls, # marked type is a super-type of the one without the symbol. i.e. an argument of float[[,]], float[[#,]] and float[[,#]] type can all be passed to a dummy of type float[[#,#]]. But it is not true vise versa.