Skip to content

Commit

Permalink
Add missing ordering and correct some orderings.
Browse files Browse the repository at this point in the history
  • Loading branch information
wbhart committed Nov 5, 2021
1 parent 8c7cc49 commit 3423fa1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions src/Rings/mpoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,8 @@ function singular(o::Orderings.GenOrdering)
return Singular.ordering_Dp(length(v))
elseif o.ord == :revlex
return Singular.ordering_rp(length(v))
elseif o.ord == :neglex
return Singular.ordering_ls(length(v))
elseif o.ord == :negdegrevlex
return Singular.ordering_ds(length(v))
elseif o.ord == :negdeglex
Expand Down
12 changes: 6 additions & 6 deletions src/Rings/orderings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -722,9 +722,9 @@ function _isless_lex(f::MPolyElem, k::Int, l::Int)
function _isless_weightnegdeglex(f::MPolyElem, k::Int, l::Int, w::Vector{Int})
dk = weighted_degree(f, k, w)
dl = weighted_degree(f, l, w)
if dk < dl
if dk > dl
return true
elseif dk > dl
elseif dk < dl
return false
end
return _isless_lex(f, k, l)
Expand All @@ -738,7 +738,7 @@ function _isless_lex(f::MPolyElem, k::Int, l::Int)
elseif dk < dl
return false
end
return _isless_negrevlex(f, k, l)
return _isless_revlex(f, k, l)
end

function _isless_matrix(f::MPolyElem, k::Int, l::Int, M::Union{ Matrix{T}, MatElem{T} }) where T
Expand Down Expand Up @@ -959,9 +959,9 @@ function _cmp_monomials(f::MPolyElem, k::Int, l::Int, o::Oscar.Orderings.GenOrde
end
end
elseif o.ord == :negwdeglex
if dk < dl
if dk > dl
return -1
elseif dk > dl
elseif dk < dl
return 1
end
for i in o.vars
Expand All @@ -979,7 +979,7 @@ function _cmp_monomials(f::MPolyElem, k::Int, l::Int, o::Oscar.Orderings.GenOrde
elseif dk < dl
return 1
end
for i in o.vars
for i in reverse(o.vars)
ek = exponent(f, k, i)
el = exponent(f, l, i)
if ek > el
Expand Down
2 changes: 1 addition & 1 deletion test/Rings/orderings-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ end
o = negrevlex([x1, x2])*wdegrevlex([x3, x4], [1, 2])
@test collect(monomials(f, o)) == M

# currently fails
M = [one(R), x3, x3^2, x4, x3^3, x3*x4, x3^2*x4, x4^2, x3*x4^2,
x4^3, x2, x2*x3, x2*x3^2, x2*x4, x2*x3*x4, x2*x4^2, x2^2, x2^2*x3,
x2^2*x4, x2^3, x1, x1*x3, x1*x3^2, x1*x4, x1*x3*x4, x1*x4^2, x1*x2,
Expand All @@ -98,7 +99,6 @@ end
o = neglex([x1, x2])*negwdegrevlex([x3, x4], [1, 2])
@test collect(monomials(f, o)) == M

# currently fails
M = [x3^3, x3^2*x4, x3^2, x3*x4^2, x3*x4, x3, x4^3, x4^2, x4,
one(R), x1*x3^2, x1*x3*x4, x1*x3, x1*x4^2, x1*x4, x1, x1^2*x3, x1^2*x4,
x1^2, x2*x3^2, x2*x3*x4, x2*x3, x2*x4^2, x2*x4, x2, x1^3, x1*x2*x3,
Expand Down

0 comments on commit 3423fa1

Please sign in to comment.