Class DirectIndexedAddress

java.lang.Object
com.yahoo.tensor.DirectIndexedAddress

public final class DirectIndexedAddress extends Object
Utility class for efficient access and iteration along dimensions in Indexed tensors. Usage: Use setIndex to lock the indexes of the dimensions that don't change in this iteration. long base = addr.getDirectIndex(); long stride = addr.getStride(dimension) i = 0...size_of_dimension double value = tensor.get(base + i * stride);
Author:
baldersheim
  • Method Details

    • of

      public static DirectIndexedAddress of(DimensionSizes sizes)
    • setIndex

      public void setIndex(int dimension, int index)
      Sets the current index of a dimension
    • getDirectIndex

      public long getDirectIndex()
      Retrieve the index that can be used for direct lookup in an indexed tensor.
    • getIndexes

      public long[] getIndexes()
    • getStride

      public long getStride(int dimension)
      returns the stride to be used for the given dimension