public int[] getCurrentCounter() { if (counter == null) counter = new Index(maa.getShape()); counter.setCurrentCounter( currElement); return counter.current; }
public int[] getCurrentCounter() { if (counter == null) counter = new Index(maa.getShape()); counter.setCurrentCounter( currElement); return counter.current; }
public int[] getCurrentCounter() { if (counter == null) counter = new Index(maa.getShape()); counter.setCurrentCounter( currElement); return counter.current; }
public int[] getCurrentCounter() { if (counter == null) counter = new Index(maa.getShape()); counter.setCurrentCounter( currElement); return counter.current; }
public String toString() { if (counter == null) counter = new Index(maa.getShape()); counter.setCurrentCounter( currElement); return counter.toString(); } public int[] getCurrentCounter() {
public String toString() { if (counter == null) counter = new Index(maa.getShape()); counter.setCurrentCounter( currElement); return counter.toString(); } public int[] getCurrentCounter() {
public String toString() { if (counter == null) counter = new Index(maa.getShape()); counter.setCurrentCounter( currElement); return counter.toString(); }
public String toString() { if (counter == null) counter = new Index(maa.getShape()); counter.setCurrentCounter( currElement); return counter.toString(); } public int[] getCurrentCounter() {
resultIndex = new Index(shape, resultStrides);
resultIndex = new Index(shape, resultStrides);
resultIndex = new Index(shape, resultStrides);
TileLayout(Section localSection, Section wantSection) throws InvalidRangeException { Section dataSection = localSection.compact(); Section resultSection = wantSection.compact(); if (debug) System.out.println(" resultSection: " + resultSection); if (debug) System.out.println(" dataSection: " + dataSection); int rank = dataSection.getRank(); // total elements to transfer total = (int) dataSection.computeSize(); // figure out the offset long product = 1; startElem = 0; // offset in want for (int ii = rank - 1; ii >= 0; ii--) { int d = dataSection.getOrigin(ii) - resultSection.getOrigin(ii); if (d > 0) startElem += product * d; product *= resultSection.getShape(ii); } resultPos = startElem; // we will use an Index object to keep track of the chunks // last range length is nelems; reduce index rank nelems = localSection.getShape(rank - 1); int[] stride = new int[rank - 1]; int[] shape = new int[rank - 1]; product = resultSection.getShape(rank - 1); for (int ii = rank - 2; ii >= 0; ii--) { stride[ii] = (int) product; shape[ii] = dataSection.getShape(ii); product *= resultSection.getShape(ii); } index = new Index(shape, stride); }
TileLayout(Section localSection, Section wantSection) throws InvalidRangeException { Section dataSection = localSection.compact(); Section resultSection = wantSection.compact(); if (debug) System.out.println(" resultSection: " + resultSection); if (debug) System.out.println(" dataSection: " + dataSection); int rank = dataSection.getRank(); // total elements to transfer total = (int) dataSection.computeSize(); // figure out the offset long product = 1; startElem = 0; // offset in want for (int ii = rank - 1; ii >= 0; ii--) { int d = dataSection.getOrigin(ii) - resultSection.getOrigin(ii); if (d > 0) startElem += product * d; product *= resultSection.getShape(ii); } resultPos = startElem; // we will use an Index object to keep track of the chunks // last range length is nelems; reduce index rank nelems = localSection.getShape(rank - 1); int[] stride = new int[rank - 1]; int[] shape = new int[rank - 1]; product = resultSection.getShape(rank - 1); for (int ii = rank - 2; ii >= 0; ii--) { stride[ii] = (int) product; shape[ii] = dataSection.getShape(ii); product *= resultSection.getShape(ii); } index = new Index(shape, stride); }
TileLayout(Section localSection, Section wantSection) throws InvalidRangeException { Section dataSection = localSection.compact(); Section resultSection = wantSection.compact(); if (debug) System.out.println(" resultSection: " + resultSection); if (debug) System.out.println(" dataSection: " + dataSection); int rank = dataSection.getRank(); // total elements to transfer total = (int) dataSection.computeSize(); // figure out the offset long product = 1; startElem = 0; // offset in want for (int ii = rank - 1; ii >= 0; ii--) { int d = dataSection.getOrigin(ii) - resultSection.getOrigin(ii); if (d > 0) startElem += product * d; product *= resultSection.getShape(ii); } resultPos = startElem; // we will use an Index object to keep track of the chunks // last range length is nelems; reduce index rank nelems = localSection.getShape(rank - 1); int[] stride = new int[rank - 1]; int[] shape = new int[rank - 1]; product = resultSection.getShape(rank - 1); for (int ii = rank - 2; ii >= 0; ii--) { stride[ii] = (int) product; shape[ii] = dataSection.getShape(ii); product *= resultSection.getShape(ii); } index = new Index(shape, stride); }
private static Index factory(int rank) { switch (rank) { case 0: return new Index0D(); case 1: return new Index1D(); case 2: return new Index2D(); case 3: return new Index3D(); case 4: return new Index4D(); case 5: return new Index5D(); case 6: return new Index6D(); case 7: return new Index7D(); default: return new Index(rank); } }
private static Index factory(int rank) { switch (rank) { case 0: return new Index0D(); case 1: return new Index1D(); case 2: return new Index2D(); case 3: return new Index3D(); case 4: return new Index4D(); case 5: return new Index5D(); case 6: return new Index6D(); case 7: return new Index7D(); default: return new Index(rank); } }
private static Index factory(int rank) { switch (rank) { case 0: return new Index0D(); case 1: return new Index1D(); case 2: return new Index2D(); case 3: return new Index3D(); case 4: return new Index4D(); case 5: return new Index5D(); case 6: return new Index6D(); case 7: return new Index7D(); default: return new Index(rank); } }
/** * Generate a subclass of Index optimized for this array's rank * @param shape use this shape * @return a subclass of Index optimized for this array's rank */ static public Index factory(int[] shape) { int rank = shape.length; switch (rank) { case 0: return new Index0D(); case 1: return new Index1D(shape); case 2: return new Index2D(shape); case 3: return new Index3D(shape); case 4: return new Index4D(shape); case 5: return new Index5D(shape); case 6: return new Index6D(shape); case 7: return new Index7D(shape); default: return new Index(shape); } }
/** * Generate a subclass of Index optimized for this array's rank * @param shape use this shape * @return a subclass of Index optimized for this array's rank */ static public Index factory(int[] shape) { int rank = shape.length; switch (rank) { case 0: return new Index0D(); case 1: return new Index1D(shape); case 2: return new Index2D(shape); case 3: return new Index3D(shape); case 4: return new Index4D(shape); case 5: return new Index5D(shape); case 6: return new Index6D(shape); case 7: return new Index7D(shape); default: return new Index(shape); } }
/** * Generate a subclass of Index optimized for this array's rank * * @param shape use this shape * @return a subclass of Index optimized for this array's rank */ static public Index factory(int[] shape) { int rank = shape.length; switch (rank) { case 0: return new Index0D(); case 1: return new Index1D(shape); case 2: return new Index2D(shape); case 3: return new Index3D(shape); case 4: return new Index4D(shape); case 5: return new Index5D(shape); case 6: return new Index6D(shape); case 7: return new Index7D(shape); default: return new Index(shape); } }