sonsongithub / numsw

Swift library like numpy, playgrounds notebook like jupyter.
MIT License
134 stars 9 forks source link

Don't set 0s for C in Matrix Multiplication #36

Closed t-ae closed 7 years ago

t-ae commented 7 years ago

This is the definition of cblas_dgemm https://developer.apple.com/reference/accelerate/1513282-cblas_dgemm?language=objc

C←αAB + βC

If β is 0, setting 0s for C is not needed. I set 0 for β that day, but left C's assignment...

omochi commented 7 years ago

え、ゼロ埋めが必要だったけどやってなかったっていうバグじゃなかったの?

t-ae commented 7 years ago

βが1になってたのがバグの原因でした。 TensorSwiftからコピペしたんですがもともと1になってました(向こうは0クリアしてた)。 当日は0クリアで解決したんですが、その後でドキュメント読み直してβを0にすれば良いことに気づくまでは行っていました。それで、βを0にしたんですがなぜかCの0クリアが残ったままになっていたので、それを修正したPRです。

omochi commented 7 years ago

なるほど