Multidimensional arrays

First we describe a modest extension to Java that adds a class of true
multi-dimensional arrays to the standard Java language. The new arrays
allow regular section subscripting, similar to Fortran 90 arrays. The
syntax described in this section is a subset of the syntax introduced
later for parallel arrays and algorithms: the only motivation for
discussing the sequential subset first is to simplify the overall
presentation.
No attempt is made to integrate the new multidimensional arrays
with the standard Java arrays: they are a new kind of entity that
coexists in the language with ordinary Java arrays. There
are good technical reasons for keeping the two kinds of array
separate^{1}.

The type-signatures and constructors of the multidimensional array use double brackets to distinguish them from ordinary arrays:

int [[,]] a = new int [[5, 5]] ; float [[,,]] b = new float [[10, n, 20]] ; int [[]] c = new int [[100]] ;

int [] d = new int [100] ;

Access to individual elements of a multidimensional array goes through a subscripting operation involving single brackets, for example

for(int i = 0 ; i < 4 ; i++) a [i, i + 1] = i + c [i] ;For reasons that will become clearer in later sections, this style of subscripting is called

In general our language has no idea of Fortran-like array assignments. In

int [[,]] e = new int [[n, m]] ; ... a = e ;the assignment simply copies a handle to object referenced by

e + a Math.cos(e)are type errors.

Our HPJava *does* import a Fortran-90-like idea of array *regular
sections*. The syntax for *section subscripting* is different to
the syntax for local subscripting. Double brackets are used. These
brackets can include scalar subscripts or *subscript triplets*.

A section is an object in its own right--its type is that of a suitable
multi-dimensional array. It describes some subset of the elements of
the parent array. This is slightly different to the situation in
Fortran, where sections cannot usually be captured as named
entities^{3}.

int [[]] e = a [[2, 2 :]] ; foo(b [[ : , 0, 1 : 10 : 2]]) ;

In our language, unlike Fortran, it is not allowed to use vectors of integers as subscripts. The only sections recognized are regular sections defined through scalar and triplet subscripts.

The language provides a library of functions for manipulating its arrays, closely analogous to the array transformational intrinsic functions of Fortran 90:

int [[,]] f = new int [[5, 5]] ; HPJlib.shift(f, a, -1, 0, CYCL) ; float g = HPJlib.sum(b) ; int [[]] h = new int [[100]] ; HPJlib.copy(h, c) ;The