Skip to content

Commit

Permalink
Merge pull request #531 from oscar-system/th/qupgrad
Browse files Browse the repository at this point in the history
Fix return type of homogenous_components
  • Loading branch information
fieker committed Jul 7, 2021
2 parents c9fde9d + c90fd9b commit 76e005f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Rings/MPolyQuo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,8 @@ end

function homogeneous_components(a::MPolyQuoElem{<:MPolyElem_dec})
simplify!(a)
return homogeneous_components(a.f)
h = homogeneous_components(a.f)
return Dict{keytype(h), typeof(a)}(x => parent(a)(y) for (x, y) in h)
end

function ishomogeneous(a::MPolyQuoElem{<:MPolyElem_dec})
Expand Down
9 changes: 8 additions & 1 deletion test/Rings/mpoly-graded-test.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
@testset "MPolyQuo.graded" begin
R, (x, y) = grade(PolynomialRing(QQ, ["x", "y"])[1]);
Q = quo(R, ideal([x^2, y]))[1];
h = homogeneous_components(Q[1])
@test valtype(h) === elem_type(Q)
end

function _random_poly(RR, n)
pols = elem_type(RR)[]
for t in 1:n
Expand Down Expand Up @@ -125,7 +132,7 @@ end
for deg in [degree(R_quo(mon)) for mon = Oscar.monomials(f.f)]
h = get(D, deg, 'x')
@test ishomogeneous(R_quo(h))
@test h == homogeneous_component(f, deg)
@test h == R_quo(homogeneous_component(f, deg))
end

@test Oscar.isfiltered(R_quo) == Oscar.isfiltered(RR)
Expand Down

0 comments on commit 76e005f

Please sign in to comment.