-
-
Notifications
You must be signed in to change notification settings - Fork 674
Workaround for linbox charpoly/minpoly issues #40856
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
Conversation
Documentation preview for this PR (built with commit e5ab51a; changes) is ready! 🎉 |
If that (leading? last?) coefficient guaranteed to be I think the "linbox is unreliable" comments would be more helpful around |
7f848ff
to
e5ab51a
Compare
my understanding is that the algorithm fails if it incorrectly choose a prime that makes the minpoly mod that prime's degree less than the minpoly over ℤ's degree. If that happens (and at least a good prime is selected) then the leading coefficient must be ≡ 1 mod the good primes and ≡ 0 mod the bad prime, so it cannot be 1. A corner case I can think of is what if all primes selected are bad, but I think this is impossible because of the Hadamard bound. |
So the size of the coefficient list is known beforehand? I was thinking it might still output a monic polynomial but of a lesser degree, which, if the zeros are omitted, could still have Regardless, this can't be any worse, and fixes the reproducible case that we have. Let's try it. |
sagemathgh-40856: Workaround for linbox charpoly/minpoly issues As in the title. Fix sagemath#37068. Can be removed once the upstream issue https://github.com/linbox- team/linbox/issues/53 is fixed. It's possible to do a more expensive check (e.g. check if the matrix satisfy the minpoly with something like Freivalds' algorithm), but I guess this suffice (and it's very cheap). ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [ ] The title is concise and informative. - [ ] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#40856 Reported by: user202729 Reviewer(s):
sagemathgh-40856: Workaround for linbox charpoly/minpoly issues As in the title. Fix sagemath#37068. Can be removed once the upstream issue https://github.com/linbox- team/linbox/issues/53 is fixed. It's possible to do a more expensive check (e.g. check if the matrix satisfy the minpoly with something like Freivalds' algorithm), but I guess this suffice (and it's very cheap). ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [ ] The title is concise and informative. - [ ] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#40856 Reported by: user202729 Reviewer(s):
As in the title. Fix #37068. Can be removed once the upstream issue linbox-team/linbox#53 is fixed.
It's possible to do a more expensive check (e.g. check if the matrix satisfy the minpoly with something like Freivalds' algorithm), but I guess this suffice (and it's very cheap).
📝 Checklist
⌛ Dependencies