As mentioned before, Java is an attractive programming language for various reasons. But it needs to be improved for solving large computational tasks. One of the critical Java and JVM issues is the lack of true multidimensional arrays like those in Fortran, which are arguably the most important data structures for scientific and engineering computing. Java does not directly provide arrays with rank greater than . Instead, Java represents multidimensional arrays as ``array of arrays.'' The disadvantages of Java multidimensional arrays result from the time consumption for out-of-bounds checking, the ability to alias rows of an array, and the cost of accessing an element. In contrast, accessing an element in Fortran 90 is straightforward and efficient. Moreover, an array section can be implemented efficiently. HPJava supports a true multidimensional array, called a multiarray, which is a modest extension to the standard Java language. The new arrays allow regular section subscripting, similar to Fortran 90 arrays. The syntax for the HPJava multiarray is a subset of the syntax introduced later for distributed arrays. The type signature and constructor of the multiarray has double brackets to tell them from ordinary Java arrays.
care respectively a 2-dimensional integer array, 3-dimensional double array, and 1-dimensional int array. The rank is determined by the number of asterisks in the type signature. The shape of a multiarray is rectangular. Moreover,
cis similar in structure to the standard array
dare not identical. For instance,
callows section subscripting, but
ddoes not. The value
dwould not be assignable to
c, or vice versa. Access to individual elements of a multiarray is represented by a subscripting operation involving single brackets, for example,
ebecomes an alias for the 3rd row of elements of
a. The procedure
fooshould expect a two-dimensional array as argument. It can read or write to the set of elements of
bselected by the section. The shorthand
:selects the whole of the index range, as in Fortran 90.