public void setIndex(int dimension, int index) {
        if (index < 0 || index >= sizes.size(dimension)) {
            throw new IndexOutOfBoundsException("Index " + index + " outside of [0," + sizes.size(dimension) + ">");
        }
        int diff = index - indexes[dimension];
        directIndex += getStride(dimension) * diff;
        indexes[dimension] = index;
    }
Sets the current index of a dimension
vespajlib/src/main/java/com/yahoo/tensor/DirectIndexedAddress.java