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 void setIndexName(int dim, String indexName) {
   if (dim >= mIndexArrayData.getRank()) {
     mIndexStorage.setIndexName(dim, indexName);
   } else {
     mIndexArrayData.setIndexName(dim, indexName);
   }
 }
Esempio n. 3
0
 @Override
 public IIndex reduce(int dim) {
   if (dim < mIndexArrayData.getRank()) {
     mIndexArrayData.reduce(dim);
   } else {
     mIndexStorage.reduce(dim - mIndexArrayData.getRank());
   }
   return this;
 }
Esempio n. 4
0
  @Override
  public void setShape(int[] shape) {
    if (shape.length != getRank()) {
      throw new IllegalArgumentException();
    }
    mIndexArrayData.setShape(java.util.Arrays.copyOfRange(shape, 0, mIndexArrayData.getRank()));

    mIndexStorage.setShape(
        java.util.Arrays.copyOfRange(shape, mIndexArrayData.getRank(), shape.length));
  }
Esempio n. 5
0
 @Override
 public String getIndexName(int dim) {
   String name;
   if (dim >= mIndexArrayData.getRank()) {
     name = mIndexStorage.getIndexName(dim);
   } else {
     name = mIndexArrayData.getIndexName(dim);
   }
   return name;
 }
Esempio n. 6
0
  @Override
  public void setOrigin(int[] origin) {
    if (origin.length != getRank()) {
      throw new IllegalArgumentException();
    }
    mIndexArrayData.setOrigin(java.util.Arrays.copyOfRange(origin, 0, mIndexArrayData.getRank()));

    mIndexStorage.setOrigin(
        java.util.Arrays.copyOfRange(origin, mIndexArrayData.getRank(), origin.length));
  }
Esempio n. 7
0
  @Override
  public IIndex set(int[] index) {
    if (index.length != getRank()) {
      throw new IllegalArgumentException();
    }
    mIndexArrayData.set(java.util.Arrays.copyOfRange(index, 0, mIndexArrayData.getRank()));

    mIndexStorage.set(java.util.Arrays.copyOfRange(index, mIndexArrayData.getRank(), index.length));

    return this;
  }
Esempio n. 8
0
 public int[] getCurrentCounterStorage() {
   return mIndexStorage.getCurrentCounter();
 }
Esempio n. 9
0
 public int[] getCurrentCounterMatrix() {
   return mIndexArrayData.getCurrentCounter();
 }
Esempio n. 10
0
 public long currentElementStorage() {
   return mIndexStorage.currentElement();
 }
Esempio n. 11
0
 public long currentElementMatrix() {
   return mIndexArrayData.currentElement();
 }
Esempio n. 12
0
 public List<IRange> getRangeList() {
   ArrayList<IRange> list = new ArrayList<IRange>();
   list.addAll(mIndexArrayData.getRangeList());
   list.addAll(mIndexStorage.getRangeList());
   return list;
 }
Esempio n. 13
0
 @Override
 public String toString() {
   return mIndexArrayData.toString() + "\n" + mIndexStorage;
 }
Esempio n. 14
0
 @Override
 public String toStringDebug() {
   return (mIndexArrayData.toStringDebug() + mIndexStorage.toStringDebug());
 }
Esempio n. 15
0
 @Override
 public long[] getStride() {
   return concat(mIndexArrayData.getStride(), mIndexStorage.getStride());
 }
Esempio n. 16
0
 @Override
 public long getSize() {
   long sizeArrayData = mIndexArrayData.getSize();
   return (sizeArrayData == 0 ? 1 : sizeArrayData) * mIndexStorage.getSize();
 }
Esempio n. 17
0
 @Override
 public int[] getOrigin() {
   return concat(mIndexArrayData.getOrigin(), mIndexStorage.getOrigin());
 }
Esempio n. 18
0
 @Override
 public int getRank() {
   return mIndexArrayData.getRank() + mIndexStorage.getRank();
 }
Esempio n. 19
0
 @Override
 public int[] getCurrentCounter() {
   return concat(mIndexArrayData.getCurrentCounter(), mIndexStorage.getCurrentCounter());
 }
Esempio n. 20
0
 @Override
 public long lastElement() {
   return mIndexArrayData.lastElement() * mIndexStorage.getSize() + mIndexStorage.lastElement();
 }
Esempio n. 21
0
 @Override
 public IIndex reduce() {
   mIndexArrayData.reduce();
   mIndexStorage.reduce();
   return this;
 }