diff --git a/src/Rings/MPolyMap/flattenings.jl b/src/Rings/MPolyMap/flattenings.jl index 2d7ff7ca2f97..742794335bdb 100644 --- a/src/Rings/MPolyMap/flattenings.jl +++ b/src/Rings/MPolyMap/flattenings.jl @@ -169,7 +169,12 @@ kk = coefficient_ring(R)::Field G = grading_group(S) - w = degree.(gens(S)) + if !is_trivial(S) + w = degree.(gens(S)) + else + # if S is trivial, the weights don't matter + w = [zero(G) for i in 1:ngens(S)] + end new_w = vcat(w, [zero(G) for i in 1:ngens(R)]) # Before building S_flat, we have to create a polynomial diff --git a/src/Rings/mpoly-graded.jl b/src/Rings/mpoly-graded.jl index 40394f5d9b62..fa7a3f5a877d 100644 --- a/src/Rings/mpoly-graded.jl +++ b/src/Rings/mpoly-graded.jl @@ -743,17 +743,17 @@ AbstractAlgebra.exponent(a::MPolyDecRingElem, i::Int, j::Int, ::Type{T}) where T function has_weighted_ordering(R::MPolyDecRing) grading_to_ordering = false - w_ord = degrevlex(gens(R)) # dummy, not used + w_ord = degrevlex(R) # dummy, not used # This is not meant to be exhaustive, there a probably more gradings which one # can meaningfully translate into a monomial ordering # However, we want to stick to global orderings. if is_z_graded(R) w = Int[ R.d[i].coeff[1] for i = 1:ngens(R) ] if all(isone, w) - w_ord = degrevlex(gens(R)) + w_ord = degrevlex(R) grading_to_ordering = true elseif all(>(0), w) - w_ord = wdegrevlex(gens(R), w) + w_ord = wdegrevlex(R, w) grading_to_ordering = true end end