Class HalfIndexer

java.lang.Object
org.bytedeco.javacpp.indexer.Indexer
org.bytedeco.javacpp.indexer.HalfIndexer
All Implemented Interfaces:
AutoCloseable
Direct Known Subclasses:
HalfArrayIndexer, HalfBufferIndexer, HalfRawIndexer

public abstract class HalfIndexer extends Indexer
Abstract indexer for the short primitive type, treated as half-precision float.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The number of bytes used to represent a short.

    Fields inherited from class org.bytedeco.javacpp.indexer.Indexer

    index, indexable, sizes, strides
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    HalfIndexer(long[] sizes, long[] strides)
     
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    create(short[] array)
    Returns new HalfArrayIndexer(array)
    create(short[] array, long... sizes)
    Returns new HalfArrayIndexer(array, sizes)
    create(short[] array, long[] sizes, long[] strides)
    Returns new HalfArrayIndexer(array, sizes, strides)
    create(short[] array, Index index)
    Returns new HalfArrayIndexer(array, index)
    Returns new HalfBufferIndexer(buffer)
    create(ShortBuffer buffer, long... sizes)
    Returns new HalfBufferIndexer(buffer, sizes)
    create(ShortBuffer buffer, long[] sizes, long[] strides)
    Returns new HalfBufferIndexer(buffer, sizes, strides)
    create(ShortBuffer buffer, Index index)
    Returns new HalfBufferIndexer(buffer, index)
    Returns new HalfRawIndexer(pointer)
    create(ShortPointer pointer, long... sizes)
    Returns new HalfRawIndexer(pointer, sizes)
    create(ShortPointer pointer, long[] sizes, long[] strides)
    Returns new HalfRawIndexer(pointer, sizes, strides)
    create(ShortPointer pointer, long[] sizes, long[] strides, boolean direct)
    Returns create(pointer, Index.create(sizes, strides), direct)
    create(ShortPointer pointer, Index index)
    Returns new HalfRawIndexer(pointer, index)
    create(ShortPointer pointer, Index index, boolean direct)
    Creates a half float indexer to access efficiently the data of a pointer.
    static int
    fromFloat(float fval)
    returns all higher 16 bits as 0 for all results
    abstract float
    get(long i)
    Returns array/buffer[index(i)]
    abstract float
    get(long... indices)
    Returns array/buffer[index(indices)]
    get(long[] indices, float[] h)
    Returns this where h = array/buffer[index(indices)]
    abstract HalfIndexer
    get(long[] indices, float[] h, int offset, int length)
    Returns this where h[offset:offset + length] = array/buffer[index(indices)]
    get(long i, float[] h)
    Returns this where h = array/buffer[index(i)]
    abstract HalfIndexer
    get(long i, float[] h, int offset, int length)
    Returns this where h[offset:offset + length] = array/buffer[index(i)]
    abstract float
    get(long i, long j)
    Returns array/buffer[index(i, j)]
    get(long i, long j, float[] h)
    Returns this where h = array/buffer[index(i, j)]
    abstract HalfIndexer
    get(long i, long j, float[] h, int offset, int length)
    Returns this where h[offset:offset + length] = array/buffer[index(i, j)]
    abstract float
    get(long i, long j, long k)
    Returns array/buffer[index(i, j, k)]
    double
    getDouble(long... indices)
    Calls get(int...indices) and returns the value as a double.
    abstract HalfIndexer
    put(long[] indices, float h)
    Returns this where array/buffer[index(indices)] = h
    put(long[] indices, float... h)
    Returns this where array/buffer[index(indices)] = h
    abstract HalfIndexer
    put(long[] indices, float[] h, int offset, int length)
    Returns this where array/buffer[index(indices)] = h[offset:offset + length]
    abstract HalfIndexer
    put(long i, float h)
    Returns this where array/buffer[index(i)] = h
    put(long i, float... h)
    Returns this where array/buffer[index(i)] = h
    abstract HalfIndexer
    put(long i, float[] h, int offset, int length)
    Returns this where array/buffer[index(i)] = h[offset:offset + length]
    abstract HalfIndexer
    put(long i, long j, float h)
    Returns this where array/buffer[index(i, j)] = h
    put(long i, long j, float... h)
    Returns this where array/buffer[index(i, j)] = h
    abstract HalfIndexer
    put(long i, long j, float[] h, int offset, int length)
    Returns this where array/buffer[index(i, j)] = h[offset:offset + length]
    abstract HalfIndexer
    put(long i, long j, long k, float h)
    Returns this where array/buffer[index(i, j, k)] = h
    putDouble(long[] indices, double h)
    Casts value to primitive type and calls put(long[] indices, <type> value).
    static float
    toFloat(int hbits)
    ignores the higher 16 bits

    Methods inherited from class org.bytedeco.javacpp.indexer.Indexer

    array, buffer, channels, checkIndex, close, cols, height, index, index, index, index, indexable, indexable, pointer, rank, reindex, release, rows, size, sizes, stride, strides, strides, toString, width

    Methods inherited from class java.lang.Object

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

    • VALUE_BYTES

      public static final int VALUE_BYTES
      The number of bytes used to represent a short.
      See Also:
  • Constructor Details

    • HalfIndexer

      protected HalfIndexer(Index index)
    • HalfIndexer

      protected HalfIndexer(long[] sizes, long[] strides)
  • Method Details

    • create

      public static HalfIndexer create(short[] array)
      Returns new HalfArrayIndexer(array)
    • create

      public static HalfIndexer create(ShortBuffer buffer)
      Returns new HalfBufferIndexer(buffer)
    • create

      public static HalfIndexer create(ShortPointer pointer)
      Returns new HalfRawIndexer(pointer)
    • create

      public static HalfIndexer create(short[] array, Index index)
      Returns new HalfArrayIndexer(array, index)
    • create

      public static HalfIndexer create(ShortBuffer buffer, Index index)
      Returns new HalfBufferIndexer(buffer, index)
    • create

      public static HalfIndexer create(ShortPointer pointer, Index index)
      Returns new HalfRawIndexer(pointer, index)
    • create

      public static HalfIndexer create(short[] array, long... sizes)
      Returns new HalfArrayIndexer(array, sizes)
    • create

      public static HalfIndexer create(ShortBuffer buffer, long... sizes)
      Returns new HalfBufferIndexer(buffer, sizes)
    • create

      public static HalfIndexer create(ShortPointer pointer, long... sizes)
      Returns new HalfRawIndexer(pointer, sizes)
    • create

      public static HalfIndexer create(short[] array, long[] sizes, long[] strides)
      Returns new HalfArrayIndexer(array, sizes, strides)
    • create

      public static HalfIndexer create(ShortBuffer buffer, long[] sizes, long[] strides)
      Returns new HalfBufferIndexer(buffer, sizes, strides)
    • create

      public static HalfIndexer create(ShortPointer pointer, long[] sizes, long[] strides)
      Returns new HalfRawIndexer(pointer, sizes, strides)
    • create

      public static HalfIndexer create(ShortPointer pointer, long[] sizes, long[] strides, boolean direct)
      Returns create(pointer, Index.create(sizes, strides), direct)
    • create

      public static HalfIndexer create(ShortPointer pointer, Index index, boolean direct)
      Creates a half float 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 half indexer backed by the raw memory interface, a buffer, or an array
    • toFloat

      public static float toFloat(int hbits)
      ignores the higher 16 bits
    • fromFloat

      public static int fromFloat(float fval)
      returns all higher 16 bits as 0 for all results
    • get

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

      public HalfIndexer get(long i, float[] h)
      Returns this where h = array/buffer[index(i)]
    • get

      public abstract HalfIndexer get(long i, float[] h, int offset, int length)
      Returns this where h[offset:offset + length] = array/buffer[index(i)]
    • get

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

      public HalfIndexer get(long i, long j, float[] h)
      Returns this where h = array/buffer[index(i, j)]
    • get

      public abstract HalfIndexer get(long i, long j, float[] h, int offset, int length)
      Returns this where h[offset:offset + length] = array/buffer[index(i, j)]
    • get

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

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

      public HalfIndexer get(long[] indices, float[] h)
      Returns this where h = array/buffer[index(indices)]
    • get

      public abstract HalfIndexer get(long[] indices, float[] h, int offset, int length)
      Returns this where h[offset:offset + length] = array/buffer[index(indices)]
    • put

      public abstract HalfIndexer put(long i, float h)
      Returns this where array/buffer[index(i)] = h
    • put

      public HalfIndexer put(long i, float... h)
      Returns this where array/buffer[index(i)] = h
    • put

      public abstract HalfIndexer put(long i, float[] h, int offset, int length)
      Returns this where array/buffer[index(i)] = h[offset:offset + length]
    • put

      public abstract HalfIndexer put(long i, long j, float h)
      Returns this where array/buffer[index(i, j)] = h
    • put

      public HalfIndexer put(long i, long j, float... h)
      Returns this where array/buffer[index(i, j)] = h
    • put

      public abstract HalfIndexer put(long i, long j, float[] h, int offset, int length)
      Returns this where array/buffer[index(i, j)] = h[offset:offset + length]
    • put

      public abstract HalfIndexer put(long i, long j, long k, float h)
      Returns this where array/buffer[index(i, j, k)] = h
    • put

      public abstract HalfIndexer put(long[] indices, float h)
      Returns this where array/buffer[index(indices)] = h
    • put

      public HalfIndexer put(long[] indices, float... h)
      Returns this where array/buffer[index(indices)] = h
    • put

      public abstract HalfIndexer put(long[] indices, float[] h, int offset, int length)
      Returns this where array/buffer[index(indices)] = h[offset:offset + length]
    • 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 HalfIndexer putDouble(long[] indices, double h)
      Description copied from class: Indexer
      Casts value to primitive type and calls put(long[] indices, <type> value).
      Specified by:
      putDouble in class Indexer