Skip to content

Commit 93a1695

Browse files
committed
fix errors with dimensions
1 parent bb2255e commit 93a1695

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

  • src

src/main/java/com/github/TannerLow/JavaMatrixMath/Matrix.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public Matrix multiply(Matrix other) throws DimensionsMismatchException {
5555
for(int col = 0; col < this.cols; col++) {
5656
sum += data[row * this.cols + col] * other.data[col * other.cols + otherCol];
5757
}
58-
result.data[row * result.rows + otherCol] = sum;
58+
result.data[row * result.cols + otherCol] = sum;
5959
}
6060
}
6161

@@ -266,7 +266,7 @@ public Matrix multiply(GPU gpu, Matrix other) {
266266

267267
// Set the work-item dimensions
268268
long local_work_sizes[] = new long[]{1, 1};
269-
long global_work_sizes[] = new long[]{rows, cols};
269+
long global_work_sizes[] = new long[]{rows, other.cols};
270270

271271
// Execute the kernel
272272
clEnqueueNDRangeKernel(commandQueue, kernel, 2, null,

src/test/java/com/github/TannerLow/JavaMatrixMath/GpuTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ private static void testMultiply() {
6262

6363
for(int i = 0; i < result.data.length; i++) {
6464
if(!TestMath.withinMariginOfError(expected[i], result.data[i], 0.0005f)) {
65+
System.out.println(expected[i] + " vs " + result.data[i]);
6566
throw new TestFailedException();
6667
}
6768
}

0 commit comments

Comments
 (0)