Interface INumpyArrayWrapper
-
- All Known Implementing Classes:
Dim10DoubleNumpyWrapper,Dim10FloatNumpyWrapper,Dim10Int16NumpyWrapper,Dim10Int32NumpyWrapper,Dim10Int64NumpyWrapper,Dim10Int8NumpyWrapper,Dim1DoubleNumpyWrapper,Dim1FloatNumpyWrapper,Dim1Int16NumpyWrapper,Dim1Int32NumpyWrapper,Dim1Int64NumpyWrapper,Dim1Int8NumpyWrapper,Dim2DoubleNumpyWrapper,Dim2FloatNumpyWrapper,Dim2Int16NumpyWrapper,Dim2Int32NumpyWrapper,Dim2Int64NumpyWrapper,Dim2Int8NumpyWrapper,Dim3DoubleNumpyWrapper,Dim3FloatNumpyWrapper,Dim3Int16NumpyWrapper,Dim3Int32NumpyWrapper,Dim3Int64NumpyWrapper,Dim3Int8NumpyWrapper,Dim4DoubleNumpyWrapper,Dim4FloatNumpyWrapper,Dim4Int16NumpyWrapper,Dim4Int32NumpyWrapper,Dim4Int64NumpyWrapper,Dim4Int8NumpyWrapper,Dim5DoubleNumpyWrapper,Dim5FloatNumpyWrapper,Dim5Int16NumpyWrapper,Dim5Int32NumpyWrapper,Dim5Int64NumpyWrapper,Dim5Int8NumpyWrapper,Dim6DoubleNumpyWrapper,Dim6FloatNumpyWrapper,Dim6Int16NumpyWrapper,Dim6Int32NumpyWrapper,Dim6Int64NumpyWrapper,Dim6Int8NumpyWrapper,Dim7DoubleNumpyWrapper,Dim7FloatNumpyWrapper,Dim7Int16NumpyWrapper,Dim7Int32NumpyWrapper,Dim7Int64NumpyWrapper,Dim7Int8NumpyWrapper,Dim8DoubleNumpyWrapper,Dim8FloatNumpyWrapper,Dim8Int16NumpyWrapper,Dim8Int32NumpyWrapper,Dim8Int64NumpyWrapper,Dim8Int8NumpyWrapper,Dim9DoubleNumpyWrapper,Dim9FloatNumpyWrapper,Dim9Int16NumpyWrapper,Dim9Int32NumpyWrapper,Dim9Int64NumpyWrapper,Dim9Int8NumpyWrapper
public interface INumpyArrayWrapperUnlike python, Java is a strongly typed language and all the fields should have a predefined type. This fact complicates the handling of data structures like Numpy arrays where the same interface is used for all data types. The INumpyArrayWrapper provide a unified view of the underlying data types.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Objectget(int... indices)Gets the value of a single element in the numpy array denoted by its indices.ObjectgetRawArray()Gets the native array containing the numpy array data.int[]getShape()Gets the shape of the underlying Numpy array.booleanisFloatingPoint()Returns a boolean indicating that the underlying array type is a floating point one or not.intnumberOfBits()The space allocated by each element of the numpy array in terms of bits.voidset(Object value, int... index)Sets the value of a single element in the numpy array denoted by its indices.NumpyArraytranspose()Transposes a numpy array by reversing its dimensions.NumpyArraywrapInnerSubsetArray(int... indices)Wraps a subset of the numpy array.
-
-
-
Method Detail
-
getShape
int[] getShape()
Gets the shape of the underlying Numpy array.- Returns:
- The shape of the array as an int[].
-
get
Object get(int... indices)
Gets the value of a single element in the numpy array denoted by its indices.- Parameters:
indices- The index of the element to be retrieved.- Returns:
- An object-wrapped instance of the element in the Numpy array.
-
set
void set(Object value, int... index)
Sets the value of a single element in the numpy array denoted by its indices.- Parameters:
value- The new value to be assigned to the numpy element.index- The index of the element to be set.
-
isFloatingPoint
boolean isFloatingPoint()
Returns a boolean indicating that the underlying array type is a floating point one or not.- Returns:
- A boolean value indicating floating point of the elements.
-
numberOfBits
int numberOfBits()
The space allocated by each element of the numpy array in terms of bits.- Returns:
- Number of bit needed for each element.
-
transpose
NumpyArray transpose()
Transposes a numpy array by reversing its dimensions.- Returns:
- The transposed numpy array.
-
wrapInnerSubsetArray
NumpyArray wrapInnerSubsetArray(int... indices)
Wraps a subset of the numpy array. This methods works only when slicing the most inner dimensions of the array. For example, if the shape is [2, 6, 4, 8], wrapInnerSubsetArray(1, 3) is equivalent to numpy array[1, 3, :, :].- Parameters:
indices- The indices of the first dimensions to keep.- Returns:
- A new INumpyArrayWrapper wrapping the inner dimensions. This array has the same reference.
-
getRawArray
Object getRawArray()
Gets the native array containing the numpy array data.- Returns:
- The underlying native array.
-
-