Esempio n. 1
0
  @Override
  public void setStride(long[] stride) {
    if (stride.length != getRank()) {
      throw new IllegalArgumentException();
    }
    int iRank = mIndexArrayData.getRank();

    // Set the stride for the storage arrays
    mIndexStorage.setStride(java.util.Arrays.copyOfRange(stride, iRank, stride.length));

    // Get the number of cells in storage arrays
    long[] iStride = mIndexStorage.getStride();
    long current = iStride[0] * mIndexStorage.getShape()[0];

    // Divide the stride by number of cells contained in storage arrays
    iStride = new long[iRank];
    for (int i = iRank; i > 0; i--) {
      iStride[i - 1] = stride[i - 1] / current;
      if (iStride[i - 1] == 0) {
        iStride[i - 1] = 1;
      }
    }

    mIndexArrayData.setStride(iStride);
  }
Esempio n. 2
0
 @Override
 public long[] getStride() {
   return concat(mIndexArrayData.getStride(), mIndexStorage.getStride());
 }