Skip to content

Commit

Permalink
Fix degree computation for filtered rings (#923)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexD97 committed Dec 23, 2021
1 parent 4fa0067 commit 6183cb1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Rings/mpoly-graded.jl
Original file line number Diff line number Diff line change
Expand Up @@ -395,11 +395,11 @@ function degree(a::MPolyElem_dec)
for i=1:length(c)
u += c[i]*d[i]
end
if isfiltered(W)
w = W.lt(w, u) ? u : w
elseif first
if first
first = false
w = u
elseif isfiltered(W)
w = W.lt(w, u) ? u : w
else
w == u || error("element not homogeneous")
end
Expand Down
4 changes: 4 additions & 0 deletions test/Rings/mpoly-graded-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ end
@testset "Degree" begin
R, (x,y) = grade(PolynomialRing(QQ, ["x", "y"])[1]);
@test_throws ArgumentError degree(zero(R))

Z = abelian_group(0)
R, (x,y) = filtrate(PolynomialRing(QQ, ["x", "y"])[1], [Z[1], Z[1]], (x,y) -> x[1] > y[1])
@test degree(x+y^3) == 1*Z[1]
end

@testset "Grading" begin
Expand Down

0 comments on commit 6183cb1

Please sign in to comment.