Skip to content

Commit

Permalink
feat: prepare for fixes for polynomial rings over zero rings
Browse files Browse the repository at this point in the history
  • Loading branch information
thofma committed Nov 25, 2024
1 parent 3e670f7 commit 7074443
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 6 additions & 1 deletion src/Rings/MPolyMap/flattenings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/Rings/mpoly-graded.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7074443

Please sign in to comment.