When defining a global array, it is not necessary to allocate a data descriptor for each array element, so the syntax to define a global array is not derived directly from the one for scalar.

on(p) float [[ ]] a = new float [[100]];

will create a global array of size 100 on `Group p`. Here
`a` is a descriptor handle, which describes an one dimension
`float` type array. The distribution format is the same as a
collapsed range. We call it *collapsed dimension*. In HPJava
term, `a` is also called a *global or distributed array
reference*.

A global array can also be created with different kinds of ranges we introduced before. Unlike the global array defined with collapsed dimension, array element in a range defined dimension is not duplicated in that process dimension.

Suppose we still have

Range x = new BlockRange(100, p.dim(0)) ;

and the process group defined in figure 1, then

on(q) float [[#]] b = new float [[x]];

will create a global array with `Range x` on `Group q`.
Here `a` is a descriptor handle, which describes an one
dimension `float` type array of size 100, distributed with
block range on the first dimension of `Group p`.

Note, when defining a global array, if its dimension is not collapsed,
then a symbol `#` is marked in double brackets.

The accessing pattern of a global array element is not the same as a global scalar reference, neither exactly same as a local array element. Since global arrays may have position information in their dimensions, we may need location references as their indexes when their dimensions are not collapsed.

Location i=x|3; at(i) b[i]=3;

Here the forth element of array `a` is assigned to 3. We will
leave `at` construct and how to access array elements in
section 2.3, and look at something simpler here.

When a global array is defined with a collapsed dimension, accessing its element is simpler.

for(int i=0; i<100; i++) b[i]=i;

will assign the loop index to each corresponding element in the array.

When defining a multi-dimension global array, there is also no need to
allocate a descriptor on each dimension. One descriptor can describe a
rectangular array of any dimensions^{4}.

Range x = new BlockRange(100, p.dim(0)) ; Range y = new CyclicRange(100, p.dim(1)) ; float [[#,#]] c = new float [[x, y]];

will create a two-dimension global array, with the first dimension
block distributed and the second cyclic distributed. `c` is a
global array reference, its element can be accessed by putting a
single bracket with two location references inside.

The array introduced here is Fortran-style multi-dimension arrays rather than C-like array-of-arrays, hence it can be clearly showed that which dimensions the descriptor is describing.

The array-of-arrays in Java is still useful, global arrays can be combined with local arrays. For example,

int[] size = {100, 200, 400}; float [[#,#]] [] d = new float [size.length] [[#,#]]; Range x[]; Range y[]; for (int l = 0; l < size.length; l++) { x[l] = new BlockRange(size[l], p.dim(0)) ; y[l] = new BlockRange(size[l], p.dim(1)) ; d[l] = new float [[x[l], y[l]]]; }

will create an array show as in figure 4.