Repository navigation
Accelerate even-degree polynomial square-root recovery - #185
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Even-degree polynomial X-norm recovery previously used Tonelli–Shanks, requiring nonresidue searches and modular exponentiations whose exponent sizes grow with the factor degree. This change uses a weighted Frobenius trace when modular composition is enabled.
Add frobenius_weighted_sum, using binary doubling with O(log d) compositions and products, shared composition caches, and alias-safe output.
Add even-degree square-root recovery of X modulo an irreducible polynomial. Reuse the existing characteristic-sized seed computation and reduce final root extraction to the coefficient field.
Try the constant representative first. If its trace vanishes, sample through the caller’s generator while reusing the seed and Frobenius image.
Integrate the new path into X-norm reconstruction, retaining Tonelli–Shanks when modular composition is disabled.
The implementation documents its mathematical invariants and irreducibility precondition. Tests cover agreement with direct calculations and Tonelli–Shanks, zero-trace retries, aliasing, nonmonic divisors, invalid inputs, generator exceptions, and multiple arithmetic backends.
Clean, single-core x86 measurements using BN254 Fp12 and the small-prime backend:
Measurements used an AMD EPYC 9454 and GCC 15.2. Smaller cases report three-trial medians; degree 14,028 has one clean trial. Every replay passed exact norm, degree-bound, and modular-root checks. Large-degree baseline comparisons were not run, so those rows report absolute recovery times rather than speedup ratios.