Skip to content

Comments

Use nmod_poly_minimal_irreducible for qadic context creation with small p#2582

Merged
fredrik-johansson merged 2 commits intoflintlib:mainfrom
alexey-orlov-math:qadic-context-optimize-init-small-p
Feb 19, 2026
Merged

Use nmod_poly_minimal_irreducible for qadic context creation with small p#2582
fredrik-johansson merged 2 commits intoflintlib:mainfrom
alexey-orlov-math:qadic-context-optimize-init-small-p

Conversation

@alexey-orlov-math
Copy link
Contributor

@alexey-orlov-math alexey-orlov-math commented Feb 18, 2026

When no Conway polynomial is available and the characteristic fits in a ulong, use nmod_poly_minimal_irreducible instead of the fmpz_mod_poly_randtest_sparse_irreducible. The former is a deterministic search with heavy pruning, improving creation time significantly.

The net result is, locally, from

julia> @time qadic_field(2,1024;precision=1)
  3.849074 seconds (481.74 k allocations: 3.087 GiB, 0.99% gc time, 0.06% compilation time)
(Unramified extension of 2-adic numbers of degree 1024, (2^0 + O(2^1))*a)

julia> @time qadic_field(2,2048;precision=1)
 53.298277 seconds (4.44 M allocations: 37.756 GiB, 2.27% gc time, 0.01% compilation time)
(Unramified extension of 2-adic numbers of degree 2048, (2^0 + O(2^1))*a)

to creating qadic contexts for [2, 3, 5, 7, 11]^[123, 628, 1024, 2048, 2755, 2867] in 15.9 seconds

…ll p

When no Conway polynomial is available and the characteristic fits in a ulong, use nmod_poly_minimal_irreducible instead of the fmpz_mod_poly_randtest_sparse_irreducible. The former is a deterministic search with heavy pruning, improving creation time significantly.
Reorganized context init to have small p case first, moved variables declaration to happen in smaller scope, used fmpz_size + fmpz_get_ui instead of COEFF_IS_MPZ and accessing fmpz pointer, removed sys/types.h include (copy-paste from a different test)
@fredrik-johansson fredrik-johansson merged commit 4011d16 into flintlib:main Feb 19, 2026
12 checks passed
@fredrik-johansson
Copy link
Collaborator

Thanks!

@alexey-orlov-math alexey-orlov-math deleted the qadic-context-optimize-init-small-p branch February 19, 2026 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants