-
-
Notifications
You must be signed in to change notification settings - Fork 503
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
Faster roots computation for sparse polynomials over ZZ #16516
Comments
This comment has been minimized.
This comment has been minimized.
Commit: |
This comment has been minimized.
This comment has been minimized.
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:5
Hi Bruno, It seems reasonable to have it in For better code, please:
And you must provide timings to see whether it is better with your code for small input. You can use the command
It would be nice to make the following works:
It will be a nice thing to have in Sage! More remarks to come, |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:7
Hi Vincent, Thanks for the comments. I pushed a new version taking them into account, especially for the "better code" part. For roots over QQbar, I think it is not really related to this ticket. It is related to #15790 (implementation of GCD for sparse polynomials). I'd like to work in this other ticket too. Now for the most complicate part (to my mind), timings. The issue is the following: Whether the new algorithm is better than the previous one is not a matter of density. For instance, if you have For the discussion, I refer to the previous algorithm I did tests:
As a consequence of these tests, I do not know how the algorithm should be chosen. Do you have any idea (or any idea of which other tests I should perform to be able to chose)? Finally, I also use the fact that a nonzero root of an integer polynomial should divide its lowest-degree coefficient (constant coefficient if the valuation is zero) to accelerate the computations. On the one hand, if the absolute value TestsFirst test:
Second test
|
Author: Bruno Grenet |
comment:9
Hi, Global remarks:
Comment your code when it is complicated like
open softwares should also be readable softwares
should be
ie open and close with back quotes. Specific ones:
Moreover, the following test is not safe at all
you can not believe that the zero always occupy the same memory. For instance
Moreover, using try except is totally useless in that case... You might be inspired by the implementation of
Vincent |
comment:10
so there is a problem in the case algorithm "dense_with_gcd" in your function
EDIT: my mistake. This is a bug in the code of polynomials: the method content must either return an ideal or a number but not one or the other depending on the implementation... Nevertheless, you should test all cases of your code within the documentation!! Vincent |
comment:11
For the content issue, I opened a thread on sage-devel. |
comment:13
Below are my answers to Vincent's comments:
|
comment:56
Minor comments:
|
comment:57
Replying to @tscrim:
Even better, RTFM https://readthedocs.org/projects/cysignals/ |
comment:59
Replying to @tscrim:
All of these have been taken into account.
I tried to put |
comment:60
Bruno, your
There is a lot of Python code between this The only cases where you should use it is
|
Reviewer: Vincent Delecroix, Travis Scrimshaw |
comment:62
Agg...trac logged me out before I posted my message. Now I don't want to rewrite my long message. Short version:
New commits:
|
comment:63
- # The dense algorithm is to compute the roots from the factorization
+ # The dense algorithm is to compute the roots from the factorization.
+ # It is faster to let the factorization take care of the content
if algorithm == "dense":
return p._roots_from_factorization(p.factor(), multiplicities) That is not true! The problem is that the factorization factors the content, which may take a very long time of course. As a consequence, there is a failing test in By the way, thanks for cleaning my code! |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:65
I added a few lines to remove the content before calling |
comment:66
Then I am ready to set this to a positive review if there are no other objections. |
Changed reviewer from Vincent Delecroix, Travis Scrimshaw to Vincent Delecroix, Travis Scrimshaw, Jeroen Demeyer |
comment:68
My last commit is a merge and removing part of the comment that wasn't true. Since the patchbot was (essentially) green on the previous branch and my change was trivial, I'm setting this to a positive review since there were no objections. |
Changed branch from public/polynomials/faster_roots_sparse_zz-16516 to |
Algorithms exist for the computation of the roots of sparse polynomials, which are much faster than the "generic" algorithms which work for dense polynomials.
In this ticket, I implement one of these algorithms, for integer roots of sparse polynomials over ZZ.
Component: commutative algebra
Keywords: roots, sparse polynomial
Author: Bruno Grenet
Branch/Commit:
686d2b3
Reviewer: Vincent Delecroix, Travis Scrimshaw, Jeroen Demeyer
Issue created by migration from https://trac.sagemath.org/ticket/16516
The text was updated successfully, but these errors were encountered: