-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Add fast multiplicative inverses #15357
Conversation
More results on the Broadwell, for different denominators:
|
using Base: LinearFast, LinearSlow, tail | ||
export multiplicativeinverse | ||
|
||
unsigned_type(::Int8) = UInt8 |
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.
I wonder if these should just be methods of unsigned{T<:Signed}(::Type{T})
?
Is there an algorithmic reference for this technique? The comments here aren't especially useful at explaining how this works. |
@tkelman review comments addressed. I made several improvements in performance. The cost of constructing one of these objects is now equivalent to approximately 14 |
Perhaps not fully relevant but potentially useful for other tricks: http://www.jjj.de/fxt/fxtbook.pdf |
Add fast multiplicative inverses
This is part 1 of 2 towards a new version of ReshapedArrays (#10507). I'm making them separate PRs because part 1 is best reviewed by the "numbers" crowd, and part 2 by the "arrays" crowd. I committed this as @simonster, since the core code here was developed by him.
I benchmarked this on 4 different machines against libdivide, which claims to have emphasized performance. We're doing pretty well, especially on master:
julia-0.5 isn't installed on the machines missing numbers (one does not have enough disk space left for a separate build, and the other is Ubuntu 12.04 which has troubles building master).
The tests are in this gist: https://gist.github.com/timholy/1d21885f00ac066d7237.