public class DirectNDArray<T extends java.nio.Buffer>
extends java.lang.Object
Represents a numpy.ndarray in Java. If Jep was compiled with numpy support, this object will not be wrapped as a PyJobject in the Python sub-interpreter(s), it will instead be wrapped as a numpy.ndarray automatically. The numpy.ndarray will reference the exact same memory as the buffer so changes in either language will be immediately visible in both.
DirectNDArrays only support direct buffers as the underlying type of data. The data can conceptually be multi-dimensional, but it must be represented as a one-dimensional direct buffer in Java to ensure the memory is contiguous.
Constructor and Description |
---|
DirectNDArray(T data)
Constructor for a Java DirectNDArray.
|
DirectNDArray(T data,
boolean unsigned)
Constructor for a Java DirectNDArray.
|
DirectNDArray(T data,
boolean unsigned,
int... dimensions)
Constructor for a Java DirectNDArray.
|
DirectNDArray(T data,
int... dimensions)
Constructor for a Java DirectNDArray.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
T |
getData() |
int[] |
getDimensions() |
int |
getLength(T data)
Get the total length of the data object.
|
int |
hashCode() |
boolean |
isUnsigned() |
public DirectNDArray(T data)
data
- a direct Bufferpublic DirectNDArray(T data, boolean unsigned)
data
- a direct Bufferunsigned
- whether the data is to be interpreted as unsignedpublic DirectNDArray(T data, int... dimensions)
data
- a direct Bufferdimensions
- the conceptual dimensions of the data (corresponds to the
numpy.ndarray dimensions in C-contiguous order)public DirectNDArray(T data, boolean unsigned, int... dimensions)
data
- a direct Bufferunsigned
- whether the data is to be interpreted as unsigneddimensions
- the conceptual dimensions of the data (corresponds to the
numpy.ndarray dimensions in C-contiguous order)public int getLength(T data)
data
- a data objectpublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public int[] getDimensions()
public boolean isUnsigned()
public T getData()