Skip to content
Snippets Groups Projects
Commit 6f95533c authored by Vojtech Moravec's avatar Vojtech Moravec
Browse files

Fix wrong index calculation in row vector loading.

parent b2b400e4
No related branches found
No related tags found
No related merge requests found
......@@ -32,10 +32,13 @@ public abstract class BasicLoader {
}
protected int[][] loadRowVectorsImplByLoadPlaneData(final int vectorSize, final Range<Integer> planeRange) throws IOException {
System.out.println("we are here and maybe it is wrong.");
final int rowVectorCount = (int) Math.ceil((double) dims.getX() / (double) vectorSize);
final int planeCount = planeRange.getTo() - planeRange.getFrom();
System.out.println("vectorSize="+vectorSize);
System.out.println("planeCount="+planeCount);
final int vectorCount = planeCount * dims.getY() * rowVectorCount;
System.out.println("vectorCount="+vectorCount);
int[][] rowVectors = new int[vectorCount][vectorSize];
int vectorIndex = 0;
......@@ -49,9 +52,9 @@ public abstract class BasicLoader {
baseX = rowVectorIndex * vectorSize;
for (int vectorX = 0; vectorX < vectorSize; vectorX++) {
if (baseX + vectorX >= dims.getY())
if ((baseX + vectorX) >= dims.getY())
break;
rowVectors[vectorIndex][vectorX] = planeData[Block.index((baseX + vectorX), row, dims.getY())];
rowVectors[vectorIndex][vectorX] = planeData[Block.index((baseX + vectorX), row, dims.getX())];
}
++vectorIndex;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment