Package org.bytedeco.javacpp.indexer
Class Indexer
java.lang.Object
org.bytedeco.javacpp.indexer.Indexer
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
Bfloat16Indexer
,BooleanIndexer
,ByteIndexer
,CharIndexer
,DoubleIndexer
,FloatIndexer
,HalfIndexer
,IntIndexer
,LongIndexer
,ShortIndexer
,UByteIndexer
,UIntIndexer
,ULongIndexer
,UShortIndexer
Top-level class of all data indexers, providing easy-to-use and efficient
multidimensional access to primitive arrays, NIO buffers, and the raw memory interface.
Subclasses have create()
factory methods for arrays, buffers, and pointers.
The latter ones feature a direct
argument that, when set to false
,
instructs the method to create a large enough array, fill its content with the data
from the pointer, and return an array-backed indexer, with the release()
method overridden to write back changes to the pointer. This doubles the memory
usage, but is the only way to get acceptable performance on some implementations,
such as Android. When direct == true
, the raw memory interface (supporting
long indexing) is used if available, and if not a buffer-backed indexer is returned.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionarray()
Returns the backing array, ornull
if nonebuffer()
Returns the backing buffer, ornull
if nonelong
channels()
Deprecated.protected static final long
checkIndex
(long i, long size) void
close()
Callsrelease()
.long
cols()
Deprecated.abstract double
getDouble
(long... indices) Callsget(int...indices)
and returns the value as a double.long
height()
Deprecated.long
index
(long i) Returnsindex.index(i)
.long
index
(long... indices) Returnsindex.index(indices)
.long
index
(long i, long j) Returnsindex.index(i, j)
.long
index
(long i, long j, long k) Returnsindex.index(i, j, k)
.Returnsindexable
.Setsindexable
and returns this.pointer()
Returns the backing pointer, ornull
if noneabstract Indexer
putDouble
(long[] indices, double value) Casts value to primitive type and callsput(long[] indices, <type> value)
.int
rank()
Returnsindex.rank()
.abstract <I extends Indexer>
IReturns a new Indexer using the same data, but with a different Index.abstract void
release()
Makes sure changes are reflected onto the backing memory and clears any references.long
rows()
Deprecated.long
size
(int i) Returnsindex.size(i)
.long[]
sizes()
Returnsindex.sizes()
.long
stride
(int i) Deprecated.long[]
strides()
Deprecated.static long[]
strides
(long... sizes) Deprecated.toString()
long
width()
Deprecated.
-
Field Details
-
sizes
Deprecated.SeeIndex.sizes
. -
strides
Deprecated.SeeStrideIndex.strides
. -
index
The Index to be used forindex(long...)
. -
indexable
The associated (optional)Indexable
.
-
-
Constructor Details
-
Indexer
Constructor to set theindex
. -
Indexer
protected Indexer(long[] sizes, long[] strides) CallsIndexer(Index.create(sizes, strides))
.
-
-
Method Details
-
close
public void close()Callsrelease()
.- Specified by:
close
in interfaceAutoCloseable
-
rank
public int rank()Returnsindex.rank()
. -
sizes
public long[] sizes()Returnsindex.sizes()
. -
strides
Deprecated.Returnsstrides
ornull
if there are no strides. -
size
public long size(int i) Returnsindex.size(i)
. -
stride
Deprecated.Returnsstrides[i]
or-1
if there are no strides. -
rows
Deprecated.Returnssizes.length > 0 && sizes.length < 4 ? sizes[0] : -1
. -
cols
Deprecated.Returnssizes.length > 1 && sizes.length < 4 ? sizes[1] : -1
. -
width
Deprecated.Returnssizes.length > 1 && sizes.length < 4 ? sizes[1] : -1
. -
height
Deprecated.Returnssizes.length > 0 && sizes.length < 4 ? sizes[0] : -1
. -
channels
Deprecated.Returnssizes.length > 2 && sizes.length < 4 ? sizes[2] : -1
. -
checkIndex
protected static final long checkIndex(long i, long size) -
strides
Deprecated. -
index
public long index(long i) Returnsindex.index(i)
. -
index
public long index(long i, long j) Returnsindex.index(i, j)
. -
index
public long index(long i, long j, long k) Returnsindex.index(i, j, k)
. -
index
public long index(long... indices) Returnsindex.index(indices)
. -
indexable
Returnsindexable
. -
indexable
Setsindexable
and returns this. -
array
Returns the backing array, ornull
if none -
buffer
Returns the backing buffer, ornull
if none -
pointer
Returns the backing pointer, ornull
if none -
release
public abstract void release()Makes sure changes are reflected onto the backing memory and clears any references. -
getDouble
public abstract double getDouble(long... indices) Callsget(int...indices)
and returns the value as a double. -
putDouble
Casts value to primitive type and callsput(long[] indices, <type> value)
. -
reindex
Returns a new Indexer using the same data, but with a different Index. -
toString
-