Skip to content
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

Implement fmpz_mod_poly_xgcd for all squarefree modulus? #2204

Open
user202729 opened this issue Jan 28, 2025 · 1 comment
Open

Implement fmpz_mod_poly_xgcd for all squarefree modulus? #2204

user202729 opened this issue Jan 28, 2025 · 1 comment

Comments

@user202729
Copy link
Contributor

Currently, fmpz_mod_poly_xgcd only works reliably for prime modulus.

Nevertheless, as long as n is squarefree, then (ℤ/nℤ)[x] ≅ ∏ (ℤ/pℤ)[x] is a principal ideal ring, so xgcd is well-defined — if in the process of performing Euclidean division, a noninvertible nonzero leading coefficient is encountered, use that to factorize n and continue separately for each factor, then crt the result together.

Example: gcd(x, 2) = 3*x+2 in (ℤ/6ℤ)[x]. (x = (3*x+2)*(2*x+3) and 2 = (3*x+2)*4)

Thoughts?

@fredrik-johansson
Copy link
Collaborator

Yes, that would be nice, and indeed _fmpz_mod_poly_xgcd_euclidean_f allows returning the divisor.

It would be nice to support returning such a factor in _gr_poly_xgcd_hgcd as well so that the XGCD remains asymptotically fast and so that the same technique can be used more generically. (Though for nmod I guess one could just call n_factor when the xgcd fails...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants