Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/InvariantTheory/iterators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ function AllMonomials(R::MPolyDecRing, d::Int)
end

function AllMonomials(R::MPolyDecRing, d::Int, vars::Vector{Int})
@req is_standard_graded(R) "Iterator only implemented for the standard graded case"
@req is_z_graded(R) "Iterator only implemented when the grading group is Z"
@req all(isequal(ZZ(1)), map(i -> degree(R[i])[1], vars)) "Iterator only implemented for variables of degree 1"
return AllMonomials{typeof(R)}(R, d, vars)
end

Expand Down
4 changes: 4 additions & 0 deletions test/InvariantTheory/iterators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,8 @@
@test collect(monomials_of_degree(R, 3, 1:1)) == [x^3]
@test isempty(monomials_of_degree(R, 2, Int[]))
end

R = graded_polynomial_ring(QQ, [:x, :y, :z], [1, 1, 3])[1]
x, y, z = gens(R)
@test collect(monomials_of_degree(R, 3, [1, 2])) == [x^3, x^2 * y, x * y^2, y^3]
end