Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix a bug in gcd for polynomials #1799

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

joschmitt
Copy link
Collaborator

I don't know what this function is doing, so this is an educated guess. For polynomials over fields, another gcd is used. The function fixed here is only called if one specifies the ignore_content = true.

I found this by calling is_squarefree on a polynomial over a number field in Nemo.

@thofma
Copy link
Member

thofma commented Sep 18, 2024

Can you post the example to reproduce it?

@joschmitt
Copy link
Collaborator Author

julia> Rx, x = QQ["x"]
gcd(Univariate polynomial ring in x over rationals, (x)

julia> gcd(x, x, true)
ERROR: UndefVarError: `c` not defined
Stacktrace:
 [1] gcd(a::AbstractAlgebra.Generic.Poly{Rational{BigInt}}, b::AbstractAlgebra.Generic.Poly{Rational{BigInt}}, ignore_content::Bool)
   @ AbstractAlgebra ~/.julia/dev/AbstractAlgebra/src/Poly.jl:1890
 [2] top-level scope
   @ REPL[6]:1

gcd(x, x) calls another method though.

Copy link

codecov bot commented Sep 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.99%. Comparing base (0f40154) to head (f9c6664).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1799   +/-   ##
=======================================
  Coverage   87.99%   87.99%           
=======================================
  Files         119      119           
  Lines       30073    30073           
=======================================
  Hits        26464    26464           
  Misses       3609     3609           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@thofma
Copy link
Member

thofma commented Sep 18, 2024

This version (with the third boolean argument) should probably not be user-facing, but I guess there is no harm fixing it here.

@lgoettgens lgoettgens closed this Sep 20, 2024
@lgoettgens lgoettgens reopened this Sep 20, 2024
@fingolfin
Copy link
Member

could/should we add a test?

@joschmitt
Copy link
Collaborator Author

could/should we add a test?

I don't know what the function is supposed to do, so I don't feel qualified.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants