-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize multiplication for Normed #213
Conversation
Codecov Report
@@ Coverage Diff @@
## master #213 +/- ##
==========================================
+ Coverage 90.39% 91.01% +0.61%
==========================================
Files 6 6
Lines 510 534 +24
==========================================
+ Hits 461 486 +25
+ Misses 49 48 -1
Continue to review full report at Codecov.
|
Benchmarkx_n0f8 = collect(rand(N0f8, 1000, 1000)); y_n0f8 = collect(rand(N0f8, 1000, 1000));
x_n0f16 = collect(rand(N0f16, 1000, 1000)); y_n0f16 = collect(rand(N0f16, 1000, 1000));
x_n4f4 = collect(rand(N4f4, 1000, 1000)); y_n4f4 = collect(rand(N4f4, 1000, 1000));
x_n4f12 = collect(rand(N4f12, 1000, 1000)); y_n4f12 = collect(rand(N4f12, 1000, 1000));
z_n4f4 = N4f4.( rand(1000, 1000));
z_n4f12 = N4f12.(rand(1000, 1000));
@btime $x_n0f8 .* $y_n0f8;
@btime $x_n0f16 .* $y_n0f16;
@btime saturating_mul.($x_n4f4, $y_n4f4);
@btime saturating_mul.($x_n4f12, $y_n4f12);
@btime $x_n4f4 .* $z_n4f4;
@btime $x_n4f12 .* $z_n4f12;
|
e330f1d
to
817f18f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remarkable work as usual!
This adds `wrapping_mul`, `saturating_mul` and `checked_mul` binary operations. However, this does not specialize them for `Fixed` and does not change `*` for `Fixed`. This replaces most of Normed's implementation of multiplication with integer operations. This improves the speed in many cases and the accuracy in some cases.
Thank you for all your reviews. |
This adds `wrapping_mul` and `checked_mul` binary operations for `Normed`. This replaces most of Normed's implementation of multiplication with integer operations. This improves the speed in many cases and the accuracy in some cases.
This adds `wrapping_mul` and `checked_mul` binary operations for `Normed`. This replaces most of Normed's implementation of multiplication with integer operations. This improves the speed in many cases and the accuracy in some cases.
This adds `wrapping_mul` and `checked_mul` binary operations for `Normed`. This replaces most of Normed's implementation of multiplication with integer operations. This improves the speed in many cases and the accuracy in some cases.
This adds `wrapping_mul` and `checked_mul` binary operations for `Normed`. This replaces most of Normed's implementation of multiplication with integer operations. This improves the speed in many cases and the accuracy in some cases.
This adds
wrapping_mul
,saturating_mul
andchecked_mul
binary operations. However, this does not specialize them forFixed
and does not change*
forFixed
.This applies the wrapping arithmetic as the default arithmetic of
*
for the abstractFixedPoint
, but as mentioned above, the*
forFixed
is not affected by the default arithmetic. Furthermore,*
forNormed
overrides the default arithmetic with the "checked" arithmetic for backward compatibility. (Strictly speaking, the error type is changed fromArgumentError
toOverflowError
.)This replaces most of Normed's implementation of multiplication with integer operations. This improves the speed in many cases and the accuracy in some cases.
Fixes #174