-
Notifications
You must be signed in to change notification settings - Fork 132
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
Patch GAP package Alnuth to call OSCAR instead of PARI #2220
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #2220 +/- ##
=======================================
Coverage 73.43% 73.43%
=======================================
Files 367 367
Lines 50043 50049 +6
=======================================
+ Hits 36748 36753 +5
- Misses 13295 13296 +1 |
bcb8cd8
to
91fafe0
Compare
gap/OscarInterface/gap/alnuth.gi
Outdated
Assert(0, Oscar.is_one(facs.unit)); | ||
|
||
result := []; | ||
# TODO: implement iterating over Julia collections???? |
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.
Done in oscar-system/GAP.jl#861
@ThomasBreuer any thoughts on this? Otherwise I'll merge this soon |
@@ -0,0 +1,47 @@ | |||
# this needs RadiRoot to be loaded | |||
gap> START_TEST("Factorisation of polynomials using PARI/GP"); |
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.
gap> START_TEST("Factorisation of polynomials using PARI/GP"); | |
gap> START_TEST("Factorisation of polynomials using Oscar"); |
gap/OscarInterface/gap/alnuth.gi
Outdated
for f in JuliaToGAP(IsList, Oscar.collect(facs.fac)) do | ||
# Convert factor to GAP | ||
g := Julia.map(Oscar.coordinates, f[1].coeffs); | ||
g := CallJuliaFunctionWithKeywordArguments(Oscar.GAP.julia_to_gap, [g], rec( recursive := true)); |
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.
Looks complicated. What is wrong with JuliaToGAP(IsList, g, true)
?
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.
Huh, good question. I am pretty sure I tried that and there was an error back then, but I probably just did it wrong somehow... It definitely passes the tests now, so I'll use that. Thanks!
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.
This looks very nice. (I have added just two minor comments.)
If I understand the comment "also store the isomorphism" for _OscarField
right then the point is to support isomorphisms from the number fields defined in alnuth (matrix fields) to number fields in Oscar. In order to provide this in a file in Oscar/src/GAP
, we have to assume that the alnuth package is already loaded.
I can provide such an isomorphism in a separate pull request.
(In the direction from Oscar to GAP, iso_oscar_gap
creates an AlgebraicExtension
field from a number field.)
Co-authored-by: Claus Fieker <[email protected]>
@ThomasBreuer yes that sounds right: we are given an "alnuth number field", and want to store not just an isomorphic Oscar field, but also an isomorphism that can compute images and preimages. Once that is in place, we can start looking into a larger refactoring of Alnuth: in the current setup, a lot of redundant work is done (e.g. GAP code reverses the order of coefficients for a polynomial, as that is what Pari expects; but we hijack that, and have to undo the reverse; compute; then reverse our answer, only for GAP to then re-reverse....). And there are a bunch of Alnuth functions that could be done much more efficiently if we were to "inject" ourselves at a higher level... But this is future work, the first goal is to have this working without Pari, which this PR achieves. Next, I'll make a new Alnuth release with much of this code in it. Once GAP 4.13.0 is out, we can simplify code here again. |
@fingolfin The natural way to define However, the current My question is: Shall |
There are still some bugs in it, I'll work on fixing those and adding some proper tests next.Should be fully functional now.
UPDATE: I've also submitted the changes as a PR to Alnuth, so that its next release will support this out of the box.