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
reduced_basis for number field multiples wrong #10017
Comments
comment:1
Looks like the definition of
|
Stopgaps: todo |
comment:7
While the original diagnosis is not wrong, there is a more basic problem as this smaller example shows:
Although the ring of integers is an order which knows its own Z-basis, when you construct an element of the order from an integer vector it ignores that and uses the power_basis of the field and not its integral basis. I think the problem is in these lines of _element_constructor() (order.py lines 1142-1143):
There appears to be a related problem in the constructor of OrderElementAbsolute in number_field_element:
where the parameter f is not documented and there are no relevant tests, but this seems to be saying "take the data in f and construct a field element from it". Perhaps the simplest solution is to go to those lines in order.py and insert code to handle the case where the input data is an integer vector of the right length. |
comment:8
After doing the above "simplest solution", which did fix the
which is a lot better. Patch up when I have added doctests... |
comment:9
The doctest based on the original post works fine for me when run manually, but when run as a doctest something weird happens -- it takes ages and then gives an enormous python crash. I have no idea what this is but hope that a human can help before this breaks all the patchbots out there... New commits:
|
Author: John Cremona |
Branch: u/cremona/10017 |
Commit: |
comment:11
Quick comments (more might come):
by
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:13
In this block of code:
you are assuming that
|
comment:14
Yes, you are right, and perhaps being explicit like this is safest. I still think (do you agree?) that being able to do ZK(list) is useful and must give the linear combination of ZK's basis with coefficients from the list. A related different point is that after computing the reduced basis, it is stored as |
comment:15
(fixing exponentiation in ticket description) |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:23
The patchbot reports a failure on 32-bit:
|
Reviewer: Jeroen Demeyer |
comment:24
Would it be OK to tag the current output as 64-bit and this alternative as 32-bit? Of course this "reduced basis" is in no way canonical. |
comment:25
let me check if the |
comment:26
On 64-bit, the output stabilizes for
|
comment:27
That's a lot better -- can you check if it's the same on 32-bit using the same prec (say 120)? |
comment:28
Yes, on 32-bit I get the same result for So the best solution is increasing the |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:30
Apologies for the delay -- I pushed to u/cremona/20017 by mistake 4 days ago. It's now where it should be. |
comment:31
OK, looks good but let's wait for the patchbot. |
comment:32
Sorry to say this, but the branch doesn't merge cleanly... |
comment:33
Replying to @jdemeyer:
Not your fault! I am just building the latest beta and will merge it with my branch shortly. |
comment:35
OK, I merged, fixed the small conflict and a deprecation warning. Let's see if the patchbots like this one better. |
Changed branch from u/cremona/10017 to |
This was reported by the "report a problem" link:
The reduced_basis for number fields applies LLL to basis of the maximal order in order to get a reduced basis. The problem is that after applying LLL, it multiples the transformation matrix by the vector [1,a,a2,...], where 'a' is generator of the field - instead of using the vector it actually used for the maximal order.
How to reproduce:
This prints a crazy big polynomial. Looking a bit at what is returned it is clear that reduced_basis is multiplying the transformation matrix by the wrong vector.
To solve you just need to multiply by the vector of generators of the maximal order:
This works fine.
Component: number fields
Stopgaps: todo
Author: John Cremona
Branch/Commit:
8f1f51d
Reviewer: Jeroen Demeyer
Issue created by migration from https://trac.sagemath.org/ticket/10017
The text was updated successfully, but these errors were encountered: