Class ByteIndexer

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected ByteIndexer​(long[] sizes, long[] strides)  
      protected ByteIndexer​(Index index)  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method 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​(byte[] array, Index index)
      Returns new ByteArrayIndexer(array, index)
      static ByteIndexer create​(java.nio.ByteBuffer buffer)
      Returns new ByteBufferIndexer(buffer)
      static ByteIndexer create​(java.nio.ByteBuffer buffer, long... sizes)
      Returns new ByteBufferIndexer(buffer, sizes)
      static ByteIndexer create​(java.nio.ByteBuffer buffer, long[] sizes, long[] strides)
      Returns new ByteBufferIndexer(buffer, sizes, strides)
      static ByteIndexer create​(java.nio.ByteBuffer buffer, Index index)
      Returns new ByteBufferIndexer(buffer, index)
      static ByteIndexer create​(BytePointer pointer)
      Returns new ByteRawIndexer(pointer)
      static ByteIndexer create​(BytePointer pointer, long... sizes)
      Returns new ByteRawIndexer(pointer, index)
      static ByteIndexer create​(BytePointer pointer, long[] sizes, long[] strides)
      Returns new ByteRawIndexer(pointer, sizes, strides)
      static ByteIndexer create​(BytePointer pointer, long[] sizes, long[] strides, boolean direct)
      Returns create(pointer, Index.create(sizes, strides), direct)
      static ByteIndexer create​(BytePointer pointer, Index index)
      Returns new ByteRawIndexer(pointer, index)
      static ByteIndexer create​(BytePointer pointer, Index index, boolean direct)
      Creates a byte indexer to access efficiently the data of a pointer.
      abstract byte get​(long i)
      Returns array/buffer[index(i)]
      abstract byte get​(long... indices)
      Returns array/buffer[index(indices)]
      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[index(i)]
      abstract ByteIndexer get​(long i, byte[] b, int offset, int length)
      Returns this where b[offset:offset + length] = array/buffer[index(i)]
      abstract byte get​(long i, long j)
      Returns array/buffer[index(i, j)]
      ByteIndexer get​(long i, long j, byte[] b)
      Returns this where b = array/buffer[index(i, j)]
      abstract ByteIndexer get​(long i, long j, byte[] b, int offset, int length)
      Returns this where b[offset:offset + length] = array/buffer[index(i, j)]
      abstract byte get​(long i, long j, long k)
      Returns array/buffer[index(i, j, 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 byte getByte​(long i)
      Returns the byte value at array/buffer[i]
      abstract char getChar​(long i)
      Returns the char value at array/buffer[i]
      abstract double getDouble​(long i)
      Returns the double value at array/buffer[i]
      double getDouble​(long... indices)
      Calls get(int...indices) and returns the value as a double.
      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
      java.math.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
      abstract ByteIndexer put​(long[] indices, byte b)
      Returns this where array/buffer[index(indices)] = b
      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]
      abstract ByteIndexer put​(long i, byte b)
      Returns this where array/buffer[index(i)] = b
      ByteIndexer put​(long i, byte... b)
      Returns this where array/buffer[index(i)] = b
      abstract ByteIndexer put​(long i, byte[] b, int offset, int length)
      Returns this where array/buffer[index(i)] = b[offset:offset + length]
      abstract ByteIndexer put​(long i, long j, byte b)
      Returns this where array/buffer[index(i, j)] = b
      ByteIndexer put​(long i, long j, byte... b)
      Returns this where array/buffer[index(i, j)] = b
      abstract ByteIndexer put​(long i, long j, byte[] b, int offset, int length)
      Returns this where array/buffer[index(i, j)] = b[offset:offset + length]
      abstract ByteIndexer put​(long i, long j, long k, byte b)
      Returns this where array/buffer[index(i, j, 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 putByte​(long i, byte b)
      Sets the byte 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, java.math.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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • VALUE_BYTES

        public static final int VALUE_BYTES
        The number of bytes used to represent a byte.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ByteIndexer

        protected ByteIndexer​(Index index)
      • ByteIndexer

        protected ByteIndexer​(long[] sizes,
                              long[] strides)
    • Method Detail

      • create

        public static ByteIndexer create​(byte[] array)
        Returns new ByteArrayIndexer(array)
      • create

        public static ByteIndexer create​(java.nio.ByteBuffer buffer)
        Returns new ByteBufferIndexer(buffer)
      • create

        public static ByteIndexer create​(byte[] array,
                                         Index index)
        Returns new ByteArrayIndexer(array, index)
      • create

        public static ByteIndexer create​(java.nio.ByteBuffer buffer,
                                         Index index)
        Returns new ByteBufferIndexer(buffer, index)
      • create

        public static ByteIndexer create​(byte[] array,
                                         long... sizes)
        Returns new ByteArrayIndexer(array, sizes)
      • create

        public static ByteIndexer create​(java.nio.ByteBuffer buffer,
                                         long... sizes)
        Returns new ByteBufferIndexer(buffer, sizes)
      • create

        public static ByteIndexer create​(BytePointer pointer,
                                         long... sizes)
        Returns new ByteRawIndexer(pointer, index)
      • create

        public static ByteIndexer create​(byte[] array,
                                         long[] sizes,
                                         long[] strides)
        Returns new ByteArrayIndexer(array, sizes, strides)
      • create

        public static ByteIndexer create​(java.nio.ByteBuffer buffer,
                                         long[] sizes,
                                         long[] strides)
        Returns new ByteBufferIndexer(buffer, sizes, strides)
      • create

        public static ByteIndexer create​(BytePointer pointer,
                                         long[] sizes,
                                         long[] strides)
        Returns new ByteRawIndexer(pointer, sizes, strides)
      • create

        public static ByteIndexer create​(BytePointer pointer,
                                         long[] sizes,
                                         long[] strides,
                                         boolean direct)
        Returns create(pointer, Index.create(sizes, strides), direct)
      • create

        public static ByteIndexer create​(BytePointer pointer,
                                         Index index,
                                         boolean direct)
        Creates a byte indexer to access efficiently the data of a pointer.
        Parameters:
        pointer - data to access via a buffer or to copy to an array
        index - to use
        direct - true to use a direct buffer, see Indexer for details
        Returns:
        the new byte indexer backed by the raw memory interface, a buffer, or an array
      • get

        public abstract byte get​(long i)
        Returns array/buffer[index(i)]
      • get

        public ByteIndexer get​(long i,
                               byte[] b)
        Returns this where b = array/buffer[index(i)]
      • get

        public abstract ByteIndexer get​(long i,
                                        byte[] b,
                                        int offset,
                                        int length)
        Returns this where b[offset:offset + length] = array/buffer[index(i)]
      • get

        public abstract byte get​(long i,
                                 long j)
        Returns array/buffer[index(i, j)]
      • get

        public ByteIndexer get​(long i,
                               long j,
                               byte[] b)
        Returns this where b = array/buffer[index(i, j)]
      • get

        public abstract ByteIndexer get​(long i,
                                        long j,
                                        byte[] b,
                                        int offset,
                                        int length)
        Returns this where b[offset:offset + length] = array/buffer[index(i, j)]
      • get

        public abstract byte get​(long i,
                                 long j,
                                 long k)
        Returns array/buffer[index(i, j, k)]
      • get

        public abstract byte get​(long... indices)
        Returns array/buffer[index(indices)]
      • get

        public ByteIndexer get​(long[] indices,
                               byte[] b)
        Returns this where b = array/buffer[index(indices)]
      • get

        public abstract ByteIndexer get​(long[] indices,
                                        byte[] b,
                                        int offset,
                                        int length)
        Returns this where b[offset:offset + length] = array/buffer[index(indices)]
      • put

        public abstract ByteIndexer put​(long i,
                                        byte b)
        Returns this where array/buffer[index(i)] = b
      • put

        public ByteIndexer put​(long i,
                               byte... b)
        Returns this where array/buffer[index(i)] = b
      • put

        public abstract ByteIndexer put​(long i,
                                        byte[] b,
                                        int offset,
                                        int length)
        Returns this where array/buffer[index(i)] = b[offset:offset + length]
      • put

        public abstract ByteIndexer put​(long i,
                                        long j,
                                        byte b)
        Returns this where array/buffer[index(i, j)] = b
      • put

        public ByteIndexer put​(long i,
                               long j,
                               byte... b)
        Returns this where array/buffer[index(i, j)] = b
      • put

        public abstract ByteIndexer put​(long i,
                                        long j,
                                        byte[] b,
                                        int offset,
                                        int length)
        Returns this where array/buffer[index(i, j)] = b[offset:offset + length]
      • put

        public abstract ByteIndexer put​(long i,
                                        long j,
                                        long k,
                                        byte b)
        Returns this where array/buffer[index(i, j, k)] = b
      • put

        public abstract ByteIndexer put​(long[] indices,
                                        byte b)
        Returns this where array/buffer[index(indices)] = b
      • put

        public ByteIndexer put​(long[] indices,
                               byte... b)
        Returns this where array/buffer[index(indices)] = b
      • put

        public abstract ByteIndexer put​(long[] indices,
                                        byte[] b,
                                        int offset,
                                        int length)
        Returns this where array/buffer[index(indices)] = b[offset:offset + length]
      • getByte

        public abstract byte getByte​(long i)
        Returns the byte value at array/buffer[i]
      • putByte

        public abstract ByteIndexer putByte​(long i,
                                            byte b)
        Sets the byte value at array/buffer[i]
      • getShort

        public abstract short getShort​(long i)
        Returns the short value at array/buffer[i]
      • putShort

        public abstract ByteIndexer putShort​(long i,
                                             short s)
        Sets the short value at array/buffer[i]
      • getInt

        public abstract int getInt​(long i)
        Returns the int value at array/buffer[i]
      • putInt

        public abstract ByteIndexer putInt​(long i,
                                           int j)
        Sets the int value at array/buffer[i]
      • getLong

        public abstract long getLong​(long i)
        Returns the long value at array/buffer[i]
      • putLong

        public abstract ByteIndexer putLong​(long i,
                                            long j)
        Sets the long value at array/buffer[i]
      • getFloat

        public abstract float getFloat​(long i)
        Returns the float value at array/buffer[i]
      • putFloat

        public abstract ByteIndexer putFloat​(long i,
                                             float f)
        Sets the float value at array/buffer[i]
      • getDouble

        public abstract double getDouble​(long i)
        Returns the double value at array/buffer[i]
      • putDouble

        public abstract ByteIndexer putDouble​(long i,
                                              double d)
        Sets the double value at array/buffer[i]
      • getChar

        public abstract char getChar​(long i)
        Returns the char value at array/buffer[i]
      • putChar

        public abstract ByteIndexer putChar​(long i,
                                            char c)
        Sets the char value at array/buffer[i]
      • getUByte

        public int getUByte​(long i)
        Returns the byte value at array/buffer[i], treated as unsigned
      • putUByte

        public ByteIndexer putUByte​(long i,
                                    int b)
        Sets the byte value at array/buffer[i], treated as unsigned
      • getUShort

        public int getUShort​(long i)
        Returns the short value at array/buffer[i], treated as unsigned
      • putUShort

        public ByteIndexer putUShort​(long i,
                                     int s)
        Sets the short value at array/buffer[i], treated as unsigned
      • getUInt

        public long getUInt​(long i)
        Returns the int value at array/buffer[i], treated as unsigned
      • putUInt

        public ByteIndexer putUInt​(long i,
                                   long n)
        Sets the int value at array/buffer[i], treated as unsigned
      • getULong

        public java.math.BigInteger getULong​(long i)
        Returns the long value at array/buffer[i], treated as unsigned
      • putULong

        public ByteIndexer putULong​(long i,
                                    java.math.BigInteger l)
        Sets the long value at array/buffer[i], treated as unsigned
      • getHalf

        public float getHalf​(long i)
        Returns the short value at array/buffer[i], treated as half-precision float
      • putHalf

        public ByteIndexer putHalf​(long i,
                                   float h)
        Sets the short value at array/buffer[i], treated as half-precision float
      • getBfloat16

        public float getBfloat16​(long i)
        Returns the short value at array/buffer[i], treated as bfloat16
      • putBfloat16

        public ByteIndexer putBfloat16​(long i,
                                       float h)
        Sets the short value at array/buffer[i], treated as bfloat16
      • getBoolean

        public boolean getBoolean​(long i)
        Returns the boolean value at array/buffer[i]
      • putBoolean

        public ByteIndexer putBoolean​(long i,
                                      boolean b)
        Sets the boolean value at array/buffer[i]
      • getDouble

        public double getDouble​(long... indices)
        Description copied from class: Indexer
        Calls get(int...indices) and returns the value as a double.
        Specified by:
        getDouble in class Indexer
      • putDouble

        public ByteIndexer putDouble​(long[] indices,
                                     double b)
        Description copied from class: Indexer
        Casts value to primitive type and calls put(long[] indices, <type> value).
        Specified by:
        putDouble in class Indexer