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

Is_unit and is_nilpotent (with tests) #1933

Merged
merged 44 commits into from
Dec 21, 2024
Merged

Conversation

JohnAAbbott
Copy link
Collaborator

@JohnAAbbott JohnAAbbott commented Dec 17, 2024

Fixes #11

src/LaurentMPoly.jl Outdated Show resolved Hide resolved
src/MPoly.jl Outdated Show resolved Hide resolved
src/MPoly.jl Outdated Show resolved Hide resolved
src/MPoly.jl Outdated Show resolved Hide resolved
src/MPoly.jl Outdated Show resolved Hide resolved
src/Poly.jl Outdated Show resolved Hide resolved
src/Poly.jl Show resolved Hide resolved
src/Rings.jl Outdated Show resolved Hide resolved
@thofma
Copy link
Member

thofma commented Dec 18, 2024

I don't think we can rely on any order when iterating over the coefficients. The only guarantee that we have is that coefficients and exponent[_vectors] have the same order. E.g., this is the implementation of constant_coefficient:

function constant_coefficient(p::MPolyRingElem{T}) where T <: RingElement
   if !iszero(p)
      for (c, v) in zip(coefficients(p), exponent_vectors(p))
         if iszero(v)
            return c
         end
      end
   end
   return zero(base_ring(p))
end

@JohnAAbbott
Copy link
Collaborator Author

I notice that there are tests of is_unit for Laurent series: for instance

./generic/LaurentSeries-test.jl:156:   @test is_unit(-1 + x + 2x^2)

Should I disable these tests? I have not yet checked which code would be called...
Perhaps it is simpler to leave things be?

src/MPoly.jl Outdated Show resolved Hide resolved
@JohnAAbbott
Copy link
Collaborator Author

Right now I don't know how to write a test which will cover the lines which the codecov bot complained about. I don't think it is important to cover them.

src/NCRings.jl Outdated Show resolved Hide resolved
@JohnAAbbott JohnAAbbott marked this pull request as ready for review December 20, 2024 14:41
src/NCPoly.jl Outdated Show resolved Hide resolved
src/MPoly.jl Outdated Show resolved Hide resolved
src/MPoly.jl Outdated Show resolved Hide resolved
src/NCRings.jl Outdated Show resolved Hide resolved
src/MPoly.jl Outdated Show resolved Hide resolved
src/MPoly.jl Outdated Show resolved Hide resolved
src/NCRings.jl Outdated Show resolved Hide resolved
julia> S, x = polynomial_ring(QQ, :x);

julia> is_nilpotent(30*x), is_nilpotent(30+90*x), is_nilpotent(S(15))
(true, true, false)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JohnAAbbott seems you and the code disagree as to what the correct output is?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thepolynomial_ring should be over the ring created before, not over QQ. Fixed now

@fingolfin fingolfin merged commit 8947539 into Nemocas:master Dec 21, 2024
21 checks passed
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.

isunit for univariate and multivariate polynomials is incorrect over Z/nZ
3 participants