public interface DataBuffer extends Serializable
Modifier and Type | Interface and Description |
---|---|
static class |
DataBuffer.AllocationMode
Mainly used for backward compatability.
|
static class |
DataBuffer.Type |
static class |
DataBuffer.TypeEx |
Modifier and Type | Method and Description |
---|---|
void |
addReferencing(String id)
Add a referencing element to this buffer
|
long |
address()
Returns the address of the pointer
|
org.bytedeco.javacpp.Pointer |
addressPointer()
Returns the address of the pointer wrapped in a Pointer
|
DataBuffer.AllocationMode |
allocationMode()
Allocation mode for buffers
|
Object |
array()
Returns the backing array
of this buffer (if there is one)
|
byte[] |
asBytes()
Raw byte array storage
|
double[] |
asDouble()
Return the buffer as a double array
Relative to the datatype, this will either be a copy
or a reference.
|
float[] |
asFloat()
Return the buffer as a float array
Relative to the datatype, this will either be a copy
or a reference.
|
int[] |
asInt()
Return the buffer as an int array
Relative to the datatype, this will either be a copy
or a reference.
|
long[] |
asLong()
Return the buffer as an long array
Relative to the datatype, this will either be a copy
or a reference.
|
ByteBuffer |
asNio()
Returns a view of this as an
nio byte buffer
|
DoubleBuffer |
asNioDouble()
Returns a view of this as an
nio byte buffer
|
FloatBuffer |
asNioFloat()
Returns a view of this as an
nio byte buffer
|
IntBuffer |
asNioInt()
Returns a view of this as an
nio byte buffer
|
LongBuffer |
asNioLong() |
void |
assign(DataBuffer... buffers)
Assign the given data buffers to this buffer
|
void |
assign(DataBuffer data)
Assign the contents of this buffer
to this buffer
|
void |
assign(long[] indices,
double[] data,
boolean contiguous)
Assign the given elements to the given indices
|
void |
assign(long[] indices,
double[] data,
boolean contiguous,
long inc)
Assign the given elements to the given indices
|
void |
assign(long[] indices,
float[] data,
boolean contiguous)
Assign the given elements to the given indices
|
void |
assign(long[] indices,
float[] data,
boolean contiguous,
long inc)
Assign the given elements to the given indices
|
void |
assign(long[] offsets,
long[] strides,
DataBuffer... buffers)
Assign the given buffers to this buffer
based on the given offsets and strides.
|
void |
assign(long[] offsets,
long[] strides,
long n,
DataBuffer... buffers)
Assign the given buffers to this buffer
based on the given offsets and strides.
|
void |
assign(Number value)
Assign the given value to the buffer
|
void |
assign(Number value,
long offset)
Assign the given value to the buffer
starting at offset
|
long |
capacity() |
void |
copyAtStride(DataBuffer buf,
long n,
long stride,
long yStride,
long offset,
long yOffset)
Copies from
the given buffer
at the specified stride
for up to n elements
|
DataBuffer.Type |
dataType()
The data opType of the buffer
|
void |
destroy()
release all resources for this buffer
|
boolean |
dirty()
Whether the buffer is dirty:
aka has been updated
|
DataBuffer |
dup()
Return a copy of this buffer
|
void |
flush()
Flush the data buffer
|
double |
getDouble(long i)
Get element i in the buffer as a double
|
double[] |
getDoublesAt(long offset,
int length)
Get the doubles at a particular offset
|
double[] |
getDoublesAt(long offset,
long inc,
int length)
Get the doubles at a particular offset
|
int |
getElementSize()
The number of bytes for each individual element
|
float |
getFloat(long i)
Get element i in the buffer as a double
|
float[] |
getFloatsAt(long offset,
int length)
Get the doubles at a particular offset
|
float[] |
getFloatsAt(long offset,
long inc,
int length)
Get the doubles at a particular offset
|
long |
getGenerationId() |
int |
getInt(long ix)
Get the int at the specified index
|
int[] |
getIntsAt(long offset,
int length)
Get the ints at a particular offset
|
int[] |
getIntsAt(long offset,
long inc,
int length)
Get the ints at a particular offset
|
long |
getLong(long i)
Get element i in the buffer as long value
|
long[] |
getLongsAt(long offset,
int length)
Get the longs at a particular offset
|
long[] |
getLongsAt(long offset,
long inc,
int length)
Get the long at a particular offset
|
Number |
getNumber(long i)
Get element i in the buffer as a double
|
MemoryWorkspace |
getParentWorkspace()
This method returns Workspace this DataBuffer is attached to
|
Long |
getTrackingPoint()
Returns tracking point for Allocator
PLEASE NOTE: Suitable & meaningful only for specific backends
|
org.bytedeco.javacpp.indexer.Indexer |
indexer()
Returns the indexer for the buffer
|
boolean |
isAttached()
This method returns True, if this DataBuffer is attached to some workspace.
|
boolean |
isConstant()
This method returns whether this DataBuffer is constant, or not.
|
boolean |
isInScope()
This method checks, if given attached INDArray is still in scope of its parent Workspace
PLEASE NOTE: if this INDArray isn't attached to any Workspace, this method will return true
|
boolean |
isPersist()
Whether the buffer should be persistent.
|
long |
length()
Returns the length of the buffer
|
long |
offset()
Returns the offset of the buffer
|
DataBuffer |
originalDataBuffer()
Original DataBuffer.
|
long |
originalOffset()
Returns the offset of the buffer relative to originalDataBuffer
|
void |
persist()
Mark this buffer as persistent
|
org.bytedeco.javacpp.Pointer |
pointer()
Returns an underlying pointer if one exists
|
void |
put(long i,
double element)
Assign an element in the buffer to the specified index
|
void |
put(long i,
float element)
Assign an element in the buffer to the specified index
|
void |
put(long i,
int element)
Assign an element in the buffer to the specified index
|
void |
put(long i,
long element) |
void |
read(DataInputStream s) |
void |
read(InputStream is)
Write this buffer to the input stream.
|
DataBuffer |
reallocate(long length)
Reallocate the native memory of the buffer
|
Collection<String> |
references()
The referencers pointing to this buffer
|
void |
removeReferencing(String id)
Remove the referenced id if it exists
|
boolean |
sameUnderlyingData(DataBuffer buffer)
Returns true if the underlying data source
is the same for both buffers (referential equals)
|
void |
setConstant(boolean reallyConstant)
This method allows you to mark databuffer as constant.
|
void |
setData(double[] data)
Set the data for this buffer
|
void |
setData(float[] data)
Set the data for this buffer
|
void |
setData(int[] data)
Set the data for this buffer
|
void |
setData(long[] data)
Set the data for this buffer
|
void |
setTrackingPoint(Long trackingPoint)
Sets tracking point used by Allocator
PLEASE NOTE: Suitable & meaningful only for specific backends
|
DataBuffer |
underlyingDataBuffer()
Underlying buffer:
This is meant for a data buffer
to be a view of another data buffer
|
long |
underlyingLength()
Returns the length of the buffer
|
void |
unPersist()
Un persist the buffer
|
void |
write(DataOutputStream out) |
void |
write(OutputStream dos)
Write this buffer to the output stream
|
long getGenerationId()
org.bytedeco.javacpp.Pointer pointer()
org.bytedeco.javacpp.Pointer addressPointer()
org.bytedeco.javacpp.indexer.Indexer indexer()
long address()
boolean sameUnderlyingData(DataBuffer buffer)
buffer
- whether the buffer is the same underlying data or notvoid read(DataInputStream s)
void write(DataOutputStream out) throws IOException
IOException
Object array()
IntBuffer asNioInt()
LongBuffer asNioLong()
DoubleBuffer asNioDouble()
FloatBuffer asNioFloat()
ByteBuffer asNio()
boolean dirty()
DataBuffer underlyingDataBuffer()
DataBuffer originalDataBuffer()
void copyAtStride(DataBuffer buf, long n, long stride, long yStride, long offset, long yOffset)
buf
- the data buffer to copy fromn
- the number of elements to copystride
- the stride to copy atyStride
- offset
- yOffset
- DataBuffer.AllocationMode allocationMode()
void persist()
boolean isPersist()
void unPersist()
int getElementSize()
void removeReferencing(String id)
id
- the id to removeCollection<String> references()
void addReferencing(String id)
id
- the id to referencevoid assign(long[] indices, float[] data, boolean contiguous, long inc)
indices
- the indices to assigndata
- the data to assigncontiguous
- whether the indices are contiguous or notinc
- the number to increment by when assigningvoid assign(long[] indices, double[] data, boolean contiguous, long inc)
indices
- the indices to assigndata
- the data to assigncontiguous
- whether the data is contiguous or notinc
- the number to increment by when assigningvoid assign(long[] indices, float[] data, boolean contiguous)
indices
- the indices to assigndata
- the data to assigncontiguous
- whether the indices are contiguous or notvoid assign(long[] indices, double[] data, boolean contiguous)
indices
- the indices to assigndata
- the data to assigncontiguous
- whether the data is contiguous or notdouble[] getDoublesAt(long offset, int length)
offset
- the offset to startlength
- the length of the arrayfloat[] getFloatsAt(long offset, int length)
offset
- the offset to startlength
- the length of the arrayint[] getIntsAt(long offset, int length)
offset
- the offset to startlength
- the length of the arraylong[] getLongsAt(long offset, int length)
offset
- the offset to startlength
- the length of the arraydouble[] getDoublesAt(long offset, long inc, int length)
offset
- the offset to startinc
- the increment to uselength
- the length of the arrayfloat[] getFloatsAt(long offset, long inc, int length)
offset
- the offset to startinc
- the increment to uselength
- the length of the arrayint[] getIntsAt(long offset, long inc, int length)
offset
- the offset to startinc
- the increment to uselength
- the length of the arraylong[] getLongsAt(long offset, long inc, int length)
offset
- the offset to startinc
- the increment to uselength
- the length of the arrayvoid assign(Number value)
value
- the value to assignvoid assign(Number value, long offset)
value
- assign the value to setoffset
- the offset to start atvoid setData(int[] data)
data
- the data for this buffervoid setData(long[] data)
data
- the data for this buffervoid setData(float[] data)
data
- the data for this buffervoid setData(double[] data)
data
- the data for this bufferbyte[] asBytes()
DataBuffer.Type dataType()
float[] asFloat()
double[] asDouble()
int[] asInt()
long[] asLong()
double getDouble(long i)
i
- the element to getFloatlong getLong(long i)
i
- float getFloat(long i)
i
- the element to getFloatNumber getNumber(long i)
i
- the element to getFloatvoid put(long i, float element)
i
- the indexelement
- the element to assignvoid put(long i, double element)
i
- the indexelement
- the element to assignvoid put(long i, int element)
i
- the indexelement
- the element to assignvoid put(long i, long element)
long length()
long underlyingLength()
long offset()
long originalOffset()
int getInt(long ix)
ix
- the int at the specified indexDataBuffer dup()
void flush()
void assign(DataBuffer data)
data
- the data to assignvoid assign(long[] offsets, long[] strides, long n, DataBuffer... buffers)
offsets
- the offsets to usestrides
- the strides to usen
- the number of elements to operate onbuffers
- the buffers to assign data fromvoid assign(DataBuffer... buffers)
buffers
- the buffers to assignvoid assign(long[] offsets, long[] strides, DataBuffer... buffers)
offsets
- the offsets to usestrides
- the strides to usebuffers
- the buffers to assign data fromvoid destroy()
void write(OutputStream dos)
dos
- the output stream to writevoid read(InputStream is)
is
- the inpus tream to write toLong getTrackingPoint()
void setTrackingPoint(Long trackingPoint)
trackingPoint
- boolean isConstant()
void setConstant(boolean reallyConstant)
reallyConstant
- boolean isAttached()
boolean isInScope()
MemoryWorkspace getParentWorkspace()
DataBuffer reallocate(long length)
length
- the new length of the bufferlong capacity()
Copyright © 2018. All rights reserved.