luhenry / netlib

An high-performance, hardware-accelerated implementation of Netlib in Java
Other
64 stars 12 forks source link

Bug in Java8BLAS.sgemm #8

Closed hexiaoyupku closed 2 years ago

hexiaoyupku commented 3 years ago

The result of Java8BLAS.sgemm is not correct.

Here is my example: A: [[0.2327398,0.08320886], [0.16354126,0.7979171], [0.38792253,0.8734575], [0.03918451,0.033988416], [0.46472406,0.90366197]]

B: [[0.8973259,0.22549635,0.8417091], [0.5352137,0.4388209,0.19415224]]

The result of A * B should be: [[0.25337797 0.08899576 0.21205439] [0.57380597 0.38702066 0.29257156] [0.81557935 0.47076652 0.49610165] [0.05335234 0.02375079 0.03958089] [0.9006612 0.50133934 0.56661047]]

But Java8BLAS.sgemm gives: [[0.25337797,0.08899576,0.21205439] [0.573806,0.15491739,0.0] [0.8155793,0.4707665,0.49610162] [0.05335234,0.023750791,0.039580885] [0.90066123,0.5013393,0.56661046]]

adampauls commented 3 years ago

This is the same issue as https://github.com/luhenry/netlib/issues/7 I think. I see erroneously duplicated sum11 lines in Java8BLAS as well.

hexiaoyupku commented 2 years ago

This is the same issue as #7 I think. I see erroneously duplicated sum11 lines in Java8BLAS as well.

That's the reason! I fixed it by replacing sum11 with sum12 in proper place. Thanks a lot!