Commit
2 years ago
gh-35346: Do not require a multiplicative generator for finite field nth_root ### 📚 Description This patch avoids computing a multiplicative generator in `nth_root` for finite fields, which usually requires factoring the order of the multiplicative group, which can be very expensive. The following example, included in doctests of this patch, currently does not complete in finite time (instead of a few ms after the change): ``` sage: p = 2^1024 + 643 sage: a = GF(p, proof=False)(3)**(29*12345) sage: a.nth_root(29) ``` The issue is well-known to various users. A previous proposal, Trac ticket #28585 was suggesting switching to Adleman-Manders-Miller entirely to fix the same issue. This patch instead performs minimal changes, keeps the Johnston's algorithm, only modifying how the value of `g^h` is computed (it seems legit to still call it Johnston's algorithm because it processes `r^k`-th roots in a single discrete log, using the formula from the article), using the existing `zeta` method. ### 📝 Checklist - [x] I have made sure that the title is self-explanatory and the description concisely explains the PR. - [x] I have linked an issue or discussion. - [x] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. URL: https://github.com/sagemath/sage/pull/35346 Reported by: Rémy Oudompheng Reviewer(s): Vincent Delecroix
Author
Release Manager
Loading