Class Index

java.lang.Object
org.bytedeco.javacpp.indexer.Index
Direct Known Subclasses:
OneIndex, StrideIndex

public abstract class Index extends Object
Provides an interface for classes that compute a linear index from given array sizes.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final long[]
    The number of elements in each dimension.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Index(long... sizes)
    Constructor to set the sizes.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Index
    create(long size)
    Returns new OneIndex(size).
    static Index
    create(long... sizes)
    Returns new StrideIndex(sizes).
    static Index
    create(long[] sizes, long[] strides)
    Returns new StrideIndex(sizes, strides).
    static Index
    create(long[] sizes, long[] selectionOffsets, long[] selectionStrides, long[] selectionCounts, long[] selectionBlocks)
    Returns new HyperslabIndex(sizes, selectionOffsets, selectionStrides, selectionCounts, selectionBlocks).
    static Index
    create(long[] sizes, long[] strides, long[] selectionOffsets, long[] selectionStrides, long[] selectionCounts, long[] selectionBlocks)
    Returns new HyperslabIndex(sizes, strides, selectionOffsets, selectionStrides, selectionCounts, selectionBlocks).
    long
    index(long i)
    Returns index(new long[] {i}).
    abstract long
    index(long... indices)
    Computes the linear index.
    long
    index(long i, long j)
    Returns index(new long[] {i, j}).
    long
    index(long i, long j, long k)
    Returns index(new long[] {i, j, k}).
    int
    Returns sizes.length.
    long
    size(int i)
    Returns sizes[i].
    long[]
    Returns sizes.

    Methods inherited from class java.lang.Object

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

    • sizes

      protected final long[] sizes
      The number of elements in each dimension. These values are not typically used by the indexer.
  • Constructor Details

    • Index

      public Index(long... sizes)
      Constructor to set the sizes.
  • Method Details

    • create

      public static Index create(long size)
      Returns new OneIndex(size).
    • create

      public static Index create(long... sizes)
      Returns new StrideIndex(sizes).
    • create

      public static Index create(long[] sizes, long[] strides)
      Returns new StrideIndex(sizes, strides).
    • create

      public static Index create(long[] sizes, long[] selectionOffsets, long[] selectionStrides, long[] selectionCounts, long[] selectionBlocks)
      Returns new HyperslabIndex(sizes, selectionOffsets, selectionStrides, selectionCounts, selectionBlocks).
    • create

      public static Index create(long[] sizes, long[] strides, long[] selectionOffsets, long[] selectionStrides, long[] selectionCounts, long[] selectionBlocks)
      Returns new HyperslabIndex(sizes, strides, selectionOffsets, selectionStrides, selectionCounts, selectionBlocks).
    • rank

      public int rank()
      Returns sizes.length.
    • sizes

      public long[] sizes()
      Returns sizes.
    • size

      public long size(int i)
      Returns sizes[i].
    • index

      public long index(long i)
      Returns index(new long[] {i}).
    • index

      public long index(long i, long j)
      Returns index(new long[] {i, j}).
    • index

      public long index(long i, long j, long k)
      Returns index(new long[] {i, j, k}).
    • index

      public abstract long index(long... indices)
      Computes the linear index.
      Parameters:
      indices - of each dimension
      Returns:
      index to access array or buffer