public abstract class ByteIndexer extends Indexer
byte
primitive type.Modifier and Type | Field and Description |
---|---|
static int |
VALUE_BYTES
The number of bytes used to represent a byte.
|
indexable, ONE_STRIDE, sizes, strides
Modifier | Constructor and Description |
---|---|
protected |
ByteIndexer(long[] sizes,
long[] strides) |
Modifier and Type | Method and Description |
---|---|
static ByteIndexer |
create(byte[] array)
Returns
new ByteArrayIndexer(array) |
static ByteIndexer |
create(byte[] array,
long... sizes)
Returns
new ByteArrayIndexer(array, sizes) |
static ByteIndexer |
create(byte[] array,
long[] sizes,
long[] strides)
Returns
new ByteArrayIndexer(array, sizes, strides) |
static ByteIndexer |
create(ByteBuffer buffer)
Returns
new ByteBufferIndexer(buffer) |
static ByteIndexer |
create(ByteBuffer buffer,
long... sizes)
Returns
new ByteBufferIndexer(buffer, sizes) |
static ByteIndexer |
create(ByteBuffer buffer,
long[] sizes,
long[] strides)
Returns
new ByteBufferIndexer(buffer, sizes, strides) |
static ByteIndexer |
create(BytePointer pointer)
Returns
create(pointer, { pointer.limit() - pointer.position() }, { 1 }, true) |
static ByteIndexer |
create(BytePointer pointer,
long... sizes)
Returns
create(pointer, sizes, strides(sizes)) |
static ByteIndexer |
create(BytePointer pointer,
long[] sizes,
long[] strides)
Returns
create(pointer, sizes, strides, true) |
static ByteIndexer |
create(BytePointer pointer,
long[] sizes,
long[] strides,
boolean direct)
Creates a byte indexer to access efficiently the data of a pointer.
|
abstract byte |
get(long... indices)
Returns
array/buffer[index(indices)] |
abstract byte |
get(long i)
Returns
array/buffer[i] |
ByteIndexer |
get(long[] indices,
byte[] b)
Returns
this where b = array/buffer[index(indices)] |
abstract ByteIndexer |
get(long[] indices,
byte[] b,
int offset,
int length)
Returns
this where b[offset:offset + length] = array/buffer[index(indices)] |
ByteIndexer |
get(long i,
byte[] b)
Returns
this where b = array/buffer[i] |
abstract ByteIndexer |
get(long i,
byte[] b,
int offset,
int length)
Returns
this where b[offset:offset + length] = array/buffer[i] |
abstract byte |
get(long i,
long j)
Returns
array/buffer[i * strides[0] + j] |
ByteIndexer |
get(long i,
long j,
byte[] b)
Returns
this where b = array/buffer[i * strides[0] + j] |
abstract ByteIndexer |
get(long i,
long j,
byte[] b,
int offset,
int length)
Returns
this where b[offset:offset + length] = array/buffer[i * strides[0] + j] |
abstract byte |
get(long i,
long j,
long k)
Returns
array/buffer[i * strides[0] + j * strides[1] + k] |
float |
getBfloat16(long i)
Returns the
short value at array/buffer[i] , treated as bfloat16 |
boolean |
getBoolean(long i)
Returns the
boolean value at array/buffer[i] |
abstract char |
getChar(long i)
Returns the
char value at array/buffer[i] |
double |
getDouble(long... indices)
Calls
get(int...indices) and returns the value as a double. |
abstract double |
getDouble(long i)
Returns the
double value at array/buffer[i] |
abstract float |
getFloat(long i)
Returns the
float value at array/buffer[i] |
float |
getHalf(long i)
Returns the
short value at array/buffer[i] , treated as half-precision float |
abstract int |
getInt(long i)
Returns the
int value at array/buffer[i] |
abstract long |
getLong(long i)
Returns the
long value at array/buffer[i] |
abstract short |
getShort(long i)
Returns the
short value at array/buffer[i] |
int |
getUByte(long i)
Returns the
byte value at array/buffer[i] , treated as unsigned |
long |
getUInt(long i)
Returns the
int value at array/buffer[i] , treated as unsigned |
BigInteger |
getULong(long i)
Returns the
long value at array/buffer[i] , treated as unsigned |
int |
getUShort(long i)
Returns the
short value at array/buffer[i] , treated as unsigned |
ByteIndexer |
put(long[] indices,
byte... b)
Returns
this where array/buffer[index(indices)] = b |
abstract ByteIndexer |
put(long[] indices,
byte b)
Returns
this where array/buffer[index(indices)] = b |
abstract ByteIndexer |
put(long[] indices,
byte[] b,
int offset,
int length)
Returns
this where array/buffer[index(indices)] = b[offset:offset + length] |
ByteIndexer |
put(long i,
byte... b)
Returns
this where array/buffer[i] = b |
abstract ByteIndexer |
put(long i,
byte b)
Returns
this where array/buffer[i] = b |
abstract ByteIndexer |
put(long i,
byte[] b,
int offset,
int length)
Returns
this where array/buffer[i] = b[offset:offset + length] |
ByteIndexer |
put(long i,
long j,
byte... b)
Returns
this where array/buffer[i * strides[0] + j] = b |
abstract ByteIndexer |
put(long i,
long j,
byte b)
Returns
this where array/buffer[i * strides[0] + j] = b |
abstract ByteIndexer |
put(long i,
long j,
byte[] b,
int offset,
int length)
Returns
this where array/buffer[i * strides[0] + j] = b[offset:offset + length] |
abstract ByteIndexer |
put(long i,
long j,
long k,
byte b)
Returns
this where array/buffer[i * strides[0] + j * strides[1] + k] = b |
ByteIndexer |
putBfloat16(long i,
float h)
Sets the
short value at array/buffer[i] , treated as bfloat16 |
ByteIndexer |
putBoolean(long i,
boolean b)
Sets the
boolean value at array/buffer[i] |
abstract ByteIndexer |
putChar(long i,
char c)
Sets the
char value at array/buffer[i] |
ByteIndexer |
putDouble(long[] indices,
double b)
Casts value to primitive type and calls
put(long[] indices, <type> value) . |
abstract ByteIndexer |
putDouble(long i,
double d)
Sets the
double value at array/buffer[i] |
abstract ByteIndexer |
putFloat(long i,
float f)
Sets the
float value at array/buffer[i] |
ByteIndexer |
putHalf(long i,
float h)
Sets the
short value at array/buffer[i] , treated as half-precision float |
abstract ByteIndexer |
putInt(long i,
int j)
Sets the
int value at array/buffer[i] |
abstract ByteIndexer |
putLong(long i,
long j)
Sets the
long value at array/buffer[i] |
abstract ByteIndexer |
putShort(long i,
short s)
Sets the
short value at array/buffer[i] |
ByteIndexer |
putUByte(long i,
int b)
Sets the
byte value at array/buffer[i] , treated as unsigned |
ByteIndexer |
putUInt(long i,
long n)
Sets the
int value at array/buffer[i] , treated as unsigned |
ByteIndexer |
putULong(long i,
BigInteger l)
Sets the
long value at array/buffer[i] , treated as unsigned |
ByteIndexer |
putUShort(long i,
int s)
Sets the
short value at array/buffer[i] , treated as unsigned |
public static final int VALUE_BYTES
public static ByteIndexer create(byte[] array)
new ByteArrayIndexer(array)
public static ByteIndexer create(ByteBuffer buffer)
new ByteBufferIndexer(buffer)
public static ByteIndexer create(BytePointer pointer)
create(pointer, { pointer.limit() - pointer.position() }, { 1 }, true)
public static ByteIndexer create(byte[] array, long... sizes)
new ByteArrayIndexer(array, sizes)
public static ByteIndexer create(ByteBuffer buffer, long... sizes)
new ByteBufferIndexer(buffer, sizes)
public static ByteIndexer create(BytePointer pointer, long... sizes)
create(pointer, sizes, strides(sizes))
public static ByteIndexer create(byte[] array, long[] sizes, long[] strides)
new ByteArrayIndexer(array, sizes, strides)
public static ByteIndexer create(ByteBuffer buffer, long[] sizes, long[] strides)
new ByteBufferIndexer(buffer, sizes, strides)
public static ByteIndexer create(BytePointer pointer, long[] sizes, long[] strides)
create(pointer, sizes, strides, true)
public static ByteIndexer create(BytePointer pointer, long[] sizes, long[] strides, boolean direct)
pointer
- data to access via a buffer or to copy to an arraydirect
- true
to use a direct buffer, see Indexer
for detailspublic abstract byte get(long i)
array/buffer[i]
public ByteIndexer get(long i, byte[] b)
this
where b = array/buffer[i]
public abstract ByteIndexer get(long i, byte[] b, int offset, int length)
this
where b[offset:offset + length] = array/buffer[i]
public abstract byte get(long i, long j)
array/buffer[i * strides[0] + j]
public ByteIndexer get(long i, long j, byte[] b)
this
where b = array/buffer[i * strides[0] + j]
public abstract ByteIndexer get(long i, long j, byte[] b, int offset, int length)
this
where b[offset:offset + length] = array/buffer[i * strides[0] + j]
public abstract byte get(long i, long j, long k)
array/buffer[i * strides[0] + j * strides[1] + k]
public abstract byte get(long... indices)
array/buffer[index(indices)]
public ByteIndexer get(long[] indices, byte[] b)
this
where b = array/buffer[index(indices)]
public abstract ByteIndexer get(long[] indices, byte[] b, int offset, int length)
this
where b[offset:offset + length] = array/buffer[index(indices)]
public abstract ByteIndexer put(long i, byte b)
this
where array/buffer[i] = b
public ByteIndexer put(long i, byte... b)
this
where array/buffer[i] = b
public abstract ByteIndexer put(long i, byte[] b, int offset, int length)
this
where array/buffer[i] = b[offset:offset + length]
public abstract ByteIndexer put(long i, long j, byte b)
this
where array/buffer[i * strides[0] + j] = b
public ByteIndexer put(long i, long j, byte... b)
this
where array/buffer[i * strides[0] + j] = b
public abstract ByteIndexer put(long i, long j, byte[] b, int offset, int length)
this
where array/buffer[i * strides[0] + j] = b[offset:offset + length]
public abstract ByteIndexer put(long i, long j, long k, byte b)
this
where array/buffer[i * strides[0] + j * strides[1] + k] = b
public abstract ByteIndexer put(long[] indices, byte b)
this
where array/buffer[index(indices)] = b
public ByteIndexer put(long[] indices, byte... b)
this
where array/buffer[index(indices)] = b
public abstract ByteIndexer put(long[] indices, byte[] b, int offset, int length)
this
where array/buffer[index(indices)] = b[offset:offset + length]
public abstract short getShort(long i)
short
value at array/buffer[i]
public abstract ByteIndexer putShort(long i, short s)
short
value at array/buffer[i]
public abstract int getInt(long i)
int
value at array/buffer[i]
public abstract ByteIndexer putInt(long i, int j)
int
value at array/buffer[i]
public abstract long getLong(long i)
long
value at array/buffer[i]
public abstract ByteIndexer putLong(long i, long j)
long
value at array/buffer[i]
public abstract float getFloat(long i)
float
value at array/buffer[i]
public abstract ByteIndexer putFloat(long i, float f)
float
value at array/buffer[i]
public abstract double getDouble(long i)
double
value at array/buffer[i]
public abstract ByteIndexer putDouble(long i, double d)
double
value at array/buffer[i]
public abstract char getChar(long i)
char
value at array/buffer[i]
public abstract ByteIndexer putChar(long i, char c)
char
value at array/buffer[i]
public int getUByte(long i)
byte
value at array/buffer[i]
, treated as unsignedpublic ByteIndexer putUByte(long i, int b)
byte
value at array/buffer[i]
, treated as unsignedpublic int getUShort(long i)
short
value at array/buffer[i]
, treated as unsignedpublic ByteIndexer putUShort(long i, int s)
short
value at array/buffer[i]
, treated as unsignedpublic long getUInt(long i)
int
value at array/buffer[i]
, treated as unsignedpublic ByteIndexer putUInt(long i, long n)
int
value at array/buffer[i]
, treated as unsignedpublic BigInteger getULong(long i)
long
value at array/buffer[i]
, treated as unsignedpublic ByteIndexer putULong(long i, BigInteger l)
long
value at array/buffer[i]
, treated as unsignedpublic float getHalf(long i)
short
value at array/buffer[i]
, treated as half-precision floatpublic ByteIndexer putHalf(long i, float h)
short
value at array/buffer[i]
, treated as half-precision floatpublic float getBfloat16(long i)
short
value at array/buffer[i]
, treated as bfloat16public ByteIndexer putBfloat16(long i, float h)
short
value at array/buffer[i]
, treated as bfloat16public boolean getBoolean(long i)
boolean
value at array/buffer[i]
public ByteIndexer putBoolean(long i, boolean b)
boolean
value at array/buffer[i]
public double getDouble(long... indices)
Indexer
get(int...indices)
and returns the value as a double.public ByteIndexer putDouble(long[] indices, double b)
Indexer
put(long[] indices, <type> value)
.Copyright © 2020. All rights reserved.