-
Notifications
You must be signed in to change notification settings - Fork 161
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
Introduce kernel-level LCM_INT #2019
Conversation
dd150fe
to
9799a6b
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.
Dunno whether it is "worth it", but it doesn't hurt either, so why not :-).
src/integer.c
Outdated
@@ -2202,6 +2202,43 @@ Obj FuncGCD_INT ( Obj self, Obj opL, Obj opR ) | |||
return GcdInt( opL, opR ); | |||
} | |||
|
|||
Obj LcmInt ( Obj opL, Obj opR ) |
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 recently started using clang-format
for new entries in this file (and a few older ones). Perhaps use this here, too? I.e. just do git clang-format HEAD^ && git commit --amend -C HEAD
9799a6b
to
33ec3d6
Compare
Codecov Report
@@ Coverage Diff @@
## master #2019 +/- ##
==========================================
+ Coverage 66% 66.02% +0.01%
==========================================
Files 898 898
Lines 273275 273285 +10
Branches 12745 12773 +28
==========================================
+ Hits 180384 180424 +40
+ Misses 90069 90038 -31
- Partials 2822 2823 +1
|
ba3cff6
to
64f783c
Compare
BTW, we don't seem to have any test cases for |
64f783c
to
7dbede5
Compare
This is done using the gmp function mpz_lcm.
7dbede5
to
13118fe
Compare
This is done using the gmp function mpz_lcm. For large integers this leads to some speedup (over the GAP variant) when computing least common multiples.
I am not entirely sure whether this is worth it, but I open the pull request just in case. The background is that I compute the LCM of a very long list of fairly large integers.
A further pull request (which has a much bigger impact for my examples) will provide a divide-and-conquer folding function for lists.