T
- the parameterization lower bounded by ProtoArray
itself.V
- the storage array type.E
- the element type.public abstract class ProtoArray<T extends ProtoArray<T,V,E>,V,E> extends Object implements Array<T,E>
Array.IndexingOrder
Modifier and Type | Field and Description |
---|---|
protected int[] |
dims
The dimensions.
|
protected Array.IndexingOrder |
order
The storage order.
|
protected int[] |
strides
The strides.
|
protected V |
values
The backing values.
|
Modifier | Constructor and Description |
---|---|
protected |
ProtoArray(V values,
Array.IndexingOrder order,
int[] dims,
int[] strides)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
T |
clone()
Copies this array.
|
T |
concat(int opDim,
T... srcs)
Concatenates this array with the given arrays along the given dimension.
|
int[] |
dims()
Gets the dimensions.
|
byte[] |
getBytes()
Converts this array into
byte s. |
T |
map(T dst,
int... bounds)
Maps this array into a destination array.
|
int |
nDims()
Gets the number of dimensions.
|
Array.IndexingOrder |
order()
Gets the storage order of this array.
|
protected int |
physical(int[] logical)
Converts a logical index into a physical index.
|
T |
reshape(int... dims)
Reshapes this array.
|
T |
reverse(int... opDims)
Reverses along the given dimensions.
|
T |
reverseOrder()
Creates an array where the storage order is reversed.
|
T |
shift(int... shifts)
Circularly shifts this array.
|
int |
size(int i)
Gets the size along the given dimension.
|
T |
slice(E value,
int[]... srcSlices)
Slices a value into this array.
|
T |
slice(int[]... srcSlices)
Gets a subarray specified by the given slicing indices.
|
T |
slice(int[][] srcSlices,
T dst,
int[][] dstSlices)
Slices this array into a destination array.
|
T |
slice(T dst,
int[]... dstSlices)
Slices this entire array into a destination array.
|
T |
splice(T dst,
int... slices)
A primitive slicing operation.
|
int |
stride(int i)
Gets the stride along the given dimension.
|
int[] |
strides()
Gets the strides.
|
T |
subarray(int... bounds)
Gets a subarray delimited by the given bounds.
|
T |
tile(int... repetitions)
Tiles this array according to the given number repetitions along each dimension.
|
T |
transpose(int... permutation)
Transposes (permutes) the dimensions of this array.
|
V |
values()
Gets the backing values.
|
protected abstract T |
wrap(Array.IndexingOrder order,
int[] dims,
int[] strides)
Allocates a new array.
|
protected abstract T |
wrap(E value,
Array.IndexingOrder order,
int[] dims,
int[] strides)
Allocates a new array initialized to the given value.
|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getComponentType, toString
protected final V values
protected final Array.IndexingOrder order
protected final int[] dims
protected final int[] strides
protected ProtoArray(V values, Array.IndexingOrder order, int[] dims, int[] strides)
protected abstract T wrap(Array.IndexingOrder order, int[] dims, int[] strides)
order
- the storage order.dims
- the dimensions.strides
- the strides.protected abstract T wrap(E value, Array.IndexingOrder order, int[] dims, int[] strides)
value
- the initial value.order
- the storage order.dims
- the dimensions.strides
- the strides.public byte[] getBytes()
byte
s.byte
s.public V values()
protected int physical(int[] logical)
public T map(T dst, int... bounds)
Array
map
in interface Array<T extends ProtoArray<T,V,E>,E>
dst
- the destination array.bounds
- the mapping bounds as an array of three-tuples. Given the i
th tuple, the first component
denotes the source start, the second component denotes the destination start, and the third component
denotes the mapping size. Is very much the multidimensional analogy to
System.arraycopy(Object, int, Object, int, int)
.public T splice(T dst, int... slices)
Array
splice
in interface Array<T extends ProtoArray<T,V,E>,E>
dst
- the destination array.slices
- the slicing specifications as an array of three-tuples. Given the i
th tuple, the first
component denotes the source index, the second component denotes the destination index, and the third
component denotes the dimension of interest. The sliced portion is the Cartesian product subarray
delineated by these specifications.public T slice(int[][] srcSlices, T dst, int[][] dstSlices)
Array
public T slice(T dst, int[]... dstSlices)
Array
public T slice(E value, int[]... srcSlices)
Array
public T slice(int[]... srcSlices)
Array
public T tile(int... repetitions)
Array
public T transpose(int... permutation)
Array
public T shift(int... shifts)
Array
public T subarray(int... bounds)
Array
public T reverse(int... opDims)
Array
public T concat(int opDim, T... srcs)
Array
public T reverseOrder()
Array
reverseOrder
in interface Array<T extends ProtoArray<T,V,E>,E>
public Array.IndexingOrder order()
Array
public int size(int i)
Array
public int stride(int i)
Array
public int nDims()
Array
public int[] dims()
Array