-
Notifications
You must be signed in to change notification settings - Fork 59
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
sage: don't import stuff in low level functions #239
Conversation
Why does |
Because we need to import and export Sage Integers. |
can't you use |
Not as far as I can tell: we do Sage integers only for i/o with Sage. We should use something like gmpy2 for arbitrary precision floating point numbers but I guess that's out of scope for this PR. |
I/O with Sage? Do you mean that for some strange reason you accept Sage intergers as input, and can return results of this type, too? I don't think it's a good design, to be frank. |
Yep. This is because I have no interest in writing wrappers for every FPyLLL function that takes Integers in Sage. I write 10 lines in FPyLLL or 10 times more of boilerplate in Sage. |
10 times? As far as I can see, Sage only ever imports |
|
FPyLLL isn't only in Sage to drive Sage's high-level functions but also to make experimenting with lattice reduction in Sage easy. So this should work: sage: from fpylll import IntegerMatrix
sage: A = IntegerMatrix(10, 10)
sage: A[0,0] = 17
sage: A[0,0]
17 FWIW: FPyLLL is underutilised even in Sage's highlevel functions because I lack the resources at the moment to hook it in nicely everywhere. |
I've applied this patch on my copy of nixpkgs, and this solves the problem from the sage-devel discussion (I'll write an answer there, too):
Note that I've applied the patch only to the fpylll version used in sage, which is visible by the comparing the paths of the dependencies ( |
one can do e.g. sage: A[0,0] = int(17) and avoid the conversion dance all together. |
Yup, we can put that burden on the users :) |
See https://groups.google.com/g/sage-devel/c/iIttQjz-Zaw/m/Gs9BnTLsBQAJ