Package com.yahoo.tensor
Class DirectIndexedAddress
java.lang.Object
com.yahoo.tensor.DirectIndexedAddress
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 Summary
Modifier and TypeMethodDescriptionlong
Retrieve the index that can be used for direct lookup in an indexed tensor.long[]
long
getStride
(int dimension) returns the stride to be used for the given dimensionstatic DirectIndexedAddress
of
(DimensionSizes sizes) void
setIndex
(int dimension, int index) Sets the current index of a dimension
-
Method Details
-
of
-
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
-