All Packages Class Hierarchy This Package Previous Next Index
Class com.ibm.math.array.Array
java.lang.Object
|
+----com.ibm.math.array.Array
- public abstract class Array
- extends Object
array = Array Package for Java
The Array Package provides the basic functionality of
Fortran 90 arrays in Java.
Arrays are multidimensional, rectangular grids of elements.
The array class hierarchy is as follows:
Array ----> <type>Array ----> <type>Array<rank>
where Array is an abstract class, <type>Array is an abstract
class and <type>Array<rank> is a (concrete) class.
Only objects of class <type>Array<rank> can be
instantiated.
The following <type>s are valid:
boolean, byte, short, int, long, char, float, double, Object and Complex.
The following <rank>s are valid:
0D (for 0-dimensional arrays), 1D (for 1-dimensional arrays),
2D, 3D. Note that 4D, 5D, 6D, 7D may be supported in the future.
The Array base class is extended by all abstract array classes
of the form <type>Array. It declares the basic methods that are
common to all arrays, independent of <type> and <rank>
-
Array()
- Default constructor.
-
getAsObject(int[])
- Return an Object which has the same value as the specified element of the array.
-
last(int)
- Return the index of the last element its i-th axis.
-
permuteAxes(int[])
- Permute the axes of a given array.
-
rank()
- Return the rank of the array.
-
reshape(int[])
- This method reshapes this array into an array with rank equal to the length of
the size parameter, each size[i] element gives the size of the new array in the
ith axis, the array returned has a copy of the data from this array, it does
not share data with this array.
-
setToObject(int[], Object)
- Sets the specified element of the array to a particular value.
-
shape()
- Return the shape of the array as an int[] I of length rank().
-
size()
- Return the number of elements in the array.
-
size(int)
- Return the extent of the array along its i-th axis.
Array
public Array()
- Default constructor.
getAsObject
public abstract Object getAsObject(int index[]) throws InvalidArrayIndexException, ArrayIndexOutOfBoundsException
- Return an Object which has the same value as the specified element of the array.
- Parameters:
- index - index[i] = index along i-th axis, 0 <= index[i] < size(i)
- Throws: InvalidArrayIndexException
- index[] must be of length equal to rank
last
public abstract int last(int i) throws InvalidArrayAxisException
- Return the index of the last element its i-th axis.
the value returned is simply size(i)-1, but is convenient
to have such a method because last(i) is more readable than
size(i)-1.
- Parameters:
- i - array axis (0 <= i < rank())
- Returns:
- the index of the last element along axis i
- Throws: InvalidArrayAxisException
- i must be between 0 and 1
permuteAxes
public abstract Array permuteAxes(int permarray[]) throws InvalidArrayAxisException
- Permute the axes of a given array. In the axis n# i of this object
will be the axis permarray[i] of the new object.
- Parameters:
- permarray - int[] the parameter that describes the permute operation.
- Returns:
- array.Array a generic array reference.
- Throws: InvalidArrayAxisException
- Axis must be valid (correct range and all diferent).
rank
public abstract int rank()
- Return the rank of the array.
reshape
public abstract Array reshape(int size[]) throws NonconformingArrayException
- This method reshapes this array into an array with rank equal to the length of
the size parameter, each size[i] element gives the size of the new array in the
ith axis, the array returned has a copy of the data from this array, it does
not share data with this array.
- Parameters:
- permarray - int[] the parameter that describes the permute operation.
- Returns:
- array.Array a generic array reference.
- Throws: NonconformingArrayException
- New array must have the size of the
old one and have rank as high as supported in this implementation.
setToObject
public abstract void setToObject(int index[],
Object obj) throws InvalidArrayIndexException, ArrayIndexOutOfBoundsException, NullPointerException
- Sets the specified element of the array to a particular value.
- Parameters:
- index - index[i] = index along i-th axis, 0 <= index[i] < size(i)
- obj - the array element is set to the value of this Object
- Throws: InvalidArrayIndexException
- index[] must be of length equal to rank
shape
public abstract int[] shape()
- Return the shape of the array as an int[] I of length rank().
I(i) = size(i)
size
public abstract int size()
- Return the number of elements in the array.
size
public abstract int size(int i) throws InvalidArrayAxisException
- Return the extent of the array along its i-th axis.
- Parameters:
- i - array axis (0 <= i < rank())
- Throws: InvalidArrayAxisException
- i must be between 0 and rank-1
All Packages Class Hierarchy This Package Previous Next Index