Class Index

    • Field Summary

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

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

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      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 rank()
      Returns sizes.length.
      long size​(int i)
      Returns sizes[i].
      long[] sizes()
      Returns sizes.
      • Methods inherited from class java.lang.Object

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

      • sizes

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

      • Index

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

      • 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