Repository navigation
sparse-FGLM early termination - #413
Open
jerebertho wants to merge 3 commits into
Open
jerebertho wants to merge 3 commits into
jerebertho wants to merge 3 commits into
Conversation
jerebertho
force-pushed
the
sparse-early-termination
branch
from
November 24, 2026 23:32
aefe167 to
f501973
Compare
jerebertho
marked this pull request as ready for review
November 24, 2026 23:32
jerebertho
force-pushed
the
sparse-early-termination
branch
from
November 25, 2026 14:52
f501973 to
3b9b14b
Compare
The scalar sequence of sparse-FGLM stops as soon as its linear complexity L satisfies L < D and npts >= 2 L + m, checked every max(16, npts / 64) points, instead of always computing 2 D terms. The minimal polynomial is then read from the Berlekamp-Massey object already filled. There is no fallback, so the margin is m = max(32, ceil(74 / floor(log2 p))): a wrong stop has probability about p^-m per check. Over Q, the degree of the minimal polynomial on the first prime sets the first check (2 deg + m points) on the next primes; if the degree differs, the usual checks follow. Primes already rejected in secondary_modular_steps no longer run FGLM on the matrix of a previous prime. With -P 2 -l 44 -t 1 on a dense system with D = 4096 and an eliminating polynomial of degree 13, msolve takes 3.3 s instead of 14.2 s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jerebertho
force-pushed
the
sparse-early-termination
branch
from
November 28, 2026 21:15
3b9b14b to
c962431
Compare
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.
Early termination of Berlekamp-Massey in sparse-FGLM
This PR stops the scalar sequence of sparse-FGLM as soon as its minimal polynomial is
known with high probability, instead of always computing 2D terms, where D is the
degree of the ideal. It does not change the outputs.
Sparse-FGLM computes the scalar sequence s_i = <1, M_n^i r>, for r random, and runs
Berlekamp-Massey on it. Berlekamp-Massey is now fed while the sequence is computed and
checked every max(16, npts/64) points: as soon as the linear complexity L of the
sequence is less than D and npts >= 2L + m, the sequence stops. The minimal polynomial
is then read from the Berlekamp-Massey object already filled. When the minimal
polynomial has degree d < D (e.g. non-radical ideals or ideals whose quotient is not
cyclic), the cost of the sequence drops from 2D to about 2d + m matrix-vector products.
There is no fallback if the stop is wrong, so the margin is large: m = 128.
Heuristically, if the full sequence has linear complexity > L, a check with
npts >= 2L + m stops wrongly with probability about p^-m. With at most about 2^10
checks for D < 2^31, the total probability is at most 2^-118, even for p = 2.
Over QQ, the degree of the minimal polynomial modulo the first prime sets the first
check on the other primes, at 2 deg + m points; if the degree differs modulo a prime,
the usual checks follow. Moreover, primes already rejected in the multi-modular loop no
longer run sparse-FGLM on the matrix of a previous prime.
There is no new option and the verbose output is unchanged.
Over a prime field whose characteristic is a 31-bit prime,
-l 44 -P 2(timing and memory overall)Over QQ,
-P 2(timing and memory overall)The outputs are identical to those of master on the test
suite and on additional systems over prime fields of characteristic 251, 257, 65521 and 2^30+3 and over QQ,
with the default call,
-P 1,-P 2and-P 2 -t 2.PR #401 uses the same early termination when sparse-FGLM is tried before classical
FGLM, with a margin of 32 since classical FGLM is the fallback there.
Use of generative AI
AI-assisted code writing, debugging and testing.