-
Notifications
You must be signed in to change notification settings - Fork 243
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
Added functionality and documentation for calculating roots of univariate polynomials #935
base: main
Are you sure you want to change the base?
Conversation
…iate polynomials over the integers (fmpz_poly) over finite fields, p-adic fields and q-adic fields.
p-adic and q-adic roots.
What is the rationale for making this a new module instead of putting root-finding methods in the fq, padic and qadic modules? |
Sage has the method roots attached to integer polynomials with input ring = GF, Zp .. Qq, where roots over Qq is not working correctly at the moment.
Either way is fine with me.
… On 12. Apr 2021, at 17:44, Fredrik Johansson ***@***.*** ***@***.***>> wrote:
What is the rationale for making this a new module instead of putting root-finding methods in the fq, padic and qadic modules?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#935 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAZTMAX2AAZTOV2IYUTQX5TTIMIM3ANCNFSM42YCE5TQ>.
|
Sage has the method roots attached to integer polynomials with input ring = GF, Zp .. Qq, where roots over Qq is not working correctly at the moment.
Either way is fine with me.
… On 12. Apr 2021, at 17:44, Fredrik Johansson ***@***.*** ***@***.***>> wrote:
What is the rationale for making this a new module instead of putting root-finding methods in the fq, padic and qadic modules?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#935 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAZTMAX2AAZTOV2IYUTQX5TTIMIM3ANCNFSM42YCE5TQ>.
|
These are finding padic, qadic or finite field roots of an integer polynomial (Z[x]). Are you sure you want it that way around @fredrik-johansson ? |
Well, someone who comes across this module might be disappointed that it doesn't do roots in R and C :-) Does @tthsqe12 have an opinion on the interface? |
I don't have much of an opinion on the interface. But I do have questions on the code. First of all, there is no test code yet, so we cannot be sure what the functions are supposed to do. The documentation is not specific on what roots it finds and to what precision, ect.
with output:
|
maybe @thofma has an opinion on how this kind of stuff is supposed to work |
So, the problem here for Qp is: the code finds roots mod p then attemps to lift them using newton's method on f or f', f'' ect if there are multiple roots mod p. The problem is this last case of multiple roots. |
Im sure that @fredrik-johansson would have an opinion here, and I am going to give mine:
This makes the function harder to code, but has the benefit of giving the function a well-defined mathematical prescription. This also means the output of the function is a priori reliable. |
In order to accomplish this exact root stuff for f(x) in Z[x], we can assume:
At this point each exact root of f is identified by the following data:
Furthermore, it easy to see when (x0, k) and some other (x0', k') represent the same root, so we can calculate the roots mod p^k such that f' has at most half valuation at each of these roots mod p^k, and then delete duplicates. |
I will fix the embarrassing problems which of course did not occur in my generic test cases.
I still would like to have a definite vote of you guys on either keeping the exact root stuff in one place (fmpz_poly) or distribute it over all fq, paid and qadic directories. Anybody a strong opinion?
Cheers, H
… On 13. Apr 2021, at 09:37, tthsqe12 ***@***.*** ***@***.***>> wrote:
In order to accomplish this exact root stuff for f(x) in Z[x], we can assume:
f(0) != 0
f is squarefree over Qp by a squarefree factorization over Z
The leading coefficient of f is not divisible by p by a rescale of f.
At this point each exact root of f is identified by the following data:
An integer k0 > 0
An x0 in Z/p^kZ with f(x0) = 0 in Z/p^kZ and f'(x0) != 0 in Z/p^kZ
Furthermore, it easy to see when (x0, k0) and some other (x0', k0') represent the same root, so we can calculate the roots mod p^k such that f' is nonzero at each of these roots mod p^k, and then delete duplicates.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#935 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAZTMAR2LJGYN2LG2BG4EU3TIPYFHANCNFSM42YCE5TQ>.
|
Here is my opinion on the module thingy. In other modules we have a long summary: I don't care where the files are placed, but maybe the return type use for fmpz_poly -> {p|q}adic roots should be general enough to hold arbitrary degree factorizations to consistently support future extensions to the functions. Or, maybe roots in this case are a special enough case to warrant a special type... Arb has |
Life will maybe become easier if we introduce non-underscore vector types with length management (fmpz_vec_t, etc). I've been doing this in Calcium and so far it "feels" right. |
Ok, but do you have any issues with my prescription for the behavior of the function? There can be controversy here... |
No, I agree with everything you said. |
Adding roots functionality to fmpz_poly_factor will not work. One would need to include "fq.h" and "quadic.h" in "fmpz_poly_factor.h" which introduces circular dependencies in the include tree. |
I have no good ideas on the interface. Maybe @fredrik-johansson or @wbhart can chime in. |
The way we normally handle the circular reference issue is to put the signatures in both files, but as a comment in the one that can't support the actual signatures. Usually these are placed at the very bottom of the .h file, with a note in the comment explaining where the real signatures are. This only affects the signature. The implementation remains in the module with the comments rather than the one with the real signatures. See charpoly and minpoly for examples of where this is already done, see for example nmod_mat.h/nmod_poly.h. |
If I may, I believe the algorithm used to compute padic roots is far from optimal. The roots as computed over the finite field Instead, the following method computes the "digits" one at a time:
To further justify why this method might be of interest, allow me to address the specific properties that @tthsqe12 listed above:
I am aware that memory managing this will be a nightmare, but there are some optimizations that can be made right off the bat. |
Indeed, this is a intricate function to write. There are many possible approaches, and I do not expect anything that works to come in at fewer than 1k LOC. |
padic_add (y0, y0, tmp, ctx); | ||
} | ||
/* Newton step: x -> x - poly / poly' */ | ||
padic_inv (y1, y1, ctx); |
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.
I'd suggest a double iteration to compute rt and inv(f'(rt)) at the same time. Otherwise, this inv repeats the previous inve all the time.
Also, in case on many roots, a lifting of the factorisation is much faster than lifting of individual roots.
The precision should be dynamically increased using a lifting chain...
I guess most of this applies to the qadic case as well
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.
https://arxiv.org/pdf/1610.06837.pdf
algo 13, steps 1-3
P. Panayi, Computation of Leopoldt’s p-adic regulator, Dissertation, University of East Anglia, 1995.
contains a "certified" p-adic root finder also in the hard cases
Added functionality and documentation for calculating roots of univariate polynomials over the integers (fmpz_poly_t) over finite fields (fq_t), p-adic fields (padic_t) and q-adic fields (qadic_t).