HPJava has a mechanism for representing subarrays. This mechanism is
modelled on the *array sections* of Fortran 90. In HPJava an array
section expression has a similar syntax to a distributed array element
reference but uses double brackets. Whereas an element
reference is a variable, an array section is an
expression that represents a new distributed array object. The new
array contains a subset of the elements of the parent array. Those
elements can subsequently be referenced--read or updated--either
through the parent array *or* through the array section^{4.1}.

We have seen that the subscripts in a distributed array element reference are either locations or (restrictedly) integer expressions. Options for subscripts in array section expressions are wider. Most importantly, as in Fortran 90, a section subscript is allowed be a triplet. Triplets were introduced in section 2.3 in the context of the overall construct. For each triplet subscript a section expression has an array dimension. In the commonest kinds of array section expression the rank of the result is equal to the number of triplet subscripts. The section may also have some scalar subscripts, similar to those appearing in element references. In this case the rank of the result will be lower than the rank of the parent array.

This fragment includes two examples of array section expressions:

Procs2 p = new Procs2(P, P) ; on(p) { Range x = new BlockRange(N, p.dim(0)) ; Range y = new BlockRange(N, p.dim(1)) ; float [[,]] a = new float [[x, y]] ; float [[]] b = a [[0, :]] foo(a [[0 : N / 2 - 1, : : 2]]) ; }The first array section expression appears on the right hand side of the definition of

Array sections allow us to implement a number of interesting
applications. They are often passed as arguments to library functions
like `remap`, implementing various interesting patterns of
communication and arithmetic on subarrays.

- Two-dimensional Fourier transform
- Cholesky decomposition
- Matrix multiplication with reduced memory
- Subranges and restricted groups
- Array restriction
- Scalars